Changeset 116 for trunk/ORBit2-2.14.0/src
- Timestamp:
- Nov 26, 2006, 5:59:52 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-stubs.c
r115 r116 7 7 IDL_tree realif; 8 8 char* chrOverridenMethodName; 9 } InheritedOutputInfo; 9 char* chrClassName; 10 } InheritedOutputInfo2; 10 11 11 12 static void 12 VoyagerOutputOverridenMethodTemplate(IDL_tree curif, InheritedOutputInfo *ioi)13 VoyagerOutputOverridenMethodTemplate(IDL_tree curif, InheritedOutputInfo2 *ioi) 13 14 { 14 15 char *id, *realid; … … 60 61 61 62 static 62 void VoyagerWriteParamsForParentCall(IDL_tree curif, InheritedOutputInfo *ioi)63 void VoyagerWriteParamsForParentCall(IDL_tree curif, InheritedOutputInfo2 *ioi) 63 64 { 64 65 IDL_tree curitem; … … 100 101 gboolean for_epv) 101 102 { 102 IDL_tree sub;103 103 char *id; 104 104 char * id2; … … 124 124 fprintf (of, "nomSelf, "); 125 125 126 127 126 tmptree = IDL_get_parent_node(op, IDLN_INTERFACE, NULL); 128 127 129 128 if(IDL_INTERFACE(tmptree).inheritance_spec) { 130 InheritedOutputInfo ioi;129 InheritedOutputInfo2 ioi; 131 130 132 131 ioi.of = of; 133 132 ioi.realif = tmptree; 134 133 ioi.chrOverridenMethodName=id2; 134 ioi.chrOverridenMethodName=""; 135 135 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerWriteParamsForParentCall, &ioi); 136 136 } 137 137 138 #if 0139 for (sub = IDL_OP_DCL (op).parameter_dcls; sub; sub = IDL_LIST (sub).next) {140 IDL_tree parm = IDL_LIST (sub).data;141 142 //orbit_cbe_write_param_typespec (of, parm);143 fprintf (of, " %s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);144 }145 #endif146 138 g_free(id2); 147 139 g_free (id); 148 140 fprintf (of, " ev);\n"); 149 141 } 142 143 static 144 void VoyagerDoWriteParamsForOverridenMethod(IDL_tree curif, InheritedOutputInfo2 *ioi) 145 { 146 IDL_tree curitem; 147 char* overridenMethodName; 148 149 if(curif == ioi->realif) 150 return; 151 152 overridenMethodName=ioi->chrOverridenMethodName; 153 154 for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) { 155 IDL_tree curop = IDL_LIST(curitem).data; 156 157 switch(IDL_NODE_TYPE(curop)) { 158 case IDLN_OP_DCL: 159 { 160 /* Check if the current method (introduced by some parent) is the one to be 161 overriden. */ 162 if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){ 163 IDL_tree sub; 164 165 g_assert (IDL_NODE_TYPE(curop) == IDLN_OP_DCL); 166 167 /* return typespec */ 168 orbit_cbe_write_param_typespec (ioi->of, curop); 169 170 /* The methodname */ 171 fprintf (ioi->of, " %s%s_%s", "NOMLINK impl_", 172 ioi->chrClassName, overridenMethodName); 173 174 fprintf (ioi->of, "(%s* nomSelf, ", ioi->chrClassName); 175 176 /* Write the params including the typespec */ 177 for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) { 178 IDL_tree parm = IDL_LIST (sub).data; 179 180 orbit_cbe_write_param_typespec (ioi->of, parm); 181 182 fprintf (ioi->of, " %s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str); 183 } 184 185 if (IDL_OP_DCL (curop).context_expr) 186 fprintf (ioi->of, "CORBA_Context _ctx, "); 187 188 fprintf (ioi->of, "CORBA_Environment *ev)"); 189 } 190 break; 191 } 192 default: 193 break; 194 } 195 } 196 } 197 198 void VoyagerWriteParamsForOverridenMethod(FILE *of, 199 IDL_tree op, 200 const char *nom_prefix, 201 gboolean for_epv) 202 { 203 char *id; 204 char * id2; 205 char * ptr; 206 IDL_tree tmptree; 207 208 g_assert (IDL_NODE_TYPE(op) == IDLN_OP_DCL); 209 210 id = IDL_ns_ident_to_qstring ( 211 IDL_IDENT_TO_NS (IDL_INTERFACE ( 212 IDL_get_parent_node (op, IDLN_INTERFACE, NULL)).ident), "_", 0); 213 214 id2=g_strdup(IDL_IDENT (IDL_OP_DCL (op).ident).str); 215 if((ptr=strstr(id2, NOM_OVERRIDE_STRING))!=NULL) 216 *ptr='\0'; 217 218 tmptree = IDL_get_parent_node(op, IDLN_INTERFACE, NULL); 219 220 if(IDL_INTERFACE(tmptree).inheritance_spec) { 221 InheritedOutputInfo2 ioi; 222 223 ioi.of = of; 224 ioi.realif = tmptree; 225 ioi.chrOverridenMethodName=id2; 226 ioi.chrClassName=id; /* The current class name. In the called function the parent is searched introducing the method. 227 When this parent is found, the current class info isn't easy to get again but it's needed. */ 228 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerDoWriteParamsForOverridenMethod, &ioi); 229 } 230 g_free(id2); 231 g_free (id); 232 } 233 150 234 151 235 static void … … 225 309 fprintf (of, "}\n"); 226 310 #else 227 /* This is Voyager stuff...*/311 /*** This is Voyager stuff... ***/ 228 312 if(strstr(opname, NOM_INSTANCEVAR_STRING)==NULL && 229 313 strstr(opname, NOM_OVERRIDE_STRING)==NULL) … … 249 333 if(strstr(opname, NOM_OVERRIDE_STRING)!=NULL) 250 334 { 251 IDL_tree tmptree;252 253 335 /* There's an overriden method here */ 336 fprintf (of, "\n/* %s, %s line %d */\n", __FILE__, __FUNCTION__, __LINE__); 254 337 fprintf (of, "NOM_Scope "); 255 338 256 orbit_cbe_op_write_proto (of, tree, "NOMLINK impl_", FALSE);339 VoyagerWriteParamsForOverridenMethod (of, tree, "", FALSE); 257 340 258 341 fprintf (of, "\n{\n");
Note:
See TracChangeset
for help on using the changeset viewer.
