Changeset 249
- Timestamp:
- Mar 11, 2007, 12:49:25 AM (18 years ago)
- Location:
- trunk/ORBit2-2.14.0/src/idl-compiler
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-backend.h
r92 r249 77 77 gulong orbit_cbe_get_typespec_size(IDL_tree tree); 78 78 79 void orbit_cbe_voyager_write_param_typespec(FILE *of, IDL_tree tree); 79 80 #endif -
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c
r205 r249 22 22 23 23 /* Used to count the static methods of a class. This is kind of a hack. 24 I would lo ce to put it into CBESkelImplInfo but his struct is copied24 I would love to put it into CBESkelImplInfo but his struct is copied 25 25 everywhere and given as a copy to subprocedures. */ 26 26 static gulong ulNumStaticMethods[10]; … … 292 292 */ 293 293 static void 294 VoyagerWriteOverridenMethodDeclaration(FILE *of, 295 IDL_tree op, 294 VoyagerWriteOverridenMethodDeclaration(FILE *of, IDL_tree op, 296 295 const char *nom_prefix, 297 296 gboolean for_epv) … … 365 364 } 366 365 366 /* 367 This function outputs the parameter type of methods without the 'const' 368 qualifier. 369 */ 370 static void VoyagerOutputParamTypes(CBESkelImplInfo *ski) 371 { 372 if(IDLN_PARAM_DCL!=IDL_NODE_TYPE(ski->tree)) 373 return; 374 375 orbit_cbe_voyager_write_param_typespec(ski->of, ski->tree); 376 377 } 367 378 368 379 static void … … 385 396 case IDLN_INTERFACE: 386 397 cbe_ski_do_interface(ski); 387 #if 0388 if(whichPass==ski->pass)389 ulCurInterface++;390 else{391 whichPass=ski->pass;392 ulCurInterface=0;393 }394 #endif395 398 // printf("%d: pass --->%d %d %d\n", __LINE__, ski->pass, whichPass, ulCurInterface); 396 399 break; … … 818 821 /* Overriden method */ 819 822 fprintf(ski->of, "NOM_Scope "); 820 #if 0821 fprintf(ski->of, " NOMLINK impl_%s_%s(%s *nomSelf,\n",822 id2, gstr->str, id2);823 #endif824 823 op = ski->tree; 825 VoyagerWriteOverridenMethodDeclaration(ski->of, 826 op, 827 "", 828 FALSE); 824 VoyagerWriteOverridenMethodDeclaration(ski->of, op, "", FALSE); 829 825 830 826 for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls; … … 888 884 ioi.realif = tmptree; 889 885 ioi.chrOverridenMethodName=gstr->str; 890 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerOutputIntroducingClass, &ioi); 886 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, 887 (GFunc)VoyagerOutputIntroducingClass, &ioi); 891 888 } 892 889 fprintf(ski->of, ":%s\";\n",gstr->str); /* Output the method name */ … … 904 901 ioi.realif = tmptree; 905 902 ioi.chrOverridenMethodName=gstr->str; 906 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerWriteParamsForParentCall, &ioi); 903 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, 904 (GFunc)VoyagerWriteParamsForParentCall, &ioi); 907 905 } 908 906 fprintf(ski->of, "ev)"); … … 916 914 ioi.realif = tmptree; 917 915 ioi.chrOverridenMethodName=gstr->str; 918 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerOutputParentMethodSpec, &ioi); 916 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, 917 (GFunc)VoyagerOutputParentMethodSpec, &ioi); 919 918 } 920 919 fprintf(ski->of, ") \\\n %s_parent_resolved)", id); … … 929 928 ioi.realif = tmptree; 930 929 ioi.chrOverridenMethodName=gstr->str; 931 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerOutputIntroducingClass, &ioi); 930 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, 931 (GFunc)VoyagerOutputIntroducingClass, &ioi); 932 932 } 933 933 fprintf(ski->of, "*)nomSelf, "); … … 939 939 ioi.realif = tmptree; 940 940 ioi.chrOverridenMethodName=gstr->str; 941 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerWriteParamsForParentCall, &ioi); 941 IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, 942 (GFunc)VoyagerWriteParamsForParentCall, &ioi); 942 943 } 943 944 fprintf(ski->of, "ev)"); … … 952 953 id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str); 953 954 } 955 956 /* Output the parameter info */ 957 if(!bOverriden) 958 { 959 int a=0; 960 IDL_tree tmptree; 961 962 tmptree = IDL_get_parent_node(ski->tree, IDLN_INTERFACE, NULL); 963 964 fprintf(ski->of, "static nomParmInfo nomParm_%s = {\n", id); 965 966 /* Output number of parameters */ 967 for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls; 968 curitem; curitem = IDL_LIST(curitem).next) { 969 a++; /* Count parameters */ 970 } 971 fprintf(ski->of, " %d, /* Number of parameters */\n", a); 972 973 /* Output return type */ 974 fprintf(ski->of, " /* Return type (%s: %s line %d)*/\n \"", __FILE__, __FUNCTION__, __LINE__); 975 orbit_cbe_write_param_typespec(ski->of, ski->tree); 976 fprintf(ski->of, "\",\n {"); 977 978 op = ski->tree; 979 for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls; 980 curitem; curitem = IDL_LIST(curitem).next) { 981 subski.tree = IDL_LIST(curitem).data; 982 983 fprintf(ski->of, " \""); 984 if(IDLN_PARAM_DCL==IDL_NODE_TYPE(subski.tree)) 985 VoyagerOutputParamTypes(&subski); 986 fprintf(ski->of, "\",\n"); 987 } 988 fprintf(ski->of, "}};\n"); 989 } 990 954 991 if(ptr!=NULL) 955 992 *ptr='_'; … … 984 1021 id2 = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_INTERFACE(curitem).ident), "_", 0); 985 1022 986 /* Check for our spec ailly marked NOM-only methods. Don't output them, they are handled1023 /* Check for our specially marked NOM-only methods. Don't output them, they are handled 987 1024 specially. */ 988 1025 if(!strstr(id, NOM_INSTANCEVAR_STRING) && … … 994 1031 fprintf(ski->of, " &nomFullIdString_%s_%s, /* char *chrMethodDescriptor */\n", 995 1032 id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str); 996 fprintf(ski->of, " (nomMethodProc*) impl_%s_%s\n", id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str); 1033 fprintf(ski->of, " (nomMethodProc*) impl_%s_%s,\n", id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str); 1034 fprintf(ski->of, " &nomParm_%s_%s\n", id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str); 997 1035 fprintf(ski->of, "},\n"); 998 1036 … … 1084 1122 1085 1123 1086 /* Check for our spec ailly marked NOM-only methods. Don't output them, they are handled1124 /* Check for our specially marked NOM-only methods. Don't output them, they are handled 1087 1125 specially. */ 1088 1126 if(!strstr(IDL_IDENT(ident).str, NOM_INSTANCEVAR_STRING) && … … 1234 1272 } 1235 1273 1274 /* 1275 CW: When doing a pass we first end here for each interface. By calling 1276 cbe_ski_do_list() all nodes are traversed and the subfunctions are called 1277 accordingly. 1278 1279 */ 1236 1280 static void 1237 1281 cbe_ski_do_interface(CBESkelImplInfo *ski) … … 1262 1306 IDL_tree_traverse_parents(ski->tree, (GFunc)&cbe_ski_do_inherited_methods, ski); 1263 1307 1264 1265 1308 break; 1266 1309 } -
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-utils.c
r92 r249 407 407 } 408 408 409 /* 410 This is almost the same like orbit_cbe_write_param_typespec_str(). We only omit the 411 'const' qualifier because we only need the parameter type. 412 */ 413 static char * 414 orbit_cbe_voyager_write_param_typespec_str(IDL_tree ts, IDL_ParamRole role) 415 { 416 int i, n; 417 gboolean isSlice; 418 char *name; 419 GString *str = g_string_sized_new (23); 420 IDL_tree typedef_spec; 421 char *typedef_name; 422 423 n = oidl_param_info (ts, role, &isSlice); 424 name = orbit_cbe_get_typespec_str (ts); 425 426 if ( role == DATA_IN ) { 427 /* We want to check if this is a typedef for CORBA_string so we can do special handling 428 * in that case. 429 */ 430 typedef_spec = orbit_cbe_get_typespec (ts); 431 typedef_name = orbit_cbe_get_typespec_str (typedef_spec); 432 433 g_string_printf (str, "%s", 434 !strcmp (typedef_name, "CORBA_string") ? 435 "CORBA_char *" : name); 436 437 g_free (typedef_name); 438 } else 439 g_string_printf (str, "%s", name); 440 441 g_free (name); 442 443 if ( isSlice ) 444 g_string_append (str, "_slice"); 445 446 for (i = 0; i < n; i++) 447 g_string_append_c (str, '*'); 448 449 return g_string_free (str, FALSE); 450 } 451 452 /* 453 This helper just writes the typespec of a parameter to a method without any 454 'const' qualifier. 455 */ 456 void 457 orbit_cbe_voyager_write_param_typespec(FILE *of, IDL_tree tree) { 458 IDL_tree ts = NULL /* Quiet gcc */; 459 IDL_ParamRole role = 0 /* Quiet gcc */; 460 char *str; 461 462 switch ( IDL_NODE_TYPE(tree) ) { 463 case IDLN_PARAM_DCL: /* one of the parameters */ 464 ts = IDL_PARAM_DCL(tree).param_type_spec; 465 role = oidl_attr_to_paramrole(IDL_PARAM_DCL(tree).attr); 466 break; 467 default: 468 g_assert_not_reached(); 469 } 470 471 str = orbit_cbe_voyager_write_param_typespec_str (ts, role); 472 fprintf (of, str); 473 g_free (str); 474 } 475 409 476 static void 410 477 orbit_cbe_write_param_typespec_raw (FILE *of, IDL_tree ts, IDL_ParamRole role)
Note:
See TracChangeset
for help on using the changeset viewer.