Esempio n. 1
0
/* Return the scoped type specification where for the user types,
   scopes are separated by "_" chracters. 
   IDL strings (bounded and unbounded) are mapped on: c_string, other
       basic types are mapped on corresponding splice types
   IDL structures are identified by: struct <scoped-struct-name>
   IDL unions are identified by: struct <scoped-union-name> becuase
   the union mapping is:
       struct <union-name> {
           <tag-type> _d;
	   union {
		<union-case-specifications>
	   } _u;
	}
    IDL enumerations are identified by: enum <scoped-enum-name>
    IDL typedefs are formed by the scoped type name
    IDL sequences are mapped on: c_sequence
*/
c_char *
idl_scopedSacTypeIdent (
    const idl_typeSpec typeSpec)
{
    c_char scopedTypeIdent[256];

    /* QAC EXPECT 3416; No unexpected side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic ||
	idl_typeSpecType(typeSpec) == idl_tstruct ||
	idl_typeSpecType(typeSpec) == idl_tunion ||
	idl_typeSpecType(typeSpec) == idl_tenum) {
	/* QAC EXPECT 3416; No unexpected side effects here */
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	    idl_sacTypeFromTypeSpec(idl_typeSpec(typeSpec)));
	/* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_ttypedef) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	    idl_scopeStack (
                idl_typeUserScope(idl_typeUser(typeSpec)),
                "_",
                idl_typeSpecName(idl_typeSpec(typeSpec))));
	/* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), idl_sequenceIdent(idl_typeSeq(typeSpec)));
    } else {
	/* Do nothing, only to prevent dangling else-ifs QAC messages */
    }

    return os_strdup(scopedTypeIdent);
}
Esempio n. 2
0
/* Return the scoped type name where for the user types,
   scopes are separated by "_" chracters.
*/
c_char *
idl_scopedTypeName (
    const idl_typeSpec typeSpec)
{
    const char *scopedTypeName;

    /* QAC EXPECT 3416; No unexpected side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tseq) {
	/* Sequences map to c_sequence */
	scopedTypeName = "c_sequence";
        /* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tbasic) {
	/* For basic types take the corresponding type name supported by the splice database */
	/* QAC EXPECT 3416; No unexpected side effects here */
	if (idl_typeBasicType(idl_typeBasic(typeSpec)) == idl_string) {
	    /* in case of bounded string the type name must become c_string 	*/
	    /* type name is of form "C_STRING<xx>"				*/
	    scopedTypeName = "c_string";
	} else {
	    scopedTypeName = idl_typeSpecName(idl_typeSpec(typeSpec));
	}
    } else {
	/* Build a name for user types from scope and its own name */
	scopedTypeName = idl_scopeStack (
            idl_typeUserScope(idl_typeUser(typeSpec)),
            "_",
            idl_typeSpecName(idl_typeSpec(typeSpec)));
    }

    return os_strdup(scopedTypeName);
}
Esempio n. 3
0
static idl_action
idl_structureOpen(
    idl_scope scope,
    const char *name,
    idl_typeStruct structSpec,
    void *userData)
{
    c_char spaces[20];
    idl_tmplExp te;
    CxxTypeUserData *cxxUserData = (CxxTypeUserData *)userData;

    /* QAC EXPECT 3416; No side effects here */
    if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
	/* keylist defined for this struct */
        te = idl_tmplExpNew(idlpp_macroSet);
        idl_macroSetAdd(idlpp_macroSet,
            idl_macroNew("namescope", idl_cxxId(idl_scopeElementName(idl_scopeCur(scope)))));
        idl_macroSetAdd(idlpp_macroSet,
            idl_macroNew("cnamescope", idl_scopeStack(scope, "_", "")));
        idl_macroSetAdd(idlpp_macroSet, idl_macroNew("typename", idl_cxxId(name)));
        snprintf(spaces, sizeof(spaces), "%d", idlpp_indent_level*4);
        idl_macroSetAdd(idlpp_macroSet, idl_macroNew("spaces", spaces));
        idlpp_inStream = idl_streamInNew(idlpp_template, idlpp_macroAttrib);
        idl_tmplExpProcessTmpl(te, idlpp_inStream, idl_fileCur());
        idl_streamInFree(idlpp_inStream);
        idl_tmplExpFree(te);

        /* Store data-type in iterator for future generation of type descriptor. */
        idl_metaCxxAddType(scope, name, idl_typeSpec(structSpec), &cxxUserData->idlpp_metaList);
    }
    return idl_abort;
}
static void
idl_typedefOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeDef defSpec,
    void *userData)
{
    c_char spaces[20];
    idl_tmplExp te;

    /* QAC EXPECT 3416; No unexpected side effects here */
    if ((idl_typeSpecType(idl_typeDefRefered(defSpec)) == idl_tstruct ||
        idl_typeSpecType(idl_typeDefRefered(defSpec)) == idl_tunion) &&
        idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
        /* keylist defined for this union */
        idl_sequenceObjManagDef(scope, name, idl_typeSpec(defSpec));
        te = idl_tmplExpNew(idlpp_macroSet);
        idl_macroSetAdd(idlpp_macroSet, idl_macroNew("type_name", idl_scopeStack(scope, "_", name)));
        snprintf(spaces, (size_t)sizeof(spaces), "%d", idlpp_indent_level*4);
        idl_macroSetAdd(idlpp_macroSet, idl_macroNew("spaces", spaces));
        idlpp_inStream = idl_streamInNew(idlpp_template, idlpp_macroAttrib);
        idl_tmplExpProcessTmpl(te, idlpp_inStream, idl_fileCur());
        idl_streamInFree(idlpp_inStream);
        idl_tmplExpFree(te);
    }
}
Esempio n. 5
0
/**
 * Not yet required
 * @return idl_explore - Apparently this means process the rest of the file.
 */
static idl_action
idl_structureOpen(
    idl_scope scope,
    const char *name,
    idl_typeStruct structSpec,
    void *userData)
{
    char* sampleType;
    (void) scope;
    (void) userData;

    if (idl_keyResolve(idl_keyDefDefGet(), idl_typeUserScope(idl_typeUser(structSpec)), name) != NULL)
    {
        sampleType = idl_corbaCxxTypeFromTypeSpec(idl_typeSpec(structSpec));
        idl_fileOutPrintf(idl_fileCur(),
                            "REGISTER_TOPIC_TRAITS(%s)\n",
                                sampleType);
        /* Remove "StreamSample" for REGISTER_STREAM_TOPIC_TRAITS */
        if(strlen(name) > 12 && strcmp(name+strlen(name)-12, "StreamSample")==0)
        {
            sampleType[strlen(sampleType)-12] = '\0';
            idl_fileOutPrintf(idl_fileCur(),
                        "REGISTER_STREAM_TOPIC_TRAITS(%s)\n",
                            sampleType);

        }
        os_free(sampleType);
    }
    return idl_explore;
}
static idl_action
idl_unionOpen(
    idl_scope scope,
    const char *name,
    idl_typeUnion unionSpec,
    void *userData)
{
    if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
        idl_genInterface(scope, name, "TypeSupport", idl_typeSpec(unionSpec), FALSE);
        idl_genInterface(scope, name, "DataReader", idl_typeSpec(unionSpec), TRUE);
        idl_genInterface(scope, name, "DataReaderView", idl_typeSpec(unionSpec), TRUE);
        idl_genInterface(scope, name, "DataWriter", idl_typeSpec(unionSpec), TRUE);
        idl_genTypeSeqHolder(scope, name, idl_typeSpec(unionSpec));
    }
    return idl_abort;
}
static void
idl_typedefOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeDef defSpec,
    void *userData)
{
    if ((idl_typeSpecType(idl_typeDefActual (defSpec)) == idl_tstruct) ||
        (idl_typeSpecType (idl_typeDefActual (defSpec)) == idl_tunion)) {
        if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
            idl_genInterface(scope, name, "TypeSupport", idl_typeSpec(defSpec), FALSE);
            idl_genInterface(scope, name, "DataReader", idl_typeSpec(defSpec), TRUE);
            idl_genInterface(scope, name, "DataReaderView", idl_typeSpec(defSpec), TRUE);
            idl_genInterface(scope, name, "DataWriter", idl_typeSpec(defSpec), TRUE);
            idl_genTypeSeqHolder(scope, name, idl_typeDefActual(defSpec));
        }
    }
}
Esempio n. 8
0
/* Return the scoped type name where for the user types,
   scopes are separated by "_" chracters.
*/
c_char *
idl_scopedSplTypeName (
    const idl_typeSpec typeSpec)
{
    char scopedTypeName[256];

    /* QAC EXPECT 3416; No unexpected side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tseq) {
	/* Sequences map to c_sequence */
	os_strncpy (scopedTypeName, "c_sequence", sizeof(scopedTypeName));
        /* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tbasic) {
	/* For basic types take the corresponding type name supported by the splice database */
	/* QAC EXPECT 3416; No unexpected side effects here */
	if (idl_typeBasicType(idl_typeBasic(typeSpec)) == idl_string) {
	    /* in case of bounded string the type name must become c_string 	*/
	    /* type name is of form "C_STRING<xx>"				*/
	   os_strncpy (scopedTypeName, "c_string", sizeof(scopedTypeName));
	} else {
	   os_strncpy (scopedTypeName, idl_typeSpecName(idl_typeSpec(typeSpec)), sizeof(scopedTypeName));
	}
    } else if (idl_typeSpecType(typeSpec) == idl_tstruct ||
	idl_typeSpecType(typeSpec) == idl_tunion) {
	snprintf (scopedTypeName, (size_t)sizeof(scopedTypeName), "struct _%s",
	    idl_scopeStack (
                idl_typeUserScope(idl_typeUser(typeSpec)),
                "_",
                idl_typeSpecName(idl_typeSpec(typeSpec))));
    } else if (idl_typeSpecType(typeSpec) == idl_tenum) {
	snprintf (scopedTypeName, (size_t)sizeof(scopedTypeName), "enum _%s",
	    idl_scopeStack (
                idl_typeUserScope(idl_typeUser(typeSpec)),
                "_",
                idl_typeSpecName(idl_typeSpec(typeSpec))));
    } else {
	snprintf (scopedTypeName, (size_t)sizeof(scopedTypeName), "_%s",
	    idl_scopeStack (
                idl_typeUserScope(idl_typeUser(typeSpec)),
                "_",
                idl_typeSpecName(idl_typeSpec(typeSpec))));
    }

    return os_strdup(scopedTypeName);
}
Esempio n. 9
0
static idl_action
idl_unionOpen(
    idl_scope scope,
    const char *name,
    idl_typeUnion unionSpec,
    void *userData)
{
    OS_UNUSED_ARG(userData);

    if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
        idl_genInterface(scope, name, "TypeSupport", idl_typeSpec(unionSpec), FALSE);
        idl_genInterface(scope, name, "DataReader", idl_typeSpec(unionSpec), TRUE);
        idl_genInterface(scope, name, "DataReaderView", idl_typeSpec(unionSpec), TRUE);
        idl_genInterface(scope, name, "DataWriter", idl_typeSpec(unionSpec), TRUE);
        if (idl_getCorbaMode() == IDL_MODE_STANDALONE) {
            idl_genTypeSeqHolder(scope, name, idl_typeSpec(unionSpec));
        }
    }
    return idl_abort;
}
Esempio n. 10
0
static idl_action
idl_unionOpen(
    idl_scope scope,
    const char *name,
    idl_typeUnion unionSpec,
    void *userData)
{
    if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
        newMeta(scope, name, idl_typeSpec(unionSpec));
    }
    return idl_abort;
}
Esempio n. 11
0
static void
idl_typedefOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeDef defSpec,
    void *userData)
{
    if ((idl_typeSpecType(idl_typeDefActual (defSpec)) == idl_tstruct) ||
        (idl_typeSpecType(idl_typeDefActual (defSpec)) == idl_tunion)) {
        if (idl_keyResolve(idl_keyDefDefGet(), scope, name) != NULL) {
            newMeta(scope, name, idl_typeSpec(defSpec));
        }
    }
}
Esempio n. 12
0
/* Return the scoped actual type specification where for the user types,
   scopes are separated by "_" chracters. 
   IDL strings (bounded and unbounded) are mapped on: c_string, other
       basic types are mapped on corresponding splice types
   IDL structures are identified by: struct <scoped-struct-name>
   IDL unions are identified by: struct <scoped-union-name> becuase
   the union mapping is:
       struct <union-name> {
           <tag-type> _d;
	   union {
		<union-case-specifications>
	   } _u;
	}
    IDL enumerations are identified by: enum <scoped-enum-name>
    IDL typedefs are formed by the scoped type name
    IDL sequences are mapped on: c_sequence
*/
static c_char *
idl_scopedSacSequenceElementTypeIdent (
    const idl_typeSpec typeSpec)
{
    c_char scopedTypeIdent[256];

    /* QAC EXPECT 3416; No unexpected side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
	switch (idl_typeBasicType(idl_typeBasic(typeSpec))) {
	case idl_short:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_short");
	    break;
	case idl_ushort:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_unsigned_short");
	    break;
	case idl_long:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_long");
	    break;
	case idl_ulong:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_unsigned_long");
	    break;
	case idl_longlong:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_long_long");
	    break;
	case idl_ulonglong:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_unsigned_long_long");
	    break;
	case idl_float:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_float");
	    break;
	case idl_double:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_double");
	    break;
	case idl_char:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_char");
	    break;
	case idl_string:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_string");
	    break;
	case idl_boolean:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_boolean");
	    break;
	case idl_octet:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "DDS_octet");
	    break;
	default:
	   os_strncpy (scopedTypeIdent, "", (size_t)sizeof(scopedTypeIdent));
	}
    } else if (idl_typeSpecType(typeSpec) == idl_tstruct ||
	idl_typeSpecType(typeSpec) == idl_tunion ||
	idl_typeSpecType(typeSpec) == idl_tenum) {
	/* QAC EXPECT 3416; No unexpected side effects here */
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	    idl_sacTypeFromTypeSpec(idl_typeSpec(typeSpec)));
	/* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_ttypedef) {
	switch (idl_typeSpecType(idl_typeDefRefered (idl_typeDef(typeSpec)))) {
	case idl_tarray:
	case idl_tseq:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
		idl_sacTypeFromTypeSpec(typeSpec));
	    break;
	case idl_ttypedef:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	        idl_scopedSacSequenceTypeIdent(idl_typeDefRefered (idl_typeDef(typeSpec))));
	    break;
	default:
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
		idl_sacTypeFromTypeSpec(idl_typeDefActual(idl_typeDef(typeSpec))));
	}
	/* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tarray) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	    idl_scopedSacSequenceTypeIdent (idl_typeArrayActual(idl_typeArray(typeSpec))));
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	    idl_sequenceIdent(idl_typeSeq(typeSpec)));
    } else {
	/* Do nothing, only to prevent dangling else-ifs QAC messages */
    }

    return os_strdup(scopedTypeIdent);
}
Esempio n. 13
0
/** @brief callback function called on definition of a named type in the IDL input file.
 *
 * Generate code for the following IDL construct:
 * @verbatim
   =>   typedef <type-name> <name>;
   @endverbatim
 *
 * @param scope Current scope
 * @param name Specifies the name of the type
 * @param defSpec Specifies the type of the named type
 */
static void
idl_typedefOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeDef defSpec,
    void *userData)
{
    struct idl_genSACPPData *arg = (struct idl_genSACPPData *)userData;
    idl_typeSpec actualType;
    idl_typeSpec refType;
    const char *refName;
    char *scopedName;

    actualType = idl_typeDefActual(defSpec);
    refType = idl_typeDefRefered(defSpec);
    refName = idl_typeSpecName(refType);
    scopedName = idl_corbaCxxTypeFromTypeSpec(idl_typeSpec(defSpec));
    if (idl_typeSpecType(refType) == idl_tarray) { /* ex. typedef long myArr[22]; */
        idl_arrayTypeImpl(idl_typeArray(refType), scopedName, arg);
    } else {
        if (idl_typeSpecType(actualType) == idl_tarray) {
            /* Generate implementation _alloc() method */
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s_slice *%s_alloc()\n", scopedName, scopedName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"{\n");
            idl_printIndent(arg->indent_level+1);
            idl_fileOutPrintf(idl_fileCur(),"return (%s_slice *)%s_alloc();\n",
                scopedName, refName);
            idl_printIndent(arg->indent_level+1);
            idl_fileOutPrintf(idl_fileCur(),"}\n\n");

            /* Generate implementation _free() method:
             * Implementation is independent of the actual type.
             */
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"void %s_free(%s_slice *s)\n", scopedName, scopedName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"{\n");
            idl_printIndent(arg->indent_level+1);
            idl_fileOutPrintf(idl_fileCur(),"%s_free(s);\n", refName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"}\n\n");

            /* Generate implementation _copy() method */
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"void *%s_copy(%s_slice *to, const %s_slice *from)\n",
                scopedName, scopedName, scopedName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"{\n");
            idl_printIndent(arg->indent_level+1);
            idl_fileOutPrintf(idl_fileCur(),"%s_copy(to, from);\n", refName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"}\n\n");

            /* Generate implementation _dup() method */
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s_slice *%s_dup(const %s_slice *from)\n",
                scopedName, scopedName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"{\n");
            arg->indent_level++;
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s_slice *to = %s_alloc();\n", scopedName, scopedName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s_copy(to, from);\n", refName);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"return to;\n");
            arg->indent_level--;
            idl_fileOutPrintf(idl_fileCur(),"}\n\n");
        }
    }
    os_free(scopedName);
}
Esempio n. 14
0
/** @brief callback function called on definition of a named type in the IDL input file.
 *
 * Generate code for the following IDL construct:
 * @verbatim
   =>   typedef <type-name> <name>;
   @endverbatim
 *
 * This function generates a prototype for the helper function to
 * load the typedef metadata if the typedef is defined
 * within the global scope or the scope of a module.
 * The name of the metadata load function is:
 * @verbatim
        __<scope-elements>_<name>__load
   @endverbatim
 * If the type specification is idl_tbasic a standard mapping will be applied:
 * @verbatim
	typedef <basic-type-mapping> <scope-elements>_<name>;
   @endverbatim
 * If the type specification is a user defined idl_ttypedef, idl_tenum,
 * idl_tstruct or idl_tunion a scoped name mapping will be generated.
 * @verbatim
	<typedef-name> <name>;     => typedef enum <scope-elements>_<typedef-name> <scope-elements>_<name>;
	<enum-name> <name>;        => typedef enum <scope-elements>_<enum-name> <scope-elements>_<name>;
	<struct-name> <name>;      => typedef struct <scope-elements>_<structure-name> <scope-elements>_<name>;
	<union-name> <name>;       => typedef struct <scope-elements>_<union-name> <scope-elements>_<name>;
   @endverbatim
 * If the type specification is idl_tarray then generate a scoped name
 * with the array specifiers:
 * @verbatim
        <other-usertype-name> <name>[n1]..[nn]; =>
            typedef <scope-elements>_<other-usertype-name> <scope-elements>_<name>[n1]..[nn];
        <basic-type> <name>[n1]..[nn];          =>
            typedef <basic-type-mapping> <scope-elements>_<name>[n1]..[nn];
        sequence<spec> <name>[n1]..[nn];        =>
            typedef c_array <scope-elements>_<name>[n1]..[nn];
        sequence<spec,length> <name>[n1]..[nn]; =>
            typedef c_array <scope-elements>_<name>[n1]..[nn];
   @endverbatim
 * If the type specification is idl_tseq then generate a mapping on c_sequence:
 * @verbatim
        sequence<spec> <name>;        => typedef c_sequence <scope-elements>_<name>;
        sequence<spec,length> <name>; => typedef c_sequence <scope-elements>_<name>;
   @endverbatim
 *
 * @param scope Current scope
 * @param name Specifies the name of the type
 * @param defSpec Specifies the type of the named type
 */
static void
idl_typedefOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeDef defSpec,
    void *userData)
{
    if (idl_scopeStackSize(scope) == 0 || idl_scopeElementType (idl_scopeCur(scope)) == idl_tModule) {
        idl_fileOutPrintf(
            idl_fileCur(),
            "extern c_metaObject __%s__load (c_base base);\n",
            idl_scopeStack(scope, "_", name));
        if (idl_typeSpecType(idl_typeDefActual(defSpec)) == idl_tstruct ||
            idl_typeSpecType(idl_typeDefActual(defSpec)) == idl_tunion) {
            /* If this is a typedef of a struct or union			*/
            /* define the prototype of the function for querying the keys 	*/
            idl_fileOutPrintf(
                idl_fileCur(),
                "extern const char * __%s__keys (void);\n",
                idl_scopeStack(scope, "_", name));
	    /* define the prototype of the function for querying scoped structure name */
            idl_fileOutPrintf(
                idl_fileCur(),
                "extern const char * __%s__name (void);\n",
                idl_scopeStack(scope, "_", name));
        }
    }
    if (idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_ttypedef ||
        idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tenum ||
        idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tstruct ||
        idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tunion ||
        idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tbasic) {
        /* generate code for a standard mapping or a typedef, enum, struct or union user-type mapping */
        idl_printIndent(indent_level);
        idl_fileOutPrintf(
            idl_fileCur(),
            "typedef %s _%s;\n\n",
            idl_scopedSplTypeIdent(idl_typeSpec(idl_typeDefRefered(defSpec))),
            idl_scopeStack (scope, "_", name));
    } else if (idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tarray) {
        /* generate code for an array mapping */
        idl_printIndent(indent_level);
        idl_fileOutPrintf(
            idl_fileCur(),
            "typedef %s _%s",
            idl_scopedSplTypeIdent(idl_typeArrayActual (idl_typeArray(idl_typeDefRefered(defSpec)))),
            idl_scopeStack(scope, "_", name));
        idl_arrayDimensions(idl_typeArray(idl_typeDefRefered(defSpec)), OS_FALSE);
	    idl_fileOutPrintf(idl_fileCur(), ";\n\n");
    } else if (idl_typeSpecType(idl_typeSpec(idl_typeDefRefered(defSpec))) == idl_tseq) {
        /* generate code for a sequence mapping */
        idl_printIndent(indent_level);
        if (idl_typeSeqMaxSize (idl_typeSeq(idl_typeDefRefered(defSpec))) == 0) {
	    /* unbounded sequence */
            idl_fileOutPrintf(
                idl_fileCur(),
                "typedef c_sequence _%s",
                idl_scopeStack (scope, "_", name));
        } else {
	    /* bounded sequence */
            idl_fileOutPrintf(
                idl_fileCur(),
                "typedef c_sequence _%s",
                idl_scopeStack(scope, "_", name));
        }
        idl_fileOutPrintf (idl_fileCur(), ";\n\n");
    } else {
        printf("idl_typedefOpenClose: Unsupported typedef type (typename = %s, type = %s)\n",
            name, idl_scopedTypeName(idl_typeSpec(defSpec)));
    }
}