示例#1
0
c_metaObject
c_scopeInsert(
    c_scope scope,
    c_metaObject object)
{
    c_binding binding, found;

    binding = c_bindingNew(scope, object);
    found = c_binding(c_avlTreeInsert(c_avlTree(scope),
                                      (void *)binding,
                                      c_bindingCompare,
                                      NULL));
    if (found == binding) {
        if (!scope->headInsOrder) {
            scope->headInsOrder = binding;
        }
        if (scope->tailInsOrder) {
           scope->tailInsOrder->nextInsOrder = binding;
        }
        scope->tailInsOrder = binding;
    } else {
        if (c_isFinal(found->object) == FALSE) {
            c_metaCopy(object,found->object);
        }
        c_bindingFree(binding,MM(scope));
    }

    c_keep(found->object);

    /** Note that if inserted (found == binding) the object reference count is increased by 2.
        one for being inserted and one for being returned.
     */
    return found->object;
}
示例#2
0
static void
idl_checkFinalized(
    c_baseObject o,
    int* unfinalCount) {
    char* name;

    switch(o->kind) {
    case M_STRUCTURE:
    case M_UNION:
        if(!c_isFinal(c_metaObject(o))) {
            name = c_metaScopedName(c_metaObject(o));
            printf("missing implementation for struct\\union %s.\n", name);
            (*unfinalCount)++;
            free(name);
        }
        break;
    default:
        break;
    }
}