Esempio n. 1
0
os_iter
os_iterAppend(
    os_iter iter,
    void *object)
{
    os_iterNode n;

    if (iter == NULL) return os_iterNew(object);
    if (object == NULL) {
        return iter;
    }
    n = (os_iterNode)os_malloc(OS_SIZEOF(os_iterNode));
    n->object = object;
    n->next = NULL;
        
    if(iter->tail){
        iter->tail->next = n;
        iter->tail = n;
    } else {
        iter->head = n;
        iter->tail = n;
    }
    iter->length++;
    
    return iter;
}
Esempio n. 2
0
/** @brief callback function called on definition of the union case labels 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
 *
 * @param scope Current scope (the union the labels are defined in)
 * @param labelSpec Specifies the number of labels of the union case
 */
static void
idl_unionLabelsOpenClose(
    idl_scope scope,
    idl_labelSpec labelSpec,
    void *userData)
{
    labelIter = os_iterNew(NULL);
}
Esempio n. 3
0
ut_macroSet
ut_macroSetNew(
    void)
{
    ut_macroSet macroSet = os_malloc((size_t)OS_SIZEOF(ut_macroSet));

    macroSet->macroSet = os_iterNew(NULL);
    return macroSet;
}
Esempio n. 4
0
void
os_procInit(
    os_procContextData process_procContextData,
    const char *name,
    const char *executable_file,
    const char *arguments)
{
    bzero((char *)process_procContextData, (size_t)OS_SIZEOF(os_procContextData));
    process_procContextData->procName = (char *)os_malloc(strlen(name) + 1);
    os_strncpy(process_procContextData->procName, name, strlen(name) + 1);
    os_procSetExitStatus(process_procContextData, -1);
    process_procContextData->procId = (os_int32)process_procContextData;
    os_procSetValidity(process_procContextData, proc_ValRunning);
    process_procContextData->procCallbackList = os_iterNew(NULL);
    process_procContextData->procThreadList = os_iterNew(NULL);
    process_procContextData->procDataSem = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE);
    process_procContextData->procGlobalVarList = os_iterNew(NULL);
    process_procContextData->arguments = (char *)os_malloc(strlen(arguments) + 1);
    os_strncpy(process_procContextData->arguments, arguments, strlen(arguments) + 1);
    process_procContextData->executable = (char *)os_malloc(strlen(executable_file) + 1);
    os_strncpy(process_procContextData->executable, executable_file, strlen(executable_file) + 1);
}
Esempio n. 5
0
/** @brief callback function called on definition 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
 *
 * @param scope Current scope
 * @param name Name of the union
 * @param unionSpec Specifies the number of union cases and the union switch type
 */
static idl_action
idl_unionOpen(
    idl_scope scope,
    const char *name,
    idl_typeUnion unionSpec,
    void *userData)
{
    /* Open file for used scope, if needed create the directories */
    idl_openJavaPackage(scope, idl_javaId(name));
    if (idl_fileCur() == NULL) {
        return idl_abort;
    }
    unionSwitchType = idl_corbaJavaTypeFromTypeSpec(idl_typeUnionSwitchKind(unionSpec));

    /* setup iterator to hold case names and correcsponding type names */
    map = idl_mapNew(NULL, 1, 1);

    /* 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(), "import org.opensplice.dds.dcps.Utilities;\n\n");
    /* public final class <struct-name> { */
    idl_fileOutPrintf(idl_fileCur(), "public final class %s {\n\n", idl_javaId(name));
    idl_fileOutPrintf(idl_fileCur(), "    private %s _d;\n\n", unionSwitchType);
    if(idl_unionHasCase((c_union)idl_typeSpecDef((idl_typeSpec)unionSpec), "discriminator")) {
        idl_fileOutPrintf(idl_fileCur(), "    public %s _discriminator ()\n", unionSwitchType);
    }else {
        idl_fileOutPrintf(idl_fileCur(), "    public %s discriminator ()\n", unionSwitchType);
    }
    idl_fileOutPrintf(idl_fileCur(), "    {\n");
    idl_fileOutPrintf(idl_fileCur(), "        return _d;\n");
    idl_fileOutPrintf(idl_fileCur(), "    }\n\n");

    labelsUsedIter = os_iterNew(NULL);
    /* return idl_explore to indicate that the rest of the enumeration needs to be processed */
    return idl_explore;
}