Exemplo n.º 1
0
int cx_genCollectAnonymous(void* o, void* userData) {
    cx_ll list = userData;

    if (!cx_checkAttr(o, CX_ATTR_SCOPED)) {
        cx_llInsert(list, o);
    }

    return 1;
}
Exemplo n.º 2
0
/* ::cortex::Fast::Expression::toList() */
Fast_Expression_list Fast_Expression_toList_v(Fast_Expression _this) {
/* $begin(::cortex::Fast::Expression::toList) */
    Fast_Node_list result = NULL;
    
    if (_this) {
        result = cx_llNew();
        cx_llInsert(result, _this); cx_keep_ext(NULL, _this, "convert single expression to list");
    }
    
    return result;
/* $end */
}
Exemplo n.º 3
0
/* Register exithandler */
void cx_onexit(void(*handler)(void*), void* userData) {
    struct cx_exitHandler* h;

    h = cx_malloc(sizeof(struct cx_exitHandler));
    h->handler = handler;
    h->userData = userData;

    cx_mutexLock(&cx_adminLock);
    if (!cx_exitHandlers) {
        cx_exitHandlers = cx_llNew();
    }
    cx_llInsert(cx_exitHandlers, h);
    cx_mutexUnlock(&cx_adminLock);
}
Exemplo n.º 4
0
static void* cx_list_do_(cx_any object, cx_bool insert) {
    cx_ll list = *(cx_ll*)object.value;
    void* value = NULL;
    cx_value dst;
    
    if (cx_collection_elementRequiresAlloc(cx_collection(object.type))) {
        cx_uint32 size = cx_type_sizeof(cx_collection(object.type)->elementType);
        value = cx_calloc(size);
        cx_valueValueInit(&dst, NULL, cx_collection(object.type)->elementType, value);
        cx_initValue(&dst);
    } else {
        value = NULL;
        cx_valueValueInit(&dst, NULL, cx_collection(object.type)->elementType, &value);
        cx_initValue(&dst);
    }

    if (insert) {
        cx_llInsert(list, value);
    } else {
        cx_llAppend(list, value);
    }

    return value;
}
Exemplo n.º 5
0
static void cx_list_insertAction(cx_ll list, void *value, void *userData) {
    CX_UNUSED(userData);
    cx_llInsert(list, value);
}