Example #1
0
/* Return the C++ specific type identifier for the
   specified type specification
*/
c_char *
idl_corbaCxxTypeFromTypeSpec(
    idl_typeSpec typeSpec)
{
    c_char *typeName;

    /* QAC EXPECT 3416; No side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
        /* if the specified type is a basic type */
        if (idl_getCorbaMode() == IDL_MODE_STANDALONE) {
           typeName = standaloneTypeFromTypeSpec(idl_typeBasic(typeSpec));
        } else {
            typeName = corbaTypeFromTypeSpec(idl_typeBasic(typeSpec));
        }
    } else if ((idl_typeSpecType(typeSpec) == idl_tseq) ||
	(idl_typeSpecType(typeSpec) == idl_tarray)) {
	/* sequence does not have an identification */
	typeName = os_strdup ("");
	printf ("idl_corbaCxxTypeFromTypeSpec: Unexpected type handled\n");
        assert(0);
    } else {
        /* if a user type is specified build it from its scope and its name.
	   The type should be one of idl_ttypedef, idl_tenum, idl_tstruct,
           idl_tunion.
	*/
        typeName = idl_scopeStackCxx(
            idl_typeUserScope(idl_typeUser(typeSpec)),
            "::",
            idl_typeSpecName(typeSpec));
    }
    return typeName;
    /* QAC EXPECT 5101; The switch statement is simple, therefor the total complexity is low */
}
Example #2
0
os_boolean
idl_stacDef_isStacDefined(
    idl_scope scope,
    const char *name,
    idl_typeSpec typeSpec,
    idl_typeSpec* baseStringTypeDereffered)
{
    os_boolean isStacDefined = OS_FALSE;
    idl_typeSpec typeDereffered;
    idl_typeSpec subType;
    idl_scope tmpScope;
    os_char* containingElement;
    idl_basicType basic;
    c_ulong maxlen;

    /* resolve any type defs */
    typeDereffered = idl_typeDefResolveFully(typeSpec);
    if(idl_typeSpecType(typeDereffered) == idl_tarray)
    {
        /* If this is an array, then get the sub type and recurse deeper into this
         * operation. Arrays of bounded strings are allowed for pragma stac
         */
        subType = idl_typeArrayActual(idl_typeArray(typeDereffered));
        isStacDefined = idl_stacDef_isStacDefined(scope, name, subType, baseStringTypeDereffered);
    } else if(idl_typeSpecType(typeDereffered) == idl_tbasic)
    {
        /* Get the basic type to see if it is a string */
        basic = idl_typeBasicType(idl_typeBasic(typeDereffered));
        if(basic == idl_string)
        {
            /* If this is indeed a string, then get the 'maxLen' attribute of the
             * string type. If it is not 0, then this is a bounded string
             */
            maxlen = idl_typeBasicMaxlen(idl_typeBasic(typeDereffered));
            if(maxlen != 0)
            {
                tmpScope = idl_scopeDup(scope);
                containingElement = idl_scopeElementName(idl_scopeCur (scope));
                idl_scopePop(tmpScope);
                isStacDefined = idl_stacListItemIsDefined (idl_stacDefDefGet(), tmpScope, containingElement, name);
                if(isStacDefined && baseStringTypeDereffered)
                {
                    *baseStringTypeDereffered = typeDereffered;
                }
            } /* else stac define status not relevant for this member */
        } /* else stac define status not relevant for this member */
    } /* else stac define status not relevant for this member */
    return isStacDefined;
}
Example #3
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);
}
Example #4
0
/* @brief function to find out whether the elements of an array
 * require initialization.
 *
 * idl_arrayElementsNeedInitialization is a local support function to find out
 * whether the specified array is of a type for which all elements need to be
 * initialized individually. If the array is of a primitive type, this is never
 * necessary, but if the array contains a reference type and no underlying
 * sequences (which will be initialized to 0 elements) then for loops will
 * need to be created to explicitly initialize all of these attributes.
 *
 * @param typeSpec Specifies the attribute type that needs to be investigated.
 */
static int
idl_arrayElementsNeedInitialization(
    idl_typeArray typeArray)
{
    int initRequired = FALSE;

    /* Obtain the type of the array. */
    idl_typeSpec typeSpec = idl_typeArrayType(typeArray);

    /* Resolve potential typedefs. */
    while (idl_typeSpecType(typeSpec) == idl_ttypedef) {
        typeSpec = idl_typeDefRefered(idl_typeDef(typeSpec));
    }

    if (idl_typeSpecType(typeSpec) == idl_tarray) {
        initRequired = idl_arrayElementsNeedInitialization(idl_typeArray(typeSpec));
    } else if ( idl_typeSpecType(typeSpec) == idl_tstruct ||
                idl_typeSpecType(typeSpec) == idl_tunion ||
                idl_typeSpecType(typeSpec) == idl_tenum ||
                ( idl_typeSpecType(typeSpec) == idl_tbasic &&
                  idl_typeBasicType(idl_typeBasic (typeSpec)) == idl_string) ) {
        initRequired = TRUE;
    }

    return initRequired;
}
Example #5
0
c_char *
idl_scopedSplTypeIdent (
    const idl_typeSpec typeSpec)
{
    c_char scopedTypeIdent[256];

    /* QAC EXPECT 3416; No unexpected side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
	/* QAC EXPECT 3416; No unexpected side effects here */
	if (idl_typeBasicType (idl_typeBasic(typeSpec)) == idl_string) {
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "c_string");
	} else {
	    snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "%s",
	        idl_typeSpecName(idl_typeSpec(typeSpec)));
	}
	/* QAC EXPECT 3416; No unexpected side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tenum) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "enum _%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_tstruct) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "struct _%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_tunion) {
	snprintf (scopedTypeIdent, (size_t)sizeof(scopedTypeIdent), "struct _%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_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), "c_sequence");
    } else {
	/* Do nothing, only to prevent dangling else-ifs QAC messages */
    }

    return os_strdup(scopedTypeIdent);
}
Example #6
0
/* Return the C++ specific type identifier for the
   specified type specification
*/
c_char *
idl_ISOCxx2TypeFromTypeSpec(
        idl_typeSpec typeSpec)
{
    c_char *typeName = NULL;
    c_char *subType;
    const char *template;
    size_t size;
    c_ulong arrSize;

    switch(idl_typeSpecType(typeSpec)) {
    case idl_tbasic:
        /* if the specified type is a basic type */
        typeName = standaloneTypeFromTypeSpec(idl_typeBasic(typeSpec));
        break;
    case idl_tseq:
Example #7
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);
}
Example #8
0
static void
idl_constantOpenClose(
    idl_scope scope,
    idl_constSpec constantSpec,
    void *userData)
{
    /* Open file for used scope, if needed create the directories */
    idl_openJavaPackage(scope, idl_javaId(idl_constSpecName(constantSpec)));
    /* Write package name */
#if 0
    idl_fileOutPrintf(idl_fileCur(), "/*\n");
    idl_fileOutPrintf(idl_fileCur(), " * Generated by OpenSpliceDDS "OSPL_VERSION_STR"\n");
    idl_fileOutPrintf(idl_fileCur(), " */\n\n");
#endif
    if (idl_scopeStackSize(scope) > 0) {
        idl_fileOutPrintf(idl_fileCur(), "package %s;\n", idl_scopeStackJava(scope, ".", NULL));
        idl_fileOutPrintf(idl_fileCur(), "\n");
    }
    idl_fileOutPrintf(idl_fileCur(), "public interface %s {\n",
	idl_constSpecName(constantSpec));

    if (idl_typeSpecType(idl_constSpecTypeGet(constantSpec)) == idl_tbasic &&
        idl_typeBasicType(idl_typeBasic(idl_constSpecTypeGet(constantSpec))) == idl_string) {
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public static final %s value = %s;\n",
            idl_corbaJavaTypeFromTypeSpec(idl_constSpecTypeGet(constantSpec)),
            idl_constSpecImage (constantSpec));
    } else {
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public static final %s value = (%s)(%s);\n",
            idl_corbaJavaTypeFromTypeSpec(idl_constSpecTypeGet(constantSpec)),
            idl_corbaJavaTypeFromTypeSpec(idl_constSpecTypeGet(constantSpec)),
            idl_constSpecImage(constantSpec));
    }
    idl_fileOutPrintf(idl_fileCur(), "}\n");
}
Example #9
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);
}
Example #10
0
/* Return the standalone C specific type identifier for the
   specified type specification
*/
c_char *
idl_sacTypeFromTypeSpec (
    const idl_typeSpec typeSpec)
{
    c_char *typeName;

    /* QAC EXPECT 3416; No side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
        /* if the specified type is a basic type */
	switch (idl_typeBasicType(idl_typeBasic(typeSpec))) {
	case idl_short:
	    typeName = os_strdup("DDS_short");
	    break;
	case idl_ushort:
	    typeName = os_strdup("DDS_unsigned_short");
	    break;
	case idl_long:
	    typeName = os_strdup("DDS_long");
	    break;
	case idl_ulong:
	    typeName = os_strdup("DDS_unsigned_long");
	    break;
	case idl_longlong:
	    typeName = os_strdup("DDS_long_long");
	    break;
	case idl_ulonglong:
	    typeName = os_strdup("DDS_unsigned_long_long");
	    break;
	case idl_float:
	    typeName = os_strdup("DDS_float");
	    break;
	case idl_double:
	    typeName = os_strdup("DDS_double");
	    break;
	case idl_char:
	    typeName = os_strdup("DDS_char");
	    break;
	case idl_string:
	    typeName = os_strdup("DDS_string");
	    break;
	case idl_boolean:
	    typeName = os_strdup("DDS_boolean");
	    break;
	case idl_octet:
	    typeName = os_strdup("DDS_octet");
	    break;
	default:
	    /* No processing required, empty statement to satisfy QAC */
	    break;
	/* QAC EXPECT 2016; Default case must be empty here */
	}
        /* QAC EXPECT 3416; No side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
	/* sequence does not have an identification */
	typeName = os_strdup ("");
	printf ("idl_sacTypeFromTypeSpec: Unexpected sequence type handled\n");
    } else if (idl_typeSpecType(typeSpec) == idl_tarray) {
	typeName = os_strdup ("");
	printf ("idl_sacTypeFromTypeSpec: Unexpected array type handled\n");
    } else {
        /* if a user type is specified build it from its scope and its name.
	   The type should be one of idl_ttypedef, idl_tenum, idl_tstruct,
           idl_tunion.
	*/
        typeName = idl_scopeStackC (
            idl_typeUserScope(idl_typeUser(typeSpec)),
            "_",
            idl_typeSpecName(typeSpec));
    }
    return typeName;
    /* QAC EXPECT 5101; The switch statement is simple, therefor the total complexity is low */
}
Example #11
0
static void
idl_arrayTypeImpl(
    idl_typeArray typeArray,
    const char *name,
    struct idl_genSACPPData *arg)
{
    idl_typeSpec actualType;
    idl_typeSpec subType;
    c_ulong totalDim;

    actualType = idl_typeArrayActual(typeArray);
    subType = idl_typeArrayType(typeArray);
    /* determine total buffer len, by multiplying all dimensions */
    totalDim = idl_genArrayTotalDimension(typeArray);

    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"template <>\n");
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"%s_slice *DDS_DCPS_ArrayHelper<%s, %s_slice, %s_uniq_>::alloc()\n",
        name, name, name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"{\n");
    idl_printIndent(arg->indent_level+1);
    idl_fileOutPrintf(idl_fileCur(),"return %s_alloc();\n", name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"}\n\n");

    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"template <>\n");
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"void DDS_DCPS_ArrayHelper<%s, %s_slice, %s_uniq_>::copy(%s_slice *to, const %s_slice *from)\n",
        name, name, name, name, name);
    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", name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"}\n\n");

    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"template <>\n");
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"void DDS_DCPS_ArrayHelper<%s, %s_slice, %s_uniq_>::free(%s_slice *ptr)\n",
        name, name, name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"{\n");
    idl_printIndent(arg->indent_level+1);
    idl_fileOutPrintf(idl_fileCur(),"%s_free(ptr);\n", name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"}\n\n");

    /* Generate implementation _alloc() method */
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"%s_slice *%s_alloc()\n", name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"{\n");
    arg->indent_level++;
    if ((idl_typeSpecType(actualType) == idl_tbasic) &&
        (idl_typeBasicType(idl_typeBasic(actualType)) == idl_string)) {
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"::DDS::String_mgr *ret = (::DDS::String_mgr *) new ::DDS::String_mgr[%d];\n",totalDim);
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"for (::DDS::ULong i = 0; i < %d; i++) {\n", totalDim);
        idl_printIndent(arg->indent_level+1);
        idl_fileOutPrintf(idl_fileCur(),"ret[i] = (::DDS::String)NULL;\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"}\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"return (%s_slice *)ret;\n");
    } else {
        if (idl_typeSpecType(actualType) == idl_tseq) {
            /* \TODO */
        } else {
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s *ret = (%s *) new %s[%d];\n",
                idl_corbaCxxTypeFromTypeSpec(actualType),
                idl_corbaCxxTypeFromTypeSpec(actualType),
                idl_corbaCxxTypeFromTypeSpec(actualType),
                totalDim);
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"return (%s_slice *)ret;\n", name);
        }
    }
    arg->indent_level--;
    idl_printIndent(arg->indent_level);
    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", name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"{\n");
    arg->indent_level++;
    if ((idl_typeSpecType(actualType) == idl_tbasic) &&
        (idl_typeBasicType(idl_typeBasic(actualType)) == idl_string)) {
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"if (s) {\n");
        arg->indent_level++;
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"::DDS::String_mgr *base = (::DDS::String_mgr *)s;\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"for (::DDS::ULong i = 0; i < %d; i++) {\n", totalDim);
        idl_printIndent(arg->indent_level+1);
        idl_fileOutPrintf(idl_fileCur(),"base[i] = (::DDS::String)NULL;\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"}\n");
        arg->indent_level--;
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"}\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"delete [] s;\n");
    } else {
        if (idl_typeSpecType(actualType) == idl_tseq) {
            /* \TODO */
        } else {
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"delete [] s;\n");
        }
    }
    arg->indent_level--;
    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",
        name, name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"{\n");
    arg->indent_level++;
    if ((idl_typeSpecType(actualType) == idl_tbasic) &&
        (idl_typeBasicType(idl_typeBasic(actualType)) == idl_string)) {
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"::DDS::String_mgr *sv = (::DDS::String_mgr *)from;\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"::DDS::String_mgr *tv = (::DDS::String_mgr *)to;\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"for (::DDS::ULong i = 0; i < %d; i++) {\n", totalDim);
        idl_printIndent(arg->indent_level+1);
        idl_fileOutPrintf(idl_fileCur(),"tv[i] = ::DDS::string_dup (sv[i]);\n");
        idl_printIndent(arg->indent_level);
        idl_fileOutPrintf(idl_fileCur(),"}\n");

    } else {
        if (idl_typeSpecType(actualType) == idl_tseq) {
            /* \TODO */
        } else {
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s *sv = (%s *)from;\n",
                idl_corbaCxxTypeFromTypeSpec(actualType),
                idl_corbaCxxTypeFromTypeSpec(actualType));
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"%s *tv = (%s *)to;\n",
                idl_corbaCxxTypeFromTypeSpec(actualType),
                idl_corbaCxxTypeFromTypeSpec(actualType));
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"for (::DDS::ULong i = 0; i < %d; i++) {\n", totalDim);
            idl_printIndent(arg->indent_level+1);
            idl_fileOutPrintf(idl_fileCur(),"tv[i] = sv[i];\n");
            idl_printIndent(arg->indent_level);
            idl_fileOutPrintf(idl_fileCur(),"}\n");
        }
    }
    arg->indent_level--;
    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",
        name, name, name);
    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", name, name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"%s_copy(to, from);\n", name);
    idl_printIndent(arg->indent_level);
    idl_fileOutPrintf(idl_fileCur(),"return to;\n");
    arg->indent_level--;
    idl_fileOutPrintf(idl_fileCur(),"}\n\n");
}
Example #12
0
/* Return the C specific type identifier for the
   specified type specification
*/
c_char *
idl_corbaJavaTypeFromTypeSpec (
    idl_typeSpec typeSpec)
{
    c_char *typeName = NULL;

    /* QAC EXPECT 3416; No side effects here */
    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
        /* if the specified type is a basic type */
	switch (idl_typeBasicType(idl_typeBasic(typeSpec))) {
	case idl_short:
	case idl_ushort:
	    typeName = os_strdup("short");
	    break;
	case idl_long:
	case idl_ulong:
	    typeName = os_strdup("int");
	    break;
	case idl_longlong:
	case idl_ulonglong:
	    typeName = os_strdup("long");
	    break;
	case idl_float:
	    typeName = os_strdup("float");
	    break;
	case idl_double:
	    typeName = os_strdup("double");
	    break;
	case idl_char:
	    typeName = os_strdup("char");
	    break;
	case idl_string:
	    typeName = os_strdup("java.lang.String");
	    break;
	case idl_boolean:
	    typeName = os_strdup("boolean");
	    break;
	case idl_octet:
	    typeName = os_strdup("byte");
	    break;
	default:
	    /* No processing required, empty statement to satisfy QAC */
	    break;
	/* QAC EXPECT 2016; Default case must be empty here */
	}
        /* QAC EXPECT 3416; No side effects here */
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
	return idl_corbaJavaTypeFromTypeSpec (idl_typeSeqActual(idl_typeSeq (typeSpec)));
    } else if (idl_typeSpecType(typeSpec) == idl_tarray) {
#if 0
	/* sequence does not have an identification */
	typeName = os_strdup ("");
	printf ("idl_corbaJavaTypeFromTypeSpec: Unexpected type handled\n");
#else
	return idl_corbaJavaTypeFromTypeSpec (idl_typeArrayActual(idl_typeArray (typeSpec)));
#endif
    } else if (idl_typeSpecType(typeSpec) == idl_ttypedef) {
	return idl_corbaJavaTypeFromTypeSpec (idl_typeDefActual(idl_typeDef (typeSpec)));
    } else {
        /* if a user type is specified build it from its scope and its name.
	   The type should be one of idl_ttypedef, idl_tenum, idl_tstruct,
           idl_tunion.
	*/
        typeName = idl_scopeStackJava(
            idl_typeUserScope(idl_typeUser(typeSpec)),
            ".",
            idl_typeSpecName(typeSpec));
    }
    return typeName;
    /* QAC EXPECT 5101; The switch statement is simple, therefor the total complexity is low */
}
Example #13
0
/** @brief callback function called on closure of a union in the IDL input file.
 *
 * Generate code for the following IDL construct:
 * @verbatim
        union <union-name> switch(<switch-type>) {
            case label1.1; .. case label1.n;
                <union-case-1>;
            case label2.1; .. case label2.n;
                ...        ...
            case labeln.1; .. case labeln.n;
                <union-case-n>;
            default:
                <union-case-m>;
   =>   };
   @endverbatim
 *
 * The union is closed:
 * @verbatim
            } _u;
        };
   @endverbatim
 * @param name Name of the union
 */
static void
idl_unionClose(
    const char *name,
    void *userData)
{
    idl_mapIter mapIter;
    idl_typeSpec typeSpec;
    char *memberName;

    mapIter = idl_mapFirst(map);
    typeSpec = idl_mapIterObject(mapIter);
    memberName = idl_mapIterKey(mapIter);

    idl_fileOutPrintf(idl_fileCur(), "    public %s () {\n", idl_javaId(name));

    while (idl_typeSpecType(typeSpec) == idl_ttypedef) {
        typeSpec = idl_typeDefRefered(idl_typeDef(typeSpec));
    }

    if (idl_typeSpecType(typeSpec) == idl_tbasic) {
        if (idl_typeBasicType(idl_typeBasic (typeSpec)) == idl_string) {
            idl_fileOutPrintf(
                idl_fileCur(),
                "        __%s = \"\";\n",
                idl_javaId(memberName));
        } else if (idl_typeBasicType(idl_typeBasic (typeSpec)) == idl_boolean) {
            idl_fileOutPrintf(
                idl_fileCur(),
                "        __%s = false;\n",
                idl_javaId(memberName));
        } else if (idl_typeBasicType(idl_typeBasic (typeSpec)) == idl_char) {
            idl_fileOutPrintf(
                idl_fileCur(),
                "        __%s = '\\0';\n",
                idl_javaId(memberName));
        } else {
            idl_fileOutPrintf(
                idl_fileCur(),
                "        __%s = 0;\n",
                idl_javaId(memberName));
        }
    } else if (idl_typeSpecType(typeSpec) == idl_tseq || idl_typeSpecType(typeSpec) == idl_tarray) {
        int __memberNameLength;
        char *__memberName;

        __memberNameLength = strlen(memberName) + 2 + 1;
        __memberName = os_malloc(__memberNameLength);
        snprintf(__memberName, __memberNameLength, "__%s", memberName);
        idl_fileOutPrintf(
            idl_fileCur(),
            "        __%s = new %s",
            idl_javaId(memberName),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
        java_arrayDimensions(typeSpec);
        idl_fileOutPrintf(idl_fileCur(), ";\n");
        idl_ifArrayInitializeElements(typeSpec, __memberName);
        os_free(__memberName);
    } else if (idl_typeSpecType(typeSpec) == idl_tstruct || idl_typeSpecType(typeSpec) == idl_tunion) {
        idl_fileOutPrintf(
            idl_fileCur(),
            "        __%s = new %s();\n",
            idl_javaId(memberName),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
    } else if (idl_typeSpecType(typeSpec) == idl_tenum) {
        idl_fileOutPrintf(
            idl_fileCur(),
            "        __%s = %s.from_int(0);\n",
            idl_javaId(memberName),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
    }

    idl_fileOutPrintf(idl_fileCur(), "        _d = (%s)%s;\n", unionSwitchType, union1stCaseValue);
    idl_fileOutPrintf(idl_fileCur(), "    }\n");

    idl_mapIterFree(mapIter);
    idl_mapFree(map);
    union1stCaseValue = NULL;


    /* close class */
    idl_fileOutPrintf(idl_fileCur(), "}\n");
    /* close file */
    idl_closeJavaPackage();
}
Example #14
0
/** @brief callback function called on definition of a structure member in the IDL input file.
 *
 * Generate code for the following IDL construct:
 * @verbatim
        struct <structure-name> {
   =>       <structure-member-1>;
   =>       ...              ...
   =>       <structure-member-n>;
        };
   @endverbatim
 *
 * @param scope Current scope
 * @param name Name of the structure member
 * @param typeSpec Type specification of the structure member
 */
static void
idl_structureMemberOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeSpec typeSpec,
    void *userData)
{
    /* Dereference possible typedefs first. */
    while (idl_typeSpecType(typeSpec) == idl_ttypedef) {
        typeSpec = idl_typeDefRefered(idl_typeDef(typeSpec));
    }

    /* generate type-name and field-name attribute */
    if ((idl_typeSpecType(typeSpec) == idl_tbasic)) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        if (idl_typeBasicType(idl_typeBasic (typeSpec)) == idl_string) {
            idl_fileOutPrintf(
                idl_fileCur(),
                "    public %s %s = \"\";\n",
                idl_corbaJavaTypeFromTypeSpec(typeSpec),
                idl_javaId(name));
        } else {
            idl_fileOutPrintf(
                idl_fileCur(),
                "    public %s %s;\n",
                idl_corbaJavaTypeFromTypeSpec(typeSpec),
                idl_javaId(name));
        }
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        /* Inline sequence definition */
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public %s%s %s = new %s",
            idl_corbaJavaTypeFromTypeSpec(typeSpec),
            idl_sequenceIndexString(idl_typeSeq(typeSpec)),
            idl_javaId(name),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
        java_arrayDimensions(typeSpec);
        idl_fileOutPrintf (idl_fileCur(), ";\n");
    } else if (idl_typeSpecType(typeSpec) == idl_tarray) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        /* Inline array definition */
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public %s%s %s = new %s",
            idl_corbaJavaTypeFromTypeSpec (typeSpec),
            idl_arrayJavaIndexString(idl_typeArray(typeSpec)),
            idl_javaId(name),
            idl_corbaJavaTypeFromTypeSpec (typeSpec));
        java_arrayDimensions(typeSpec);
        idl_fileOutPrintf (idl_fileCur(), ";\n");
    } else if (idl_typeSpecType(typeSpec) == idl_tstruct) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public %s %s = new %s();\n",
            idl_corbaJavaTypeFromTypeSpec(typeSpec),
            idl_javaId(name),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
    } else if (idl_typeSpecType(typeSpec) == idl_tenum) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public %s %s = %s.from_int(0);\n",
            idl_corbaJavaTypeFromTypeSpec(typeSpec),
            idl_javaId(name),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
    } else if (idl_typeSpecType (typeSpec) == idl_tunion) {
        /* store type-name and field-name in iterator (append) */
        idl_mapAdd(map, idl_javaId(name), typeSpec);
        idl_fileOutPrintf(
            idl_fileCur(),
            "    public %s %s = new %s();\n",
            idl_corbaJavaTypeFromTypeSpec(typeSpec),
            idl_javaId(name),
            idl_corbaJavaTypeFromTypeSpec(typeSpec));
    } else {
        printf("idl_genSajType.c:idl_structureMemberOpenClose: Unexpected type %d\n",
            idl_typeSpecType(typeSpec));
    }
}
Example #15
0
/* @brief generate initialization of array elements.
 *
 * idl_arrayElementInit generates for-loops that initialize
 * each attribute of an array explicitly.
 *
 * @param typeArray Specifies the type of the array
 */
static void
idl_arrayElementInit(
    idl_typeSpec typeSpec,
    const char *elementName,
    int dimCount,
    int indent)
{
    while (idl_typeSpecType(typeSpec) == idl_ttypedef) {
        typeSpec = idl_typeDefRefered(idl_typeDef(typeSpec));
    }

    if (idl_typeSpecType(typeSpec) == idl_tarray) {
        idl_fileOutPrintf(
            idl_fileCur(),
            "%*sfor(int i%d = 0; i%d < %d; i%d++) {\n",
            indent,
            "",
            dimCount,
            dimCount,
            idl_typeArraySize(idl_typeArray(typeSpec)),
            dimCount);
        idl_arrayElementInit(
            idl_typeArrayType(idl_typeArray(typeSpec)),
            elementName,
            dimCount + 1,
            indent + 4);
        idl_fileOutPrintf(
            idl_fileCur(),
            "%*s}\n",
            indent,
            "");
    } else {
        int j;

        idl_fileOutPrintf(
            idl_fileCur(),
            "%*s%s",
            indent,
            "",
            elementName);
        for (j =  1; j < dimCount; j++) {
            idl_fileOutPrintf(idl_fileCur(), "[i%d]", j);
        }
        if ( idl_typeSpecType(typeSpec) == idl_tbasic &&
             idl_typeBasicType(idl_typeBasic(typeSpec)) == idl_string) {
            idl_fileOutPrintf(
                idl_fileCur(),
                " = \"\";\n");
         } else if ( idl_typeSpecType(typeSpec) == idl_tunion ||
                     idl_typeSpecType(typeSpec) == idl_tstruct ) {
            idl_fileOutPrintf(
                idl_fileCur(),
                " = new %s();\n",
                idl_corbaJavaTypeFromTypeSpec(typeSpec));
        } else if (idl_typeSpecType(typeSpec) == idl_tenum) {
            idl_fileOutPrintf(
                idl_fileCur(),
                " = %s.from_int(0);\n",
                idl_corbaJavaTypeFromTypeSpec(typeSpec));
        }
    }
}
Example #16
0
/** @brief callback function called on definition of a structure member in the IDL input file.
 *
 * Generate code for the following IDL construct:
 * @verbatim
        struct <structure-name> {
   =>       <structure-member-1>;
   =>       ...              ...
   =>       <structure-member-n>;
        };
   @endverbatim
 *
 * If the type specification is idl_tbasic a standard mapping can be generated:
 * @verbatim
        string <name>;             => c_string <name>;
        string <name,length>;      => c_string <name>;
        char <name>;               => c_char <name>;
        octet <name>;              => c_octet <name>;
        short <name>;              => c_short <name>;
        unsigned short <name>;     => c_ushort <name>;
        long <name>;               => c_long <name>;
        unsigned long <name>;      => c_ulong <name>;
        long long <name>;          => c_longlong <name>;
        unsigned long long <name>; => c_ulonglong <name>;
        float <name>;              => c_float <name>;
        double <name>;             => c_double <name>;
        boolean <name>;            => c_bool <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>;     => enum <scope-elements>_<typedef-name> <name>;
	<enum-name> <name>;        => enum <scope-elements>_<enum-name> <name>;
	<struct-name> <name>;      => struct <scope-elements>_<structure-name> <name>;
	<union-name> <name>;       => struct <scope-elements>_<union-name> <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]; => <scope-elements>_<other-usertype-name> <name>[n1]..[nn];
        <basic-type> <name>[n1]..[nn];          => <basic-type-mapping> <name>[n1]..[nn];
        sequence<spec> <name>[n1]..[nn];        => c_array <name>[n1]..[nn];
        sequence<spec,length> <name>[n1]..[nn]; => c_array <name>[n1]..[nn];
   @endverbatim
 * If the type specification is idl_tseq then generate a mapping on c_sequence:
 * @verbatim
        sequence<spec> <name>;        => c_sequence <name>;
        sequence<spec,length> <name>; => c_sequence <name,length>;
   @endverbatim
 *
 * @param scope Current scope
 * @param name Name of the structure member
 * @param typeSpec Type specification of the structure member
 */
static void
idl_structureMemberOpenClose(
    idl_scope scope,
    const char *name,
    idl_typeSpec typeSpec,
    void *userData)
{
    if (idl_typeSpecType(typeSpec) == idl_ttypedef||
        idl_typeSpecType(typeSpec) == idl_tenum ||
        idl_typeSpecType(typeSpec) == idl_tstruct ||
        idl_typeSpecType(typeSpec) == idl_tunion ||
        idl_typeSpecType(typeSpec) == idl_tbasic)
    {
        os_boolean catsRequested = OS_FALSE;
        os_boolean stacRequested = OS_FALSE;
        idl_typeSpec baseTypeDereffered = NULL;
        idl_typeSpec typeDereffered;

        /* is a stac pragma defined for this member? */
        stacRequested = idl_stacDef_isStacDefined(scope, name, typeSpec, &baseTypeDereffered);
        if(!stacRequested)
        {
            /* Cats and stac def can not be defined over the same member as
             * one excepts string types and the other char (array) types
             */
            catsRequested = idl_catsDef_isCatsDefined(scope, name, typeSpec);
        }

        if(catsRequested)
        {
            assert(!stacRequested);
            typeDereffered = idl_typeDefResolveFully(typeSpec);
            idl_structureMemberOpenClose(scope, name, typeDereffered, userData);
        } else if(stacRequested)
        {
            assert(baseTypeDereffered);
            typeDereffered = idl_typeDefResolveFully(typeSpec);
            idl_printIndent(indent_level);
            idl_fileOutPrintf(idl_fileCur(), "c_char %s", idl_languageId (name));
            /* potential array bounds */
            if((idl_typeSpecType(typeDereffered) == idl_tarray))
            {
                idl_arrayDimensions(idl_typeArray(typeDereffered), OS_TRUE);
            }
            idl_fileOutPrintf(idl_fileCur(), "[%d];\n", idl_typeBasicMaxlen(idl_typeBasic(baseTypeDereffered))+1);
        } else
        {
            /* generate code for a standard mapping or a typedef, enum, struct or union user-type mapping */
            idl_printIndent(indent_level);
            idl_fileOutPrintf(
                idl_fileCur(),
                "%s %s;\n",
                idl_scopedSplTypeIdent(typeSpec),
                idl_languageId(name));
        }
    } else if (idl_typeSpecType(typeSpec) == idl_tarray) {
        /* generate code for an array mapping */
        os_boolean catsRequested = OS_FALSE;
        os_boolean stacRequested = OS_FALSE;
        idl_typeSpec baseTypeDereffered = NULL;

        /* is a stac pragma defined for this member? */
        stacRequested = idl_stacDef_isStacDefined(scope, name, typeSpec, &baseTypeDereffered);
        if(!stacRequested)
        {
            /* Cats and stac def can not be defined over the same member as
             * one excepts string types and the other char (array) types
             */
            catsRequested = idl_catsDef_isCatsDefined(scope, name, typeSpec);
        }
        if(catsRequested)
        {
            assert(!stacRequested);
            idl_printIndent(indent_level);
            idl_fileOutPrintf(idl_fileCur(), "c_string %s;\n", idl_languageId(name));
        } else if(stacRequested)
        {
            assert(!catsRequested);
            idl_printIndent(indent_level);
            idl_fileOutPrintf(
                idl_fileCur(),
                "c_char %s",
                idl_languageId(name));
            idl_arrayDimensions(idl_typeArray(typeSpec), OS_TRUE);
            idl_fileOutPrintf(idl_fileCur(),"[%d]", idl_typeBasicMaxlen(idl_typeBasic(baseTypeDereffered))+1);
            idl_fileOutPrintf(idl_fileCur(), ";\n");
        } else
        {
            idl_printIndent(indent_level);
            if (idl_typeSpecType(idl_typeArrayActual (idl_typeArray(typeSpec))) != idl_tseq)
            {
                idl_fileOutPrintf(
                    idl_fileCur(),
                    "%s %s",
                    idl_scopedSplTypeIdent(idl_typeArrayActual(idl_typeArray(typeSpec))),
                    idl_languageId(name));
            } else
            {
                idl_fileOutPrintf(idl_fileCur(), "c_array %s", idl_languageId (name));
            }
            idl_arrayDimensions(idl_typeArray(typeSpec), OS_FALSE);
            idl_fileOutPrintf(idl_fileCur(), ";\n");
        }
    } else if (idl_typeSpecType(typeSpec) == idl_tseq) {
	/* generate code for a sequence mapping */
        idl_printIndent(indent_level);
        if (idl_typeSeqMaxSize (idl_typeSeq(typeSpec)) == 0) {
	    /* unbounded sequence */
            idl_fileOutPrintf(idl_fileCur(), "c_sequence %s", idl_languageId(name));
        } else {
	    /* bounded sequence */
            idl_fileOutPrintf (idl_fileCur(), "c_sequence %s", idl_languageId(name));
        }
        idl_fileOutPrintf (idl_fileCur(), ";\n");
    } else {
        printf ("idl_structureMemberOpenClose: Unsupported structure member type (member name = %s, type name = %s)\n",
            name, idl_scopedTypeName(typeSpec));
    }
}