Ignore:
Timestamp:
Jan 20, 2007, 2:51:11 PM (19 years ago)
Author:
cinc
Message:

Improvements

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-skelimpl.c

    r202 r204  
    123123                orbit_cbe_ski_process_piece(&ski);
    124124        }
     125    fprintf(outfile, "\n#endif /* NOM_CLASS_IMPLEMENTATION_FILE */\n");
    125126}
    126127
     
    12571258        /* Create the static class data structs */
    12581259        fprintf(ski->of, "/* %s, %s line %d */\n", __FILE__, __FUNCTION__, __LINE__);
     1260        fprintf(ski->of, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n\n", id);
    12591261        fprintf(ski->of, "struct %sClassDataStructure %sClassData = {0};\n", id, id);
    12601262        fprintf(ski->of, "static struct %sCClassDataStructure %sCClassData = {0};\n\n", id, id);
     
    14121414          /* Get data macro */
    14131415          fprintf(ski->of, "\n/*\n * Get data macros for %s\n */\n", id);
    1414           fprintf(ski->of, "#warning NOM kernel devs: these macros are preliminary\n\n");
    14151416          fprintf(ski->of, "typedef %sData* NOMLINK nomTP_%s_DataThunk(void*);\n", id, id);
    14161417          fprintf(ski->of, "typedef nomTP_%s_DataThunk *nomTD_%s_DataThunk;\n", id, id);
  • trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-stubs.c

    r117 r204  
    448448}
    449449
     450/*
     451  This function returns the interface name from the given tree. It returns the first
     452  name found. Works for what it's build for (getting the toplevel name for single class
     453  IDL files). No idea what happens with files containing several interfaces...
     454 */
     455static void
     456VoyagerFindInterfaceName(IDL_tree tree, char** iface_id)
     457{
     458
     459        if (!tree)
     460      return;
     461
     462        switch (IDL_NODE_TYPE (tree)) {
     463        case IDLN_MODULE:
     464                break;
     465        case IDLN_LIST: {
     466                IDL_tree sub;
     467                for (sub = tree; sub; sub = IDL_LIST (sub).next){
     468          VoyagerFindInterfaceName((IDL_LIST (sub).data), iface_id);
     469        }
     470                break;
     471                }
     472        case IDLN_ATTR_DCL: {
     473                break;
     474                }
     475        case IDLN_INTERFACE: {
     476      VoyagerFindInterfaceName(IDL_INTERFACE (tree).body, iface_id);
     477                break;
     478                }
     479        case IDLN_OP_DCL:
     480      {
     481        char *priviface_id = IDL_ns_ident_to_qstring (
     482                                            IDL_IDENT_TO_NS (IDL_INTERFACE (
     483                                            IDL_get_parent_node (tree, IDLN_INTERFACE, NULL)
     484                                            ).ident), "_", 0);
     485        //printf("----------> %s\n", priviface_id);
     486        if(priviface_id)
     487          *iface_id=priviface_id; /* This is a copy */
     488                break;
     489      }
     490        default:
     491                break;
     492        }
     493    return;
     494}
     495
    450496void
    451497orbit_idl_output_c_stubs (IDL_tree       tree,
     
    453499                          OIDL_C_Info   *ci)
    454500{
    455         fprintf (ci->fh, OIDL_C_WARNING);
    456         fprintf (ci->fh, "#include <string.h>\n");
     501  char     *iface_id=NULL;
     502  fprintf (ci->fh, OIDL_C_WARNING);
     503  VoyagerFindInterfaceName(tree, &iface_id); /* get name of this interface/class */
     504  g_assert(iface_id);
     505  fprintf (ci->fh, "#ifndef NOM_%s_IMPLEMENTATION_FILE\n", iface_id);
     506  fprintf (ci->fh, "#define NOM_%s_IMPLEMENTATION_FILE\n#endif\n\n", iface_id);
     507
     508  fprintf (ci->fh, "#include <string.h>\n");   
    457509#ifdef USE_LIBIDL_CODE
    458510    fprintf (ci->fh, "#define ORBIT2_STUBS_API\n");
     
    460512        fprintf (ci->fh, "#include \"%s.ih\"\n\n", ci->base_name);
    461513        cs_output_stubs (tree, ci, NULL);
    462 }
     514
     515}
     516
     517
     518
     519
     520
     521
Note: See TracChangeset for help on using the changeset viewer.