@@ -89,7 +89,6 @@ static String *getRClassName(String *retType, int deRef=0, int upRef=0) {
89
89
static String * getRClassNameCopyStruct (String *retType, int addRef) {
90
90
String *tmp = NewString (" " );
91
91
92
- #if 1
93
92
List *l = SwigType_split (retType);
94
93
int n = Len (l);
95
94
if (!l || n == 0 ) {
@@ -115,24 +114,6 @@ static String * getRClassNameCopyStruct(String *retType, int addRef) {
115
114
}
116
115
}
117
116
118
- #else
119
- char *retName = Char(SwigType_manglestr(retType));
120
- if(!retName)
121
- return(tmp);
122
-
123
- if(addRef) {
124
- while(retName && strlen(retName) > 1 &&
125
- strncmp(retName, "_p", 2) == 0) {
126
- retName += 2;
127
- Printf(tmp, "Ref");
128
- }
129
- }
130
-
131
- if(retName[0] == '_')
132
- retName ++;
133
- Insert(tmp, 0, retName);
134
- #endif
135
-
136
117
return tmp;
137
118
}
138
119
@@ -273,17 +254,7 @@ class R : public Language {
273
254
int generateCopyRoutines (Node *n);
274
255
int DumpCode (Node *n);
275
256
276
- int OutputMemberReferenceMethod (String *className, int isSet,
277
- List *memberList, List *nameList,
278
- List *typeList, File *out);
279
- #if 0
280
- // not used
281
- int OutputArrayMethod(String *className, List *el, File *out);
282
- int OutputClassMemberTable(Hash *tb, File *out);
283
- int OutputClassMethodsTable(File *out);
284
- int OutputClassAccessInfo(Hash *tb, File *out);
285
- #endif
286
-
257
+ int OutputMemberReferenceMethod (String *className, int isSet, List *memberList, List *nameList, List *typeList, File *out);
287
258
int defineArrayAccessors (SwigType *type);
288
259
289
260
void addNamespaceFunction (String *name) {
@@ -369,8 +340,6 @@ class R : public Language {
369
340
String *R_MEMBER_GET;
370
341
371
342
int processing_class_member_function;
372
- // List *class_member_functions;
373
- // List *class_member_set_functions;
374
343
// Spread out the lists so that they are simpler to process
375
344
// by storing the type of the method (i.e. set, get or nothing)
376
345
// and having separate lists for name, membername and wrapper
@@ -731,18 +700,6 @@ void R::init() {
731
700
}
732
701
733
702
734
-
735
- #if 0
736
- int R::cDeclaration(Node *n) {
737
- SwigType *t = Getattr(n, "type");
738
- SwigType *name = Getattr(n, "name");
739
- if (debugMode)
740
- Printf(stdout, "cDeclaration (%s): %s\n", name, SwigType_lstr(t, 0));
741
- return Language::cDeclaration(n);
742
- }
743
- #endif
744
-
745
-
746
703
/* -------------------------------------------------------------
747
704
* Method from Language that is called to start the entire
748
705
* processing off, i.e. the generation of the code.
@@ -1152,49 +1109,6 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
1152
1109
return SWIG_OK;
1153
1110
}
1154
1111
1155
- #if 0
1156
- // not used
1157
- /* -------------------------------------------------------------
1158
- * Write the methods for [ or [<- for accessing a member field in an
1159
- * struct or union (or class).
1160
- * className - the name of the struct or union (e.g. Bar for struct Bar)
1161
- * el - a list of length 2 * # accessible member elements + 1.
1162
- * The first element is the name of the class.
1163
- * The other pairs are member name and the name of the R function to access it.
1164
- * out - the stream where we write the code.
1165
- * --------------------------------------------------------------*/
1166
-
1167
- int R::OutputArrayMethod(String *className, List *el, File *out) {
1168
- int numMems = Len(el), j;
1169
-
1170
- if(!el || numMems == 0)
1171
- return(0);
1172
-
1173
- Printf(out, "# start of array methods for %s\n", className);
1174
- for(j = 0; j < numMems; j+=3) {
1175
- String *item = Getitem(el, j);
1176
- String *dup = Getitem(el, j + 1);
1177
- if (!Strcmp(item, "__getitem__")) {
1178
- Printf(out,
1179
- "setMethod('[', '_p%s', function(x, i, j, ..., drop =TRUE) ",
1180
- getRClassName(className));
1181
- Printf(out, " sapply(i, function (n) %s(x, as.integer(n-1))))\n\n", dup);
1182
- }
1183
- if (!Strcmp(item, "__setitem__")) {
1184
- Printf(out, "setMethod('[<-', '_p%s', function(x, i, j, ..., value)",
1185
- getRClassName(className));
1186
- Printf(out, " sapply(1:length(i), function(n) %s(x, as.integer(i[n]-1), value[n])))\n\n", dup);
1187
- }
1188
-
1189
- }
1190
-
1191
- Printf(out, "# end of array methods for %s\n", className);
1192
-
1193
- return SWIG_OK;
1194
- }
1195
-
1196
- #endif
1197
-
1198
1112
/* -------------------------------------------------------------
1199
1113
* Called when a enumeration is to be processed.
1200
1114
* We want to call the R function defineEnumeration().
@@ -2118,18 +2032,7 @@ int R::functionWrapper(Node *n) {
2118
2032
Replaceall (tm," $owner" , " 0" );
2119
2033
}
2120
2034
2121
- #if 0
2122
- if(addCopyParam) {
2123
- Printf(f->code, "if(LOGICAL(s_swig_copy)[0]) {\n");
2124
- Printf(f->code, "/* Deal with returning a reference. */\nr_ans = R_NilValue;\n");
2125
- Printf(f->code, "}\n else {\n");
2126
- }
2127
- #endif
2128
2035
Printf (f->code , " %s\n " , tm);
2129
- #if 0
2130
- if(addCopyParam)
2131
- Printf(f->code, "}\n"); /* end of if(s_swig_copy) ... else { ... } */
2132
- #endif
2133
2036
2134
2037
} else {
2135
2038
Swig_warning (WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
@@ -2467,14 +2370,6 @@ int R::classDeclaration(Node *n) {
2467
2370
opaqueClassDeclaration = NULL ;
2468
2371
2469
2372
2470
- // OutputArrayMethod(name, class_member_functions, sfile);
2471
- #if 0
2472
- // RJB - this bit will need to change
2473
- if (class_member_functions)
2474
- OutputMemberReferenceMethod(name, 0, class_member_functions, sfile);
2475
- if (class_member_set_functions)
2476
- OutputMemberReferenceMethod(name, 1, class_member_set_functions, sfile);
2477
- #else
2478
2373
if (class_member_function_types) {
2479
2374
2480
2375
// collect the "set" methods
@@ -2507,7 +2402,6 @@ int R::classDeclaration(Node *n) {
2507
2402
Delete (class_other_functionnames);
2508
2403
Delete (class_other_functiontypes);
2509
2404
}
2510
- #endif
2511
2405
2512
2406
if (class_member_function_types) {
2513
2407
Delete (class_member_function_types);
@@ -2544,9 +2438,6 @@ int R::classDeclaration(Node *n) {
2544
2438
c = nextSibling (c);
2545
2439
continue ;
2546
2440
}
2547
- #if 0
2548
- tp = getRType(c);
2549
- #else
2550
2441
tp = Swig_typemap_lookup (" rtype" , c, " " , 0 );
2551
2442
if (!tp) {
2552
2443
c = nextSibling (c);
@@ -2573,7 +2464,7 @@ int R::classDeclaration(Node *n) {
2573
2464
// returns "" tp = processType(elType, c, NULL);
2574
2465
// Printf(stdout, "<classDeclaration> elType %p\n", elType);
2575
2466
// tp = getRClassNameCopyStruct(Getattr(c, "type"), 1);
2576
- # endif
2467
+
2577
2468
String *elNameT = replaceInitialDash (elName);
2578
2469
Printf (def, " %s%s = \" %s\" " , tab8, elNameT, tp);
2579
2470
firstItem = false ;
@@ -2934,10 +2825,6 @@ String * R::processType(SwigType *t, Node *n, int *nargs) {
2934
2825
return tmp;
2935
2826
}
2936
2827
2937
- #if 0
2938
- SwigType_isfunction(t) && SwigType_ispointer(t)
2939
- #endif
2940
-
2941
2828
return NULL ;
2942
2829
}
2943
2830
0 commit comments