chimp_bool_t chimp_symtable_class_bootstrap (void) { chimp_symtable_class = chimp_class_new ( CHIMP_STR_NEW("symtable"), NULL, sizeof(ChimpSymtable)); if (chimp_symtable_class == NULL) { return CHIMP_FALSE; } CHIMP_CLASS(chimp_symtable_class)->init = _chimp_symtable_init; CHIMP_CLASS(chimp_symtable_class)->mark = _chimp_symtable_mark; chimp_gc_make_root (NULL, chimp_symtable_class); return CHIMP_TRUE; }
chimp_bool_t chimp_task_add_module (ChimpTaskInternal *task, ChimpRef *module) { if (task == NULL) { task = chimp_task_current (); } if (task->modules == NULL) { task->modules = chimp_hash_new (); if (task->modules == NULL) { return CHIMP_FALSE; } chimp_gc_make_root (NULL, task->modules); } return chimp_hash_put (task->modules, CHIMP_MODULE(module)->name, module); }
chimp_bool_t chimp_task_class_bootstrap (void) { chimp_task_class = chimp_class_new (CHIMP_STR_NEW("task"), NULL, sizeof(ChimpTask)); if (chimp_task_class == NULL) { return CHIMP_FALSE; } CHIMP_CLASS(chimp_task_class)->init = _chimp_task_init; CHIMP_CLASS(chimp_task_class)->dtor = _chimp_task_dtor; CHIMP_CLASS(chimp_task_class)->str = _chimp_task_str; CHIMP_CLASS(chimp_task_class)->cmp = _chimp_task_cmp; CHIMP_CLASS(chimp_task_class)->mark = _chimp_task_mark; chimp_gc_make_root (NULL, chimp_task_class); chimp_class_add_native_method (chimp_task_class, "send", _chimp_task_send); chimp_class_add_native_method (chimp_task_class, "join", _chimp_task_join); return CHIMP_TRUE; }
chimp_bool_t chimp_hash_class_bootstrap (void) { chimp_hash_class = chimp_class_new (CHIMP_STR_NEW("hash"), chimp_object_class, sizeof(ChimpHash)); if (chimp_hash_class == NULL) { return CHIMP_FALSE; } CHIMP_CLASS(chimp_hash_class)->str = chimp_hash_str; CHIMP_CLASS(chimp_hash_class)->dtor = _chimp_hash_dtor; CHIMP_CLASS(chimp_hash_class)->getitem = _chimp_hash_getitem; CHIMP_CLASS(chimp_hash_class)->mark = _chimp_hash_mark; chimp_gc_make_root (NULL, chimp_hash_class); chimp_class_add_native_method (chimp_hash_class, "put", _chimp_hash_put); chimp_class_add_native_method (chimp_hash_class, "get", _chimp_hash_get); chimp_class_add_native_method (chimp_hash_class, "size", _chimp_hash_size); chimp_class_add_native_method (chimp_hash_class, "items", _chimp_hash_items); return CHIMP_TRUE; }