smart-pointer classes deriving from parent smart-pointers
white-space cleanup
This commit is contained in:
parent
e6a1a7dbd1
commit
1df744e0c3
1 changed files with 397 additions and 394 deletions
|
|
@ -58,11 +58,11 @@ static String * getRTypeName(SwigType *t, int *outCount = NULL) {
|
|||
return tmp;
|
||||
|
||||
/*
|
||||
if(count)
|
||||
if(count)
|
||||
return(b);
|
||||
|
||||
Delete(b);
|
||||
return(NewString(""));
|
||||
Delete(b);
|
||||
return(NewString(""));
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ static String *getRClassName(String *retType, int /*addRef*/ = 1, int upRef=0) {
|
|||
#ifdef R_SWIG_VERBOSE
|
||||
if (debugMode)
|
||||
Printf(stdout, "SwigType_split return an empty list for %s\n",
|
||||
retType);
|
||||
retType);
|
||||
#endif
|
||||
return(tmp);
|
||||
}
|
||||
|
|
@ -107,8 +107,8 @@ static String *getRClassName(String *retType, int /*addRef*/ = 1, int upRef=0) {
|
|||
if(addRef) {
|
||||
for(int i = 0; i < n; i++) {
|
||||
if(Strcmp(Getitem(l, i), "p.") == 0 ||
|
||||
Strncmp(Getitem(l, i), "a(", 2) == 0)
|
||||
Printf(tmp, "Ref");
|
||||
Strncmp(Getitem(l, i), "a(", 2) == 0)
|
||||
Printf(tmp, "Ref");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -212,14 +212,14 @@ R Options (available with -r)\n\
|
|||
-cppcast - Enable C++ casting operators (default) \n\
|
||||
-debug - Output debug\n\
|
||||
-dll <name> - Name of the DLL (without the .dll or .so suffix).\n\
|
||||
Default is the module name.\n\
|
||||
Default is the module name.\n\
|
||||
-gc - Aggressive garbage collection\n\
|
||||
-memoryprof - Add memory profile\n\
|
||||
-namespace - Output NAMESPACE file\n\
|
||||
-no-init-code - Turn off the generation of the R_init_<pkgname> code\n\
|
||||
(registration information still generated)\n\
|
||||
(registration information still generated)\n\
|
||||
-package <name> - Package name for the PACKAGE argument of the R .Call()\n\
|
||||
invocations. Default is the module name.\n\
|
||||
invocations. Default is the module name.\n\
|
||||
";
|
||||
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ public:
|
|||
|
||||
int typedefHandler(Node *n);
|
||||
static List *Swig_overload_rank(Node *n,
|
||||
bool script_lang_wrapping);
|
||||
bool script_lang_wrapping);
|
||||
|
||||
int memberfunctionHandler(Node *n) {
|
||||
if (debugMode)
|
||||
|
|
@ -534,7 +534,7 @@ void R::addSMethodInfo(String *name, String *argType, int nargs) {
|
|||
}
|
||||
|
||||
/*
|
||||
Returns the name of the new routine.
|
||||
Returns the name of the new routine.
|
||||
*/
|
||||
String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
|
||||
String *funName = SwigType_manglestr(t);
|
||||
|
|
@ -590,7 +590,7 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
|
|||
|
||||
emit_parameter_variables(parms, f);
|
||||
emit_return_variable(n, rettype, f);
|
||||
// emit_attach_parmmaps(parms,f);
|
||||
// emit_attach_parmmaps(parms,f);
|
||||
|
||||
/* Using weird name and struct to avoid potential conflicts. */
|
||||
Wrapper_add_local(f, "r_swig_cb_data", "RCallbackFunctionData *r_swig_cb_data = R_SWIG_getCallbackFunctionData()");
|
||||
|
|
@ -987,6 +987,7 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
/* This function checks for names ending in _set - perhaps it should */
|
||||
/* use attributes of some other form, as it potentially clashes with */
|
||||
/* methods ending in _set */
|
||||
|
||||
if(n && outputNamespaceInfo) {
|
||||
Printf(s_namespace, "exportClasses(");
|
||||
}
|
||||
|
|
@ -1021,7 +1022,7 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
struct or union (or class).
|
||||
className - the name of the struct or union (e.g. Bar for struct Bar)
|
||||
isSet - a logical value indicating whether the method is for
|
||||
modifying ($<-) or accessing ($) the member field.
|
||||
modifying ($<-) or accessing ($) the member field.
|
||||
el - a list of length 2 * # accessible member elements + 1.
|
||||
The first element is the name of the class.
|
||||
The other pairs are member name and the name of the R function to access it.
|
||||
|
|
@ -1326,7 +1327,7 @@ struct Overloaded {
|
|||
|
||||
|
||||
List * R::Swig_overload_rank(Node *n,
|
||||
bool script_lang_wrapping) {
|
||||
bool script_lang_wrapping) {
|
||||
Overloaded nodes[MAX_OVERLOAD];
|
||||
int nnodes = 0;
|
||||
Node *o = Getattr(n,"sym:overloaded");
|
||||
|
|
@ -1444,7 +1445,7 @@ List * R::Swig_overload_rank(Node *n,
|
|||
}
|
||||
|
||||
/* Need subtype check here. If t2 is a subtype of t1, then we need to change the
|
||||
order */
|
||||
order */
|
||||
|
||||
if (SwigType_issubtype(t2,t1)) {
|
||||
Overloaded t = nodes[i];
|
||||
|
|
@ -1560,7 +1561,7 @@ List * R::Swig_overload_rank(Node *n,
|
|||
int i;
|
||||
for (i = 0; i < nnodes; i++) {
|
||||
if (nodes[i].error)
|
||||
Setattr(nodes[i].n, "overload:ignore", "1");
|
||||
Setattr(nodes[i].n, "overload:ignore", "1");
|
||||
Append(result,nodes[i].n);
|
||||
// Printf(stdout,"[ %d ] %s\n", i, ParmList_errorstr(nodes[i].parms));
|
||||
// Swig_print_node(nodes[i].n);
|
||||
|
|
@ -1649,29 +1650,29 @@ void R::dispatchFunction(Node *n) {
|
|||
if (tm) {
|
||||
if (Strcmp(tm,"numeric")==0) {
|
||||
Printf(f->code, "%sis.numeric(argv[[%d]])",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else if (Strcmp(tm,"integer")==0) {
|
||||
Printf(f->code, "%s(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1, j+1);
|
||||
j == 0 ? "" : " && ",
|
||||
j+1, j+1);
|
||||
}
|
||||
else if (Strcmp(tm,"character")==0) {
|
||||
Printf(f->code, "%sis.character(argv[[%d]])",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else {
|
||||
Printf(f->code, "%sextends(argtypes[%d], '%s')",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1,
|
||||
tm);
|
||||
j == 0 ? "" : " && ",
|
||||
j+1,
|
||||
tm);
|
||||
}
|
||||
}
|
||||
if (!SwigType_ispointer(Getattr(p, "type"))) {
|
||||
Printf(f->code, " && length(argv[[%d]]) == 1",
|
||||
j+1);
|
||||
j+1);
|
||||
}
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
}
|
||||
|
|
@ -1828,14 +1829,14 @@ int R::functionWrapper(Node *n) {
|
|||
Printv(sfun->def, "\n`", sfname, "` = function(", NIL);
|
||||
|
||||
if(outputNamespaceInfo) {//XXX Need to be a little more discriminating
|
||||
if (constructor) {
|
||||
String *niname = Copy(iname);
|
||||
Replace(niname, "new_", "", DOH_REPLACE_FIRST);
|
||||
addNamespaceFunction(niname);
|
||||
Delete(niname);
|
||||
} else {
|
||||
addNamespaceFunction(iname);
|
||||
}
|
||||
if (constructor) {
|
||||
String *niname = Copy(iname);
|
||||
Replace(niname, "new_", "", DOH_REPLACE_FIRST);
|
||||
addNamespaceFunction(niname);
|
||||
Delete(niname);
|
||||
} else {
|
||||
addNamespaceFunction(iname);
|
||||
}
|
||||
}
|
||||
|
||||
Swig_typemap_attach_parms("scoercein", l, f);
|
||||
|
|
@ -2138,13 +2139,13 @@ int R::functionWrapper(Node *n) {
|
|||
Replaceall(tm,"$source","ans");
|
||||
Replaceall(tm,"$result","ans");
|
||||
if (constructor) {
|
||||
Node * parent = Getattr(n, "parentNode");
|
||||
String * smartname = Getattr(parent, "feature:smartptr");
|
||||
if (smartname) {
|
||||
smartname = getRClassName(smartname, 1, 1);
|
||||
Replaceall(tm, "$R_class", smartname);
|
||||
Delete(smartname);
|
||||
}
|
||||
Node * parent = Getattr(n, "parentNode");
|
||||
String * smartname = Getattr(parent, "feature:smartptr");
|
||||
if (smartname) {
|
||||
smartname = getRClassName(smartname, 1, 1);
|
||||
Replaceall(tm, "$R_class", smartname);
|
||||
Delete(smartname);
|
||||
}
|
||||
}
|
||||
replaceRClass(tm, Getattr(n, "type"));
|
||||
Chop(tm);
|
||||
|
|
@ -2289,7 +2290,7 @@ int R::outputRegistrationRoutines(File *out) {
|
|||
if (inCPlusMode)
|
||||
Printv(out, "extern \"C\" ", NIL);
|
||||
{ /* 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 */
|
||||
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);
|
||||
|
|
@ -2348,13 +2349,28 @@ void R::registerClass(Node *n) {
|
|||
Delete(base);
|
||||
String *smartptr = Getattr(n, "feature:smartptr");
|
||||
if (smartptr) {
|
||||
SwigType *spt = Swig_cparse_type(smartptr);
|
||||
String *smart = SwigType_typedef_resolve_all(spt);
|
||||
String *smart_rname = SwigType_manglestr(smart);
|
||||
Printf(s_classes, "setClass('_p%s', contains = c('%s'))\n", smart_rname, sname);
|
||||
Delete(spt);
|
||||
Delete(smart);
|
||||
Delete(smart_rname);
|
||||
List *l = Getattr(n, "bases");
|
||||
SwigType *spt = Swig_cparse_type(smartptr);
|
||||
String *smart = SwigType_typedef_resolve_all(spt);
|
||||
String *smart_rname = SwigType_manglestr(smart);
|
||||
Printf(s_classes, "setClass('_p%s', contains = c('%s'", smart_rname, sname);
|
||||
Delete(spt);
|
||||
Delete(smart);
|
||||
Delete(smart_rname);
|
||||
for(int i = 0; i < Len(l); i++) {
|
||||
Node * b = Getitem(l, i);
|
||||
smartptr = Getattr(b, "feature:smartptr");
|
||||
if (smartptr) {
|
||||
spt = Swig_cparse_type(smartptr);
|
||||
smart = SwigType_typedef_resolve_all(spt);
|
||||
smart_rname = SwigType_manglestr(smart);
|
||||
Printf(s_classes, ", '_p%s'", smart_rname);
|
||||
Delete(spt);
|
||||
Delete(smart);
|
||||
Delete(smart_rname);
|
||||
}
|
||||
}
|
||||
Printf(s_classes, "))\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2826,17 +2842,4 @@ String * R::processType(SwigType *t, Node *n, int *nargs) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue