Ignore:
Timestamp:
Nov 26, 2006, 3:07:22 PM (19 years ago)
Author:
cinc
Message:

Makros for calling overriden methods were broken. Parameters were missing

Location:
trunk/ORBit2-2.14.0/src/idl-compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c

    r100 r114  
    3939  fprintf(ci->fh, "\n/** typedefs **/\n");
    4040  ch_output_types(tree, rinfo, ci);
    41  
     41
     42#ifdef USE_LIBIDL_CODE 
    4243  if ( ci->do_skel_defs ) {
    4344        /* Do all the POA structures, etc. */
    4445        fprintf(ci->fh, "\n/** POA structures **/\n");
    45 #ifdef USE_LIBIDL_CODE
    4646        ch_output_poa(tree, rinfo, ci);
    47 #else
    48         fprintf(ci->fh, "  /* POA structures not used in Voyager */\n");
    49 #endif
    50 
    5147        fprintf(ci->fh, "\n/** skel prototypes **/\n");
    52 #ifdef USE_LIBIDL_CODE
    5348        ch_output_skel_protos(tree, rinfo, ci);
    54 #else
    55         fprintf(ci->fh, "  /* skel prototypes not used in Voyager */\n");
    56 #endif
    57   }
     49  }
     50#endif
     51
    5852  fprintf(ci->fh, "\n/** stub prototypes **/\n");
    5953  fprintf(ci->fh, "  /* (%s, %s line %d) */\n", __FILE__, __FUNCTION__, __LINE__);
     
    107101      id = orbit_cbe_get_typespec_str(tree);
    108102
    109       fprintf(ci->fh, "\n/** Voyager **/\n");
     103      fprintf(ci->fh, "\n/** Voyager  (%s: %s line %d) **/\n", __FILE__, __FUNCTION__, __LINE__);
    110104
    111105      /* C specific class structure */
     
    125119      fprintf(ci->fh, "\n/*\n * New macro for %s\n */\n", id);
    126120      fprintf(ci->fh, "#define %sNew() \\\n", id);
    127       /* Changed for typesafety */
     121      /* Changed for typesafetyness */
    128122      fprintf(ci->fh, "        ((%s*)_nomNew((_%s ? _%s : %sNewClass(%s_MajorVersion, %s_MinorVersion)), (void*) 0))\n",
    129123              id, id, id, id, id ,id);
  • trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c

    r100 r114  
    189189
    190190static
     191void VoyagerWriteParamsForParentCall(IDL_tree curif, InheritedOutputInfo *ioi)
     192{
     193  IDL_tree curitem;
     194  char* overridenMethodName;
     195
     196  if(curif == ioi->realif)
     197    return;
     198
     199  overridenMethodName=ioi->chrOverridenMethodName;
     200
     201  for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) {
     202    IDL_tree curop = IDL_LIST(curitem).data;
     203
     204    switch(IDL_NODE_TYPE(curop)) {
     205    case IDLN_OP_DCL:
     206      {
     207        /* Check if the current method (introduced by some parent) is the one to be
     208           overriden. */
     209        if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
     210          IDL_tree  sub;
     211
     212          for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
     213            IDL_tree parm = IDL_LIST (sub).data;
     214            fprintf (ioi->of, "%s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
     215          }
     216        }
     217        break;
     218      }
     219        default:
     220          break;
     221    }
     222  }
     223}
     224
     225#if 0
     226static
    191227void VoyagerWriteParamsForParentCall (FILE       *of,
    192                                 IDL_tree    op)
     228                                      IDL_tree    op)
    193229{
    194230  IDL_tree  sub;
     
    200236  for (sub = IDL_OP_DCL (op).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
    201237    IDL_tree parm = IDL_LIST (sub).data;
    202     fprintf (of, " %s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
     238    fprintf (of, "/**/ %s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
    203239  }
    204240  fprintf (of, " ev)");
    205241}
     242#endif
    206243
    207244static void
     
    697734              fprintf(ski->of, " NOMLINK impl_%s_%s(%s *nomSelf,\n",
    698735                      id2, IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str, id2);
    699             // fprintf(ski->of, " NOMLINK %s(%s *nomSelf,\n", IDL_IDENT(IDL_OP_DCL(ski->tree).ident).str, id2);
    700 #endif
    701            
    702             op = ski->tree;
    703             for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls;
    704                 curitem; curitem = IDL_LIST(curitem).next) {
    705               subski.tree = IDL_LIST(curitem).data;
    706               orbit_cbe_ski_process_piece(&subski);
    707             }
     736#endif
     737            /* Output the params */
     738            if(bOverriden)
     739              {
     740                fprintf(ski->of, "/* Params should end here ... */\n");
     741                op = ski->tree;
     742                for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls;
     743                    curitem; curitem = IDL_LIST(curitem).next) {
     744                  subski.tree = IDL_LIST(curitem).data;
     745                  orbit_cbe_ski_process_piece(&subski);
     746                }
     747              }
     748            else
     749              {
     750                op = ski->tree;
     751                for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls;
     752                    curitem; curitem = IDL_LIST(curitem).next) {
     753                  subski.tree = IDL_LIST(curitem).data;
     754                  orbit_cbe_ski_process_piece(&subski);
     755                }
     756              }
    708757           
    709758            if(IDL_OP_DCL(op).context_expr)
     
    747796                  IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerOutputIntroducingClass, &ioi);
    748797                }
    749                 fprintf(ski->of, ":%s\";\n",gstr->str);
     798                fprintf(ski->of, ":%s\";\n",gstr->str); /* Output the method name */
    750799
    751800                fprintf(ski->of, "/* %s, %s line %d */\n", __FILE__, __FUNCTION__, __LINE__);
    752801                fprintf(ski->of, "static nomMethodProc* %s_parent_resolved;\n", id);
    753802                fprintf(ski->of, "#define %s_parent", id);
     803
    754804                /* output params for macro */
    755                 VoyagerWriteParamsForParentCall (ski->of, ski->tree );
     805                fprintf(ski->of, "(nomSelf, ");
     806                if(IDL_INTERFACE(tmptree).inheritance_spec) {
     807                  InheritedOutputInfo ioi;
     808
     809                  ioi.of = ski->of;
     810                  ioi.realif = tmptree;
     811                  ioi.chrOverridenMethodName=gstr->str;
     812                  IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerWriteParamsForParentCall, &ioi);
     813                }
     814                fprintf(ski->of, "ev)");
    756815                fprintf(ski->of, " \\\n    (((");
    757816
     
    767826                fprintf(ski->of, ") \\\n    %s_parent_resolved)", id);
    768827                /* output params for macro */
    769                 VoyagerWriteParamsForParentCall (ski->of, ski->tree );
     828                // VoyagerWriteParamsForParentCall (ski->of, ski->tree );
     829                fprintf(ski->of, "(nomSelf, ");
     830                if(IDL_INTERFACE(tmptree).inheritance_spec) {
     831                  InheritedOutputInfo ioi;
     832                 
     833                  ioi.of = ski->of;
     834                  ioi.realif = tmptree;
     835                  ioi.chrOverridenMethodName=gstr->str;
     836                  IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerWriteParamsForParentCall, &ioi);
     837                }
     838                fprintf(ski->of, "ev)");
    770839                fprintf(ski->of, ")\n");
    771840#if 0
Note: See TracChangeset for help on using the changeset viewer.