Skip to content

Commit

Permalink
removed some internal functions from export
Browse files Browse the repository at this point in the history
  • Loading branch information
dave committed Jun 27, 2023
1 parent 99bf96b commit 7ef9bc5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
82 changes: 41 additions & 41 deletions inst/include/h3libapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,42 +587,42 @@ Direction(*fun)(H3Index, H3Index) =
return fun(origin, destination);
}

inline void _geoToFaceIjk(const LatLng *g, int res, FaceIJK *h) {
void(*fun)(const LatLng*, int, FaceIJK*) =
(void(*)(const LatLng*, int, FaceIJK*)) R_GetCCallable("h3lib", "_geoToFaceIjk");
fun(g, res, h);
}


inline void _faceIjkToGeo(const FaceIJK *h, int res, LatLng *g) {
void(*fun)(const FaceIJK*, int, LatLng*) =
(void(*)(const FaceIJK*, int, LatLng*)) R_GetCCallable("h3lib", "_faceIjkToGeo");
fun(h, res, g);
}

inline void _geoToHex2d(const LatLng *g, int res, int *face, Vec2d *v) {
void(*fun)(const LatLng*, int, int*, Vec2d*) =
(void(*)(const LatLng*, int, int*, Vec2d*)) R_GetCCallable("h3lib", "_geoToHex2d");
fun(g, res, face, v);
}

inline void _hex2dToCoordIJK(const Vec2d *v, CoordIJK *h) {
void(*fun)(const Vec2d*, CoordIJK*) =
(void(*)(const Vec2d*, CoordIJK*)) R_GetCCallable("h3lib", "_hex2dToCoordIJK");
fun(v, h);
}

inline H3Error _h3ToFaceIjk(H3Index h, FaceIJK *fijk) {
H3Error(*fun)(H3Index, FaceIJK*) =
(H3Error(*)(H3Index, FaceIJK*)) R_GetCCallable("h3lib", "_h3ToFaceIjk");
return fun(h, fijk);
}

inline H3Index _faceIjkToH3(const FaceIJK *fijk, int res) {
H3Index(*fun)(const FaceIJK*, int) =
(H3Index(*)(const FaceIJK*, int)) R_GetCCallable("h3lib", "_faceIjkToH3");
return fun(fijk, res);
}
// inline void _geoToFaceIjk(const LatLng *g, int res, FaceIJK *h) {
// void(*fun)(const LatLng*, int, FaceIJK*) =
// (void(*)(const LatLng*, int, FaceIJK*)) R_GetCCallable("h3lib", "_geoToFaceIjk");
// fun(g, res, h);
// }
//
//
// inline void _faceIjkToGeo(const FaceIJK *h, int res, LatLng *g) {
// void(*fun)(const FaceIJK*, int, LatLng*) =
// (void(*)(const FaceIJK*, int, LatLng*)) R_GetCCallable("h3lib", "_faceIjkToGeo");
// fun(h, res, g);
// }
//
// inline void _geoToHex2d(const LatLng *g, int res, int *face, Vec2d *v) {
// void(*fun)(const LatLng*, int, int*, Vec2d*) =
// (void(*)(const LatLng*, int, int*, Vec2d*)) R_GetCCallable("h3lib", "_geoToHex2d");
// fun(g, res, face, v);
// }
//
// inline void _hex2dToCoordIJK(const Vec2d *v, CoordIJK *h) {
// void(*fun)(const Vec2d*, CoordIJK*) =
// (void(*)(const Vec2d*, CoordIJK*)) R_GetCCallable("h3lib", "_hex2dToCoordIJK");
// fun(v, h);
// }
//
// inline H3Error _h3ToFaceIjk(H3Index h, FaceIJK *fijk) {
// H3Error(*fun)(H3Index, FaceIJK*) =
// (H3Error(*)(H3Index, FaceIJK*)) R_GetCCallable("h3lib", "_h3ToFaceIjk");
// return fun(h, fijk);
// }
//
// inline H3Index _faceIjkToH3(const FaceIJK *fijk, int res) {
// H3Index(*fun)(const FaceIJK*, int) =
// (H3Index(*)(const FaceIJK*, int)) R_GetCCallable("h3lib", "_faceIjkToH3");
// return fun(fijk, res);
// }

inline H3Error cellToLocalIjk(H3Index origin, H3Index h3, CoordIJK *out) {
H3Index(*fun)(H3Index, H3Index, CoordIJK*) =
Expand All @@ -636,11 +636,11 @@ inline void _geoToClosestFace(const LatLng *g, int *face, double *sqd) {
fun(g, face, sqd);
}

inline void _ijkToHex2d(const CoordIJK *h, Vec2d *v) {
void(*fun)(const CoordIJK*, Vec2d*) =
(void(*)(const CoordIJK*, Vec2d*)) R_GetCCallable("h3lib", "_ijkToHex2d");
fun(h, v);
}
// inline void _ijkToHex2d(const CoordIJK *h, Vec2d *v) {
// void(*fun)(const CoordIJK*, Vec2d*) =
// (void(*)(const CoordIJK*, Vec2d*)) R_GetCCallable("h3lib", "_ijkToHex2d");
// fun(h, v);
// }

#ifdef __cplusplus
}
Expand Down
16 changes: 8 additions & 8 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ void attribute_visible R_init_h3lib(DllInfo *info)

// Non-API
R_RegisterCCallable("h3lib", "directionForNeighbor", (DL_FUNC) &directionForNeighbor);
R_RegisterCCallable("h3lib", "_geoToFaceIjk", (DL_FUNC) &_geoToFaceIjk);
R_RegisterCCallable("h3lib", "_hex2dToCoordIJK", (DL_FUNC) &_hex2dToCoordIJK);
R_RegisterCCallable("h3lib", "_faceIjkToGeo", (DL_FUNC) &_faceIjkToGeo);
R_RegisterCCallable("h3lib", "_geoToHex2d", (DL_FUNC) &_geoToHex2d);
R_RegisterCCallable("h3lib", "_h3ToFaceIjk", (DL_FUNC) &_h3ToFaceIjk);
R_RegisterCCallable("h3lib", "_faceIjkToH3", (DL_FUNC) &_faceIjkToH3);
R_RegisterCCallable("h3lib", "cellToLocalIjk", (DL_FUNC) &cellToLocalIjk);
// R_RegisterCCallable("h3lib", "_geoToFaceIjk", (DL_FUNC) &_geoToFaceIjk);
// R_RegisterCCallable("h3lib", "_hex2dToCoordIJK", (DL_FUNC) &_hex2dToCoordIJK);
// R_RegisterCCallable("h3lib", "_faceIjkToGeo", (DL_FUNC) &_faceIjkToGeo);
// R_RegisterCCallable("h3lib", "_geoToHex2d", (DL_FUNC) &_geoToHex2d);
// R_RegisterCCallable("h3lib", "_h3ToFaceIjk", (DL_FUNC) &_h3ToFaceIjk);
// R_RegisterCCallable("h3lib", "_faceIjkToH3", (DL_FUNC) &_faceIjkToH3);
// R_RegisterCCallable("h3lib", "cellToLocalIjk", (DL_FUNC) &cellToLocalIjk);
R_RegisterCCallable("h3lib", "_geoToClosestFace", (DL_FUNC) &_geoToClosestFace);
R_RegisterCCallable("h3lib", "_ijkToHex2d", (DL_FUNC) &_ijkToHex2d);
// R_RegisterCCallable("h3lib", "_ijkToHex2d", (DL_FUNC) &_ijkToHex2d);


R_forceSymbols(info, TRUE); // controls visibility
Expand Down

0 comments on commit 7ef9bc5

Please sign in to comment.