- allowing R package names with containing dosts ('.')

- allowing mulitple get accessors in R
This commit is contained in:
Frank Schlimbach 2017-01-12 06:50:25 -06:00
commit 61c24e9cd1

View file

@ -1045,10 +1045,6 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
bool has_prev = false;
for(j = 0; j < numMems; j+=3) {
String *item = Getitem(el, j);
if (Getattr(itemList, item))
continue;
Setattr(itemList, item, "1");
String *dup = Getitem(el, j + 1);
char *ptr = Char(dup);
ptr = &ptr[Len(dup) - 3];
@ -1056,6 +1052,10 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
if (!strcmp(ptr, "get"))
varaccessor++;
if (Getattr(itemList, item))
continue;
Setattr(itemList, item, "1");
String *pitem;
if (!Strcmp(item, "operator ()")) {
pitem = NewString("call");
@ -2270,7 +2270,13 @@ int R::outputRegistrationRoutines(File *out) {
if(!noInitializationCode) {
if (inCPlusMode)
Printv(out, "extern \"C\" ", NIL);
Printf(out, "SWIGEXPORT void R_init_%s(DllInfo *dll) {\n", Rpackage);
{ /* R allows pckage names to have '.' in the name, which is not allowed in C++ var names
we simply replace all occurrences of '.' with '_' to construct the var name */
String * Rpackage_sane = Copy(Rpackage);
Replace(Rpackage_sane, ".", "_", DOH_REPLACE_ANY);
Printf(out, "SWIGEXPORT void R_init_%s(DllInfo *dll) {\n", Rpackage_sane);
Delete(Rpackage_sane);
}
Printf(out, "%sR_registerRoutines(dll, NULL, CallEntries, NULL, NULL);\n", tab4);
if(Len(s_init_routine)) {
Printf(out, "\n%s\n", s_init_routine);