Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 114 additions & 116 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,124 +49,122 @@ Rcomplex NA_CPLX;
size_t r_type_sizes[100];
size_t r_type_order[100];

static const
R_CallMethodDef callMethods[] = {
{"Csetattrib", (DL_FUNC) &setattrib, -1},
{"Cbmerge", (DL_FUNC) &bmerge, -1},
{"Cassign", (DL_FUNC) &assign, -1},
{"Cdogroups", (DL_FUNC) &dogroups, -1},
{"Ccopy", (DL_FUNC) &copy, -1},
{"Cshallowwrapper", (DL_FUNC) &shallowwrapper, -1},
{"Csetdt_nrows", (DL_FUNC) &setdt_nrows, -1},
{"Calloccolwrapper", (DL_FUNC) &alloccolwrapper, -1},
{"Cselfrefokwrapper", (DL_FUNC) &selfrefokwrapper, -1},
{"Ctruelength", (DL_FUNC) &truelength, -1},
{"Csetcharvec", (DL_FUNC) &setcharvec, -1},
{"Csetcolorder", (DL_FUNC) &setcolorder, -1},
{"Cchmatch", (DL_FUNC) &chmatch_R, -1},
{"Cchmatchdup", (DL_FUNC) &chmatchdup_R, -1},
{"Cchin", (DL_FUNC) &chin_R, -1},
{"CfreadR", (DL_FUNC) &freadR, -1},
{"CfwriteR", (DL_FUNC) &fwriteR, -1},
{"Creorder", (DL_FUNC) &reorder, -1},
{"Crbindlist", (DL_FUNC) &rbindlist, -1},
{"Cvecseq", (DL_FUNC) &vecseq, -1},
{"Csetlistelt", (DL_FUNC) &setlistelt, -1},
{"CsetS4elt", (DL_FUNC) &setS4elt, -1},
{"Caddress", (DL_FUNC) &address, -1},
{"CexpandAltRep", (DL_FUNC) &expandAltRep, -1},
{"Cfmelt", (DL_FUNC) &fmelt, -1},
{"Cfcast", (DL_FUNC) &fcast, -1},
{"Cuniqlist", (DL_FUNC) &uniqlist, -1},
{"Cuniqlengths", (DL_FUNC) &uniqlengths, -1},
{"CforderReuseSorting", (DL_FUNC) &forderReuseSorting, -1},
{"Cforder", (DL_FUNC) &forder, -1},
{"Cissorted", (DL_FUNC) &issorted, -1},
{"Cgforce", (DL_FUNC) &gforce, -1},
{"Cgsum", (DL_FUNC) &gsum, -1},
{"Cgmean", (DL_FUNC) &gmean, -1},
{"Cgmin", (DL_FUNC) &gmin, -1},
{"Cgmax", (DL_FUNC) &gmax, -1},
{"CisOrderedSubset", (DL_FUNC) &isOrderedSubset, -1},
{"CsetNumericRounding", (DL_FUNC) &setNumericRounding, -1},
{"CgetNumericRounding", (DL_FUNC) &getNumericRounding, -1},
{"Cbinary", (DL_FUNC) &binary, -1},
{"CsubsetDT", (DL_FUNC) &subsetDT, -1},
{"CsubsetVector", (DL_FUNC) &subsetVector, -1},
{"CconvertNegAndZeroIdx", (DL_FUNC) &convertNegAndZeroIdx, -1},
{"Cfrank", (DL_FUNC) &frank, -1},
{"Cdt_na", (DL_FUNC) &dt_na, -1},
{"Clookup", (DL_FUNC) &lookup, -1},
{"Coverlaps", (DL_FUNC) &overlaps, -1},
{"Cwhichwrapper", (DL_FUNC) &whichwrapper, -1},
{"Cshift", (DL_FUNC) &shift, -1},
{"Ctranspose", (DL_FUNC) &transpose, -1},
{"CanyNA", (DL_FUNC) &anyNA, -1},
{"CfitsInInt32R", (DL_FUNC) &fitsInInt32R, -1},
{"CfitsInInt64R", (DL_FUNC) &fitsInInt64R, -1},
{"Csetlevels", (DL_FUNC) &setlevels, -1},
{"Crleid", (DL_FUNC) &rleid, -1},
{"Cgmedian", (DL_FUNC) &gmedian, -1},
{"Cgtail", (DL_FUNC) &gtail, -1},
{"Cghead", (DL_FUNC) &ghead, -1},
{"Cglast", (DL_FUNC) &glast, -1},
{"Cgfirst", (DL_FUNC) &gfirst, -1},
{"Cgnthvalue", (DL_FUNC) &gnthvalue, -1},
{"Cdim", (DL_FUNC) &dim, -1},
{"Cgvar", (DL_FUNC) &gvar, -1},
{"Cgsd", (DL_FUNC) &gsd, -1},
{"Cgprod", (DL_FUNC) &gprod, -1},
{"Cgshift", (DL_FUNC) &gshift, -1},
{"Cnestedid", (DL_FUNC) &nestedid, -1},
{"CsetDTthreads", (DL_FUNC) &setDTthreads, -1},
{"CgetDTthreads", (DL_FUNC) &getDTthreads_R, -1},
{"CgetDTthreadsC", (DL_FUNC) &getDTthreads_C, -1},
{"CnqRecreateIndices", (DL_FUNC) &nqRecreateIndices, -1},
{"Cfsort", (DL_FUNC) &fsort, -1},
{"Cinrange", (DL_FUNC) &inrange, -1},
{"Cbetween", (DL_FUNC) &between, -1},
{"ChasOpenMP", (DL_FUNC) &hasOpenMP, -1},
{"CuniqueNlogical", (DL_FUNC) &uniqueNlogical, -1},
{"CfrollfunR", (DL_FUNC) &frollfunR, -1},
{"CdllVersion", (DL_FUNC) &dllVersion, -1},
{"CnafillR", (DL_FUNC) &nafillR, -1},
{"CcolnamesInt", (DL_FUNC) &colnamesInt, -1},
{"CinitLastUpdated", (DL_FUNC) &initLastUpdated, -1},
{"Ccj", (DL_FUNC) &cj, -1},
{"Ccoalesce", (DL_FUNC) &coalesce, -1},
{"CfifelseR", (DL_FUNC) &fifelseR, -1},
{"CfcaseR", (DL_FUNC) &fcaseR, -1},
{"C_lock", (DL_FUNC) &lock, -1}, // _ for these 3 to avoid Clock as in time
{"C_unlock", (DL_FUNC) &unlock, -1},
{"C_islocked", (DL_FUNC) &islockedR, -1},
{"CtestMsgR", (DL_FUNC) &testMsgR, -1},
{"C_allNAR", (DL_FUNC) &allNAR, -1},
{"CcoerceAs", (DL_FUNC) &coerceAs, -1},
{"Ctest_dt_win_snprintf", (DL_FUNC)&test_dt_win_snprintf, -1},
{"Cdt_zlib_version", (DL_FUNC)&dt_zlib_version, -1},
{"Cdt_has_zlib", (DL_FUNC)&dt_has_zlib, -1},
{"Csubstitute_call_arg_namesR", (DL_FUNC) &substitute_call_arg_namesR, -1},
{"CstartsWithAny", (DL_FUNC)&startsWithAny, -1},
{"CconvertDate", (DL_FUNC)&convertDate, -1},
{"Cnotchin", (DL_FUNC)&notchin, -1},
{"Ccbindlist", (DL_FUNC) &cbindlist, -1},
{"CperhapsDataTableR", (DL_FUNC) &perhapsDataTableR, -1},
{"CcopyCols", (DL_FUNC) &copyCols, -1},
{"Cwarn_matrix_column_r", (DL_FUNC)&warn_matrix_column_r, -1},
{"Cfrev", (DL_FUNC) &frev, -1},
{"CmemcpyVector", (DL_FUNC)&memcpyVector, -1},
{"CmemcpyDT", (DL_FUNC)&memcpyDT, -1},
{"CmemcpyVectoradaptive", (DL_FUNC)&memcpyVectoradaptive, -1},
{"CmemcpyDTadaptive", (DL_FUNC)&memcpyDTadaptive, -1},
{"Csetgrowable", (DL_FUNC)&setgrowable, -1},
{"Cfrolladapt", (DL_FUNC)&frolladapt, -1},
{NULL, NULL, 0}
static const R_CallMethodDef callMethods[] = {
{ "Csetattrib", (DL_FUNC)&setattrib, -1 },
{ "Cbmerge", (DL_FUNC)&bmerge, -1 },
{ "Cassign", (DL_FUNC)&assign, -1 },
{ "Cdogroups", (DL_FUNC)&dogroups, -1 },
{ "Ccopy", (DL_FUNC)&copy, -1 },
{ "Cshallowwrapper", (DL_FUNC)&shallowwrapper, -1 },
{ "Csetdt_nrows", (DL_FUNC)&setdt_nrows, -1 },
{ "Calloccolwrapper", (DL_FUNC)&alloccolwrapper, -1 },
{ "Cselfrefokwrapper", (DL_FUNC)&selfrefokwrapper, -1 },
{ "Ctruelength", (DL_FUNC)&truelength, -1 },
{ "Csetcharvec", (DL_FUNC)&setcharvec, -1 },
{ "Csetcolorder", (DL_FUNC)&setcolorder, -1 },
{ "Cchmatch", (DL_FUNC)&chmatch_R, -1 },
{ "Cchmatchdup", (DL_FUNC)&chmatchdup_R, -1 },
{ "Cchin", (DL_FUNC)&chin_R, -1 },
{ "CfreadR", (DL_FUNC)&freadR, -1 },
{ "CfwriteR", (DL_FUNC)&fwriteR, -1 },
{ "Creorder", (DL_FUNC)&reorder, -1 },
{ "Crbindlist", (DL_FUNC)&rbindlist, -1 },
{ "Cvecseq", (DL_FUNC)&vecseq, -1 },
{ "Csetlistelt", (DL_FUNC)&setlistelt, -1 },
{ "CsetS4elt", (DL_FUNC)&setS4elt, -1 },
{ "Caddress", (DL_FUNC)&address, -1 },
{ "CexpandAltRep", (DL_FUNC)&expandAltRep, -1 },
{ "Cfmelt", (DL_FUNC)&fmelt, -1 },
{ "Cfcast", (DL_FUNC)&fcast, -1 },
{ "Cuniqlist", (DL_FUNC)&uniqlist, -1 },
{ "Cuniqlengths", (DL_FUNC)&uniqlengths, -1 },
{ "CforderReuseSorting", (DL_FUNC)&forderReuseSorting, -1 },
{ "Cforder", (DL_FUNC)&forder, -1 },
{ "Cissorted", (DL_FUNC)&issorted, -1 },
{ "Cgforce", (DL_FUNC)&gforce, -1 },
{ "Cgsum", (DL_FUNC)&gsum, -1 },
{ "Cgmean", (DL_FUNC)&gmean, -1 },
{ "Cgmin", (DL_FUNC)&gmin, -1 },
{ "Cgmax", (DL_FUNC)&gmax, -1 },
{ "CisOrderedSubset", (DL_FUNC)&isOrderedSubset, -1 },
{ "CsetNumericRounding", (DL_FUNC)&setNumericRounding, -1 },
{ "CgetNumericRounding", (DL_FUNC)&getNumericRounding, -1 },
{ "Cbinary", (DL_FUNC)&binary, -1 },
{ "CsubsetDT", (DL_FUNC)&subsetDT, -1 },
{ "CsubsetVector", (DL_FUNC)&subsetVector, -1 },
{ "CconvertNegAndZeroIdx", (DL_FUNC)&convertNegAndZeroIdx, -1 },
{ "Cfrank", (DL_FUNC)&frank, -1 },
{ "Cdt_na", (DL_FUNC)&dt_na, -1 },
{ "Clookup", (DL_FUNC)&lookup, -1 },
{ "Coverlaps", (DL_FUNC)&overlaps, -1 },
{ "Cwhichwrapper", (DL_FUNC)&whichwrapper, -1 },
{ "Cshift", (DL_FUNC)&shift, -1 },
{ "Ctranspose", (DL_FUNC)&transpose, -1 },
{ "CanyNA", (DL_FUNC)&anyNA, -1 },
{ "CfitsInInt32R", (DL_FUNC)&fitsInInt32R, -1 },
{ "CfitsInInt64R", (DL_FUNC)&fitsInInt64R, -1 },
{ "Csetlevels", (DL_FUNC)&setlevels, -1 },
{ "Crleid", (DL_FUNC)&rleid, -1 },
{ "Cgmedian", (DL_FUNC)&gmedian, -1 },
{ "Cgtail", (DL_FUNC)&gtail, -1 },
{ "Cghead", (DL_FUNC)&ghead, -1 },
{ "Cglast", (DL_FUNC)&glast, -1 },
{ "Cgfirst", (DL_FUNC)&gfirst, -1 },
{ "Cgnthvalue", (DL_FUNC)&gnthvalue, -1 },
{ "Cdim", (DL_FUNC)&dim, -1 },
{ "Cgvar", (DL_FUNC)&gvar, -1 },
{ "Cgsd", (DL_FUNC)&gsd, -1 },
{ "Cgprod", (DL_FUNC)&gprod, -1 },
{ "Cgshift", (DL_FUNC)&gshift, -1 },
{ "Cnestedid", (DL_FUNC)&nestedid, -1 },
{ "CsetDTthreads", (DL_FUNC)&setDTthreads, -1 },
{ "CgetDTthreads", (DL_FUNC)&getDTthreads_R, -1 },
{ "CgetDTthreadsC", (DL_FUNC)&getDTthreads_C, -1 },
{ "CnqRecreateIndices", (DL_FUNC)&nqRecreateIndices, -1 },
{ "Cfsort", (DL_FUNC)&fsort, -1 },
{ "Cinrange", (DL_FUNC)&inrange, -1 },
{ "Cbetween", (DL_FUNC)&between, -1 },
{ "ChasOpenMP", (DL_FUNC)&hasOpenMP, -1 },
{ "CuniqueNlogical", (DL_FUNC)&uniqueNlogical, -1 },
{ "CfrollfunR", (DL_FUNC)&frollfunR, -1 },
{ "CdllVersion", (DL_FUNC)&dllVersion, -1 },
{ "CnafillR", (DL_FUNC)&nafillR, -1 },
{ "CcolnamesInt", (DL_FUNC)&colnamesInt, -1 },
{ "CinitLastUpdated", (DL_FUNC)&initLastUpdated, -1 },
{ "Ccj", (DL_FUNC)&cj, -1 },
{ "Ccoalesce", (DL_FUNC)&coalesce, -1 },
{ "CfifelseR", (DL_FUNC)&fifelseR, -1 },
{ "CfcaseR", (DL_FUNC)&fcaseR, -1 },
{ "C_lock", (DL_FUNC)&lock, -1 }, // _ for these 3 to avoid Clock as in time
{ "C_unlock", (DL_FUNC)&unlock, -1 },
{ "C_islocked", (DL_FUNC)&islockedR, -1 },
{ "CtestMsgR", (DL_FUNC)&testMsgR, -1 },
{ "C_allNAR", (DL_FUNC)&allNAR, -1 },
{ "CcoerceAs", (DL_FUNC)&coerceAs, -1 },
{ "Ctest_dt_win_snprintf", (DL_FUNC)&test_dt_win_snprintf, -1 },
{ "Cdt_zlib_version", (DL_FUNC)&dt_zlib_version, -1 },
{ "Cdt_has_zlib", (DL_FUNC)&dt_has_zlib, -1 },
{ "Csubstitute_call_arg_namesR", (DL_FUNC)&substitute_call_arg_namesR, -1 },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice now, but if ever a new routine is added that is longer than Csubstitute_call_arg_namesR, it will induce a very large diff touching all of these lines.

So to complete this PR I would:

  • put static const ** on the first line
  • indent the array contents by 2 spaces

And remove extra whitespace.

There are a few packages doing { "..." instead of {"...", but it's the minority. Personally I prefer {"...".

{ "CstartsWithAny", (DL_FUNC)&startsWithAny, -1 },
{ "CconvertDate", (DL_FUNC)&convertDate, -1 },
{ "Cnotchin", (DL_FUNC)&notchin, -1 },
{ "Ccbindlist", (DL_FUNC)&cbindlist, -1 },
{ "CperhapsDataTableR", (DL_FUNC)&perhapsDataTableR, -1 },
{ "CcopyCols", (DL_FUNC)&copyCols, -1 },
{ "Cwarn_matrix_column_r", (DL_FUNC)&warn_matrix_column_r, -1 },
{ "Cfrev", (DL_FUNC)&frev, -1 },
{ "CmemcpyVector", (DL_FUNC)&memcpyVector, -1 },
{ "CmemcpyDT", (DL_FUNC)&memcpyDT, -1 },
{ "CmemcpyVectoradaptive", (DL_FUNC)&memcpyVectoradaptive, -1 },
{ "CmemcpyDTadaptive", (DL_FUNC)&memcpyDTadaptive, -1 },
{ "Csetgrowable", (DL_FUNC)&setgrowable, -1 },
{ "Cfrolladapt", (DL_FUNC)&frolladapt, -1 },
{ NULL, NULL, 0 }
};

static const
R_ExternalMethodDef externalMethods[] = {
{"Cfastmean", (DL_FUNC) &fastmean, -1},
{NULL, NULL, 0}
static const R_ExternalMethodDef externalMethods[] = {
{ "Cfastmean", (DL_FUNC)&fastmean, -1 },
{ NULL, NULL, 0 }
};

static void setSizes(void) {
Expand Down
Loading