void DIBuilder_init (ejsval exports) { _ejs_DIBuilder_specops = _ejs_Object_specops; _ejs_DIBuilder_specops.class_name = "LLVMDIBuilder"; _ejs_DIBuilder_specops.Allocate = DIBuilder_allocate; _ejs_gc_add_root (&_ejs_DIBuilder_prototype); _ejs_DIBuilder_prototype = _ejs_object_create(_ejs_Object_prototype); _ejs_DIBuilder = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMDIBuilder", (EJSClosureFunc)DIBuilder_impl, _ejs_DIBuilder_prototype); _ejs_object_setprop_utf8 (exports, "DIBuilder", _ejs_DIBuilder); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_DIBuilder_prototype, x, DIBuilder_prototype_##x) PROTO_METHOD(createCompileUnit); PROTO_METHOD(createFile); PROTO_METHOD(createFunction); PROTO_METHOD(createLexicalBlock); PROTO_METHOD(finalize); #undef PROTO_METHOD EJS_INSTALL_SYMBOL_FUNCTION_FLAGS (_ejs_DIBuilder, create, DIBuilder_create, EJS_PROP_NOT_ENUMERABLE); }
void Type_init (ejsval exports) { _ejs_gc_add_root (&_ejs_Type_prototype); _ejs_Type_prototype = _ejs_object_create(_ejs_Object_prototype); _ejs_Type = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMType", (EJSClosureFunc)Type_impl, _ejs_Type_prototype); _ejs_object_setprop_utf8 (exports, "Type", _ejs_Type); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Type, x, Type_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Type_prototype, x, Type_prototype_##x) OBJ_METHOD(getDoubleTy); OBJ_METHOD(getInt64Ty); OBJ_METHOD(getInt32Ty); OBJ_METHOD(getInt16Ty); OBJ_METHOD(getInt8Ty); OBJ_METHOD(getInt1Ty); OBJ_METHOD(getVoidTy); PROTO_METHOD(pointerTo); PROTO_METHOD(isVoid); PROTO_METHOD(dump); PROTO_METHOD(toString); }
void ArrayType_init (ejsval exports) { _ejs_ArrayType_specops = _ejs_Object_specops; _ejs_ArrayType_specops.class_name = "LLVMArray"; _ejs_ArrayType_specops.Allocate = ArrayType_allocate; _ejs_gc_add_root (&_ejs_ArrayType_prototype); _ejs_ArrayType_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_ArrayType_specops); _ejs_ArrayType = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMArrayType", (EJSClosureFunc)ArrayType_impl, _ejs_ArrayType_prototype); _ejs_object_setprop_utf8 (exports, "ArrayType", _ejs_ArrayType); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_ArrayType, x, ArrayType_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_ArrayType_prototype, x, ArrayType_prototype_##x) OBJ_METHOD(get); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef PROTO_METHOD #undef OBJ_METHOD }
void _ejs_function_init(ejsval global) { trace = getenv("EJS_TRACE") != NULL; _ejs_function_init_proto(); _ejs_Function = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Function, (EJSClosureFunc)_ejs_Function_impl); _ejs_object_setprop (global, _ejs_atom_Function, _ejs_Function); // ECMA262 15.3.3.1 _ejs_object_define_value_property (_ejs_Function, _ejs_atom_prototype, _ejs_Function_prototype, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE); // ECMA262 15.3.3.2 _ejs_object_define_value_property (_ejs_Function, _ejs_atom_length, NUMBER_TO_EJSVAL(1), EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS(_ejs_Function_prototype, x, _ejs_Function_prototype_##x, EJS_PROP_NOT_ENUMERABLE) PROTO_METHOD(toString); PROTO_METHOD(apply); PROTO_METHOD(call); PROTO_METHOD(bind); #undef PROTO_METHOD }
void _ejs_symbol_init(ejsval global) { _ejs_Symbol = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Symbol, _ejs_Symbol_impl); _ejs_object_setprop (global, _ejs_atom_Symbol, _ejs_Symbol); _ejs_gc_add_root (&_ejs_Symbol_prototype); _ejs_Symbol_prototype = _ejs_object_new(_ejs_null, &_ejs_Object_specops); // XXX _ejs_object_setprop (_ejs_Symbol, _ejs_atom_prototype, _ejs_Symbol_prototype); PROTO_METHOD(toString); PROTO_METHOD(valueOf); OBJ_METHOD(for); OBJ_METHOD(keyFor); WELL_KNOWN_SYMBOL(hasInstance); WELL_KNOWN_SYMBOL(isConcatSpreadable); WELL_KNOWN_SYMBOL(species); WELL_KNOWN_SYMBOL(iterator); WELL_KNOWN_SYMBOL(toPrimitive); WELL_KNOWN_SYMBOL(toStringTag); WELL_KNOWN_SYMBOL(unscopables); WELL_KNOWN_SYMBOL(match); WELL_KNOWN_SYMBOL(replace); WELL_KNOWN_SYMBOL(split); WELL_KNOWN_SYMBOL(search); _ejs_object_define_value_property (_ejs_Symbol_prototype, _ejs_Symbol_toStringTag, _ejs_atom_Symbol, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); }
void BasicBlock_init (ejsval exports) { basicblock_specops = _ejs_Object_specops; basicblock_specops.class_name = "LLVMBasicBlock"; basicblock_specops.allocate = BasicBlock_allocate; _ejs_gc_add_root (&_ejs_BasicBlock_proto); _ejs_BasicBlock_proto = _ejs_object_new(_ejs_Object_prototype, &basicblock_specops); _ejs_BasicBlock = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMBasicBlock", (EJSClosureFunc)BasicBlock_impl, _ejs_BasicBlock_proto); _ejs_object_setprop_utf8 (exports, "BasicBlock", _ejs_BasicBlock); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_BasicBlock_proto, x, BasicBlock_prototype_##x) #define PROTO_ACCESSOR(x) EJS_INSTALL_ATOM_GETTER(_ejs_BasicBlock_proto, x, BasicBlock_prototype_get_##x) PROTO_ACCESSOR(name); PROTO_ACCESSOR(parent); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef PROTO_METHOD #undef PROTO_ACCESSOR }
void _ejs_weakset_init(ejsval global) { _ejs_gc_add_root (&_ejs_WeakSetData_symbol); _ejs_WeakSetData_symbol = _ejs_symbol_new(_ejs_atom_WeakSetData); _ejs_WeakSet = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_WeakSet, _ejs_WeakSet_impl); _ejs_object_setprop (global, _ejs_atom_WeakSet, _ejs_WeakSet); _ejs_gc_add_root (&_ejs_WeakSet_prototype); _ejs_WeakSet_prototype = _ejs_object_new (_ejs_Object_prototype, &_ejs_Object_specops); _ejs_object_setprop (_ejs_WeakSet, _ejs_atom_prototype, _ejs_WeakSet_prototype); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_WeakSet, x, _ejs_WeakSet_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS(_ejs_WeakSet_prototype, x, _ejs_WeakSet_prototype_##x, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE) #define PROTO_GETTER(x) EJS_INSTALL_ATOM_GETTER(_ejs_WeakSet_prototype, x, _ejs_WeakSet_prototype_get_##x) PROTO_METHOD(add); // XXX (ES6 23.4.3.2) WeakSet.prototype.constructor PROTO_METHOD(delete); PROTO_METHOD(has); _ejs_object_define_value_property (_ejs_WeakSet_prototype, _ejs_Symbol_toStringTag, _ejs_atom_WeakSet, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); #undef OBJ_METHOD #undef PROTO_METHOD }
void _ejs_generator_init(ejsval global) { _ejs_gc_add_root (&_ejs_Generator_prototype); _ejs_Generator_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_Generator_specops); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS (_ejs_Generator_prototype, x, _ejs_Generator_prototype_##x, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE) PROTO_METHOD(next); PROTO_METHOD(return); PROTO_METHOD(throw); }
void _ejs_iterator_wrapper_init (ejsval global) { _ejs_gc_add_root (&_ejs_IteratorWrapper_prototype); _ejs_IteratorWrapper_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_Object_specops); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS (_ejs_IteratorWrapper_prototype, x, _ejs_IteratorWrapper_prototype_##x, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE) PROTO_METHOD(getNextValue); PROTO_METHOD(getRest); #undef PROTO_METHOD }
void _ejs_set_init(ejsval global) { _ejs_Set = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Set, (EJSClosureFunc)_ejs_Set_impl); _ejs_object_setprop (global, _ejs_atom_Set, _ejs_Set); _ejs_gc_add_root (&_ejs_Set_prototype); _ejs_Set_prototype = _ejs_set_new (); _ejs_object_setprop (_ejs_Set, _ejs_atom_prototype, _ejs_Set_prototype); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Set, x, _ejs_Set_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS(_ejs_Set_prototype, x, _ejs_Set_prototype_##x, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE) #define PROTO_GETTER(x) EJS_INSTALL_ATOM_GETTER(_ejs_Set_prototype, x, _ejs_Set_prototype_get_##x) PROTO_METHOD(add); PROTO_METHOD(clear); PROTO_METHOD(delete); PROTO_METHOD(entries); PROTO_METHOD(forEach); PROTO_METHOD(has); PROTO_GETTER(size); // expand PROTO_METHOD(values) here so that we can install the function for both keys and @@iterator below ejsval _values = _ejs_function_new_native (_ejs_null, _ejs_atom_values, (EJSClosureFunc)_ejs_Set_prototype_values); _ejs_object_define_value_property (_ejs_Set_prototype, _ejs_atom_values, _values, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_FLAGS_WRITABLE | EJS_PROP_CONFIGURABLE); _ejs_object_define_value_property (_ejs_Set_prototype, _ejs_atom_keys, _values, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE); _ejs_object_define_value_property (_ejs_Set_prototype, _ejs_Symbol_iterator, _values, EJS_PROP_NOT_ENUMERABLE); _ejs_object_define_value_property (_ejs_Set_prototype, _ejs_Symbol_toStringTag, _ejs_atom_Set, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); EJS_INSTALL_SYMBOL_FUNCTION_FLAGS (_ejs_Set, create, _ejs_Set_create, EJS_PROP_NOT_ENUMERABLE); #undef OBJ_METHOD #undef PROTO_METHOD _ejs_SetIterator = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Set, (EJSClosureFunc)_ejs_SetIterator_impl); _ejs_gc_add_root (&_ejs_SetIterator_prototype); _ejs_SetIterator_prototype = _ejs_set_iterator_new(_ejs_Set_prototype, EJS_SET_ITER_KIND_VALUE); EJSVAL_TO_OBJECT(_ejs_SetIterator_prototype)->proto = _ejs_Object_prototype; _ejs_object_define_value_property (_ejs_SetIterator, _ejs_atom_prototype, _ejs_SetIterator_prototype, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE); _ejs_object_define_value_property (_ejs_SetIterator_prototype, _ejs_atom_constructor, _ejs_SetIterator, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_CONFIGURABLE | EJS_PROP_WRITABLE); #define PROTO_ITER_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS (_ejs_SetIterator_prototype, x, _ejs_SetIterator_prototype_##x, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_WRITABLE | EJS_PROP_CONFIGURABLE) PROTO_ITER_METHOD(next); #undef PROTO_ITER_METHOD }
void _ejs_promise_init(ejsval global) { _ejs_Promise = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Promise, (EJSClosureFunc)_ejs_Promise_impl); _ejs_object_setprop (global, _ejs_atom_Promise, _ejs_Promise); _ejs_gc_add_root (&_ejs_Promise_prototype); _ejs_Promise_prototype = _ejs_object_new(_ejs_null, &_ejs_Object_specops); _ejs_object_setprop (_ejs_Promise, _ejs_atom_prototype, _ejs_Promise_prototype); _ejs_object_define_value_property (_ejs_Promise_prototype, _ejs_atom_constructor, _ejs_Promise, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_CONFIGURABLE | EJS_PROP_WRITABLE); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS (_ejs_Promise_prototype, x, _ejs_Promise_prototype_##x, EJS_PROP_NOT_ENUMERABLE) #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS (_ejs_Promise, x, _ejs_Promise_##x, EJS_PROP_NOT_ENUMERABLE) PROTO_METHOD(catch); PROTO_METHOD(then); _ejs_object_define_value_property (_ejs_Promise_prototype, _ejs_Symbol_toStringTag, _ejs_atom_Promise, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); OBJ_METHOD(all); OBJ_METHOD(race); OBJ_METHOD(reject); OBJ_METHOD(resolve); #undef PROTO_METHOD EJS_INSTALL_SYMBOL_FUNCTION_FLAGS (_ejs_Promise, create, _ejs_Promise_create, EJS_PROP_NOT_ENUMERABLE); _ejs_gc_add_root(&_ejs_identity_function); _ejs_identity_function = _ejs_function_new_anon(_ejs_undefined, identity); _ejs_gc_add_root(&_ejs_thrower_function); _ejs_thrower_function = _ejs_function_new_anon(_ejs_undefined, thrower); }
void GlobalVariable_init (ejsval exports) { _ejs_gc_add_root (&_ejs_GlobalVariable_proto); _ejs_GlobalVariable_proto = _ejs_object_new(_ejs_Object_prototype, &_ejs_Object_specops); _ejs_GlobalVariable = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMGlobalVariable", (EJSClosureFunc)GlobalVariable_impl, _ejs_GlobalVariable_proto); _ejs_object_setprop_utf8 (exports, "GlobalVariable", _ejs_GlobalVariable); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_GlobalVariable_proto, x, GlobalVariable_prototype_##x) PROTO_METHOD(setAlignment); PROTO_METHOD(setInitializer); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef PROTO_METHOD }
void StructType_init (ejsval exports) { _ejs_StructType_proto = _ejs_object_create (Type_get_prototype()); _ejs_StructType = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMStructType", (EJSClosureFunc)StructType_impl, _ejs_StructType_proto); _ejs_object_setprop_utf8 (exports, "StructType", _ejs_StructType); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_StructType, x, StructType_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_StructType_proto, x, StructType_prototype_##x) OBJ_METHOD(create); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef OBJ_METHOD #undef PROTO_METHOD }
void Function_init (ejsval exports) { function_specops = _ejs_Object_specops; function_specops.class_name = "LLVMFunction"; function_specops.allocate = Function_allocate; _ejs_gc_add_root (&_ejs_Function_proto); _ejs_Function_proto = _ejs_object_new(_ejs_Object_prototype, &function_specops); _ejs_Function = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMFunction", (EJSClosureFunc)Function_impl, _ejs_Function_proto); _ejs_object_setprop_utf8 (exports, "Function", _ejs_Function); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Function_proto, x, Function_prototype_##x) #define PROTO_ACCESSOR(x) EJS_INSTALL_ATOM_GETTER(_ejs_Function_proto, x, Function_prototype_get_##x) PROTO_ACCESSOR(args); PROTO_ACCESSOR(argSize); PROTO_ACCESSOR(name); PROTO_ACCESSOR(returnType); PROTO_ACCESSOR(type); PROTO_ACCESSOR(doesNotThrow); PROTO_ACCESSOR(onlyReadsMemory); PROTO_ACCESSOR(doesNotAccessMemory); PROTO_METHOD(dump); PROTO_METHOD(setOnlyReadsMemory); PROTO_METHOD(setDoesNotAccessMemory); PROTO_METHOD(setDoesNotThrow); PROTO_METHOD(setGC); PROTO_METHOD(setExternalLinkage); PROTO_METHOD(setInternalLinkage); PROTO_METHOD(toString); PROTO_METHOD(hasStructRetAttr); PROTO_METHOD(setStructRet); #undef PROTO_METHOD #undef PROTO_ACCESSOR }
void Invoke_init (ejsval exports) { _ejs_Invoke_specops = _ejs_Object_specops; _ejs_Invoke_specops.class_name = "LLVMInvoke"; _ejs_Invoke_specops.Allocate = Invoke_allocate; _ejs_gc_add_root (&_ejs_Invoke_prototype); _ejs_Invoke_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_Invoke_specops); _ejs_Invoke = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMInvoke", (EJSClosureFunc)Invoke_impl, _ejs_Invoke_prototype); _ejs_object_setprop_utf8 (exports, "Invoke", _ejs_Invoke); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Invoke_prototype, x, Invoke_prototype_##x) PROTO_METHOD(setOnlyReadsMemory); PROTO_METHOD(setDoesNotAccessMemory); PROTO_METHOD(setDoesNotThrow); PROTO_METHOD(setStructRet); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef PROTO_METHOD }
void Call_init (ejsval exports) { _ejs_Call_specops = _ejs_Object_specops; _ejs_Call_specops.class_name = "LLVMCall"; _ejs_Call_specops.Allocate = Call_allocate; _ejs_gc_add_root (&_ejs_Call_prototype); _ejs_Call_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_Call_specops); ejsval tmpobj = _ejs_function_new_utf8 (_ejs_null, "LLVMCall", (EJSClosureFunc)Call_impl); _ejs_Call = tmpobj; #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Call_prototype, x, Call_prototype_##x) _ejs_object_setprop (_ejs_Call, _ejs_atom_prototype, _ejs_Call_prototype); PROTO_METHOD(setOnlyReadsMemory); PROTO_METHOD(setDoesNotAccessMemory); PROTO_METHOD(setDoesNotThrow); PROTO_METHOD(setStructRet); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef PROTO_METHOD _ejs_object_setprop_utf8 (exports, "Call", _ejs_Call); }
void FunctionType_init (ejsval exports) { _ejs_gc_add_root (&_ejs_FunctionType_proto); _ejs_FunctionType_proto = _ejs_object_create (Type_get_prototype()); _ejs_FunctionType = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMFunctionType", (EJSClosureFunc)FunctionType_impl, _ejs_FunctionType_proto); _ejs_object_setprop_utf8 (exports, "FunctionType", _ejs_FunctionType); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_FunctionType, x, FunctionType_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_FunctionType_proto, x, FunctionType_prototype_##x) OBJ_METHOD(get); PROTO_METHOD(getReturnType); PROTO_METHOD(getParamType); PROTO_METHOD(dump); PROTO_METHOD(toString); #undef OBJ_METHOD #undef PROTO_METHOD }
void AllocaInst_init (ejsval exports) { allocainst_specops = _ejs_Object_specops; allocainst_specops.class_name = "LLVMAllocaInst"; allocainst_specops.allocate = AllocaInst_allocate; _ejs_gc_add_root (&_ejs_AllocaInst_proto); _ejs_AllocaInst_proto = _ejs_object_new(_ejs_Object_prototype, &allocainst_specops); _ejs_AllocaInst = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMAllocaInst", (EJSClosureFunc)AllocaInst_impl, _ejs_AllocaInst_proto); _ejs_object_setprop_utf8 (exports, "AllocaInst", _ejs_AllocaInst); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_AllocaInst_proto, x, AllocaInst_prototype_##x) PROTO_METHOD(dump); PROTO_METHOD(toString); PROTO_METHOD(setAlignment); #undef PROTO_METHOD }
void _ejs_regexp_init(ejsval global) { _ejs_RegExp = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_RegExp, (EJSClosureFunc)_ejs_RegExp_impl); _ejs_object_setprop (global, _ejs_atom_RegExp, _ejs_RegExp); _ejs_gc_add_root (&_ejs_RegExp_prototype); _ejs_RegExp_prototype = _ejs_object_new(_ejs_null, &_ejs_RegExp_specops); EJSRegExp* re_proto = (EJSRegExp*)EJSVAL_TO_OBJECT(_ejs_RegExp_prototype); re_proto->pattern = _ejs_string_new_utf8("(?:)"); re_proto->flags = _ejs_atom_empty; _ejs_object_setprop (_ejs_RegExp, _ejs_atom_prototype, _ejs_RegExp_prototype); #define OBJ_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_RegExp, x, _ejs_RegExp_##x) #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_RegExp_prototype, x, _ejs_RegExp_prototype_##x) #define PROTO_METHOD_VAL(x) EJS_INSTALL_ATOM_FUNCTION_VAL(_ejs_RegExp_prototype, x, _ejs_RegExp_prototype_##x) #define PROTO_GETTER(x) EJS_INSTALL_ATOM_GETTER(_ejs_RegExp_prototype, x, _ejs_RegExp_prototype_get_##x) _ejs_gc_add_root (&_ejs_RegExp_prototype_exec_closure); _ejs_RegExp_prototype_exec_closure = PROTO_METHOD_VAL(exec); PROTO_METHOD(test); PROTO_METHOD(toString); PROTO_GETTER(global); PROTO_GETTER(ignoreCase); PROTO_GETTER(lastIndex); PROTO_GETTER(multiline); PROTO_GETTER(source); PROTO_GETTER(sticky); PROTO_GETTER(unicode); #undef OBJ_METHOD #undef PROTO_METHOD EJS_INSTALL_SYMBOL_FUNCTION_FLAGS (_ejs_RegExp, create, _ejs_RegExp_create, EJS_PROP_NOT_ENUMERABLE); }
void LandingPad_init (ejsval exports) { _ejs_LandingPad_specops = _ejs_Object_specops; _ejs_LandingPad_specops.class_name = "LLVMLandingPad"; _ejs_LandingPad_specops.allocate = LandingPad_allocate; _ejs_gc_add_root (&_ejs_LandingPad_prototype); _ejs_LandingPad_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_LandingPad_specops); _ejs_LandingPad = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMLandingPad", (EJSClosureFunc)LandingPad_impl, _ejs_LandingPad_prototype); _ejs_object_setprop_utf8 (exports, "LandingPad", _ejs_LandingPad); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_LandingPad_prototype, x, LandingPad_prototype_##x) PROTO_METHOD(dump); PROTO_METHOD(toString); PROTO_METHOD(setCleanup); PROTO_METHOD(addClause); #undef PROTO_METHOD }
void DIFile_init (ejsval exports) { _ejs_DIFile_specops = _ejs_Object_specops; _ejs_DIFile_specops.class_name = "LLVMDIFile"; _ejs_DIFile_specops.Allocate = DIFile_allocate; _ejs_gc_add_root (&_ejs_DIFile_prototype); _ejs_DIFile_prototype = _ejs_object_create(_ejs_Object_prototype); _ejs_DIFile = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMDIFile", (EJSClosureFunc)DIFile_impl, _ejs_DIFile_prototype); _ejs_object_setprop_utf8 (exports, "DIFile", _ejs_DIFile); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_DIFile_prototype, x, DIFile_prototype_##x) PROTO_METHOD(verify); #undef PROTO_METHOD }
void _ejs_typedarrays_init(ejsval global) { #define OBJ_METHOD(t,x) EJS_INSTALL_ATOM_FUNCTION(_ejs_##t, x, _ejs_##t##_##x) #define PROTO_METHOD(t,x) EJS_INSTALL_ATOM_FUNCTION(_ejs_##t##_prototype, x, _ejs_##t##_prototype_##x) #define PROTO_METHOD_IMPL(t,x) EJS_INSTALL_ATOM_FUNCTION(_ejs_##t##_prototype, x, _ejs_##t##_prototype_##x##_impl) #define PROTO_GETTER(t,x) EJS_INSTALL_SYMBOL_GETTER(_ejs_##t##_prototype, x, _ejs_##t##_prototype_get_##x) // ArrayBuffer { _ejs_ArrayBuffer = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_ArrayBuffer, (EJSClosureFunc)_ejs_ArrayBuffer_impl); _ejs_object_setprop (global, _ejs_atom_ArrayBuffer, _ejs_ArrayBuffer); _ejs_gc_add_root (&_ejs_ArrayBuffer_prototype); _ejs_ArrayBuffer_prototype = _ejs_object_new(_ejs_null, &_ejs_Object_specops); _ejs_object_setprop (_ejs_ArrayBuffer, _ejs_atom_prototype, _ejs_ArrayBuffer_prototype); PROTO_METHOD(ArrayBuffer, slice); _ejs_object_define_value_property (_ejs_ArrayBuffer_prototype, _ejs_Symbol_toStringTag, _ejs_atom_ArrayBuffer, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); } // DataView { _ejs_DataView = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_DataView, (EJSClosureFunc)_ejs_DataView_impl); _ejs_object_setprop (global, _ejs_atom_DataView, _ejs_DataView); _ejs_gc_add_root (&_ejs_DataView_prototype); _ejs_DataView_prototype = _ejs_object_new (_ejs_null, &_ejs_Object_specops); _ejs_object_setprop (_ejs_DataView, _ejs_atom_prototype, _ejs_DataView_prototype); PROTO_METHOD_IMPL(DataView, getInt8); PROTO_METHOD_IMPL(DataView, setInt8); PROTO_METHOD_IMPL(DataView, getInt16); PROTO_METHOD_IMPL(DataView, setInt16); PROTO_METHOD_IMPL(DataView, getInt32); PROTO_METHOD_IMPL(DataView, setInt32); PROTO_METHOD_IMPL(DataView, getFloat32); PROTO_METHOD_IMPL(DataView, setFloat32); PROTO_METHOD_IMPL(DataView, getFloat64); PROTO_METHOD_IMPL(DataView, setFloat64); _ejs_object_define_value_property (_ejs_DataView_prototype, _ejs_Symbol_toStringTag, _ejs_atom_DataView, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_WRITABLE | EJS_PROP_CONFIGURABLE); } #define ADD_TYPEDARRAY(EnumType, ArrayType, arraytype, elementSizeInBytes) EJS_MACRO_START \ _ejs_##ArrayType##Array = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_##ArrayType##Array, (EJSClosureFunc)_ejs_##ArrayType##Array_impl); \ _ejs_object_setprop (global, _ejs_atom_##ArrayType##Array, _ejs_##ArrayType##Array); \ \ _ejs_gc_add_root (&_ejs_##ArrayType##Array_prototype); \ _ejs_##ArrayType##Array_prototype = _ejs_object_new(_ejs_null, &_ejs_Object_specops); \ _ejs_object_setprop (_ejs_##ArrayType##Array, _ejs_atom_prototype, _ejs_##ArrayType##Array_prototype); \ \ /* make sure ctor.BYTES_PER_ELEMENT is defined */ \ _ejs_object_define_value_property (_ejs_##ArrayType##Array, _ejs_atom_BYTES_PER_ELEMENT, NUMBER_TO_EJSVAL(elementSizeInBytes), EJS_PROP_FLAGS_ENUMERABLE); \ \ _ejs_typed_array_elsizes[EJS_TYPEDARRAY_##EnumType] = elementSizeInBytes; \ _ejs_typed_array_protos[EJS_TYPEDARRAY_##EnumType] = _ejs_##ArrayType##Array_prototype; \ _ejs_typed_array_specops[EJS_TYPEDARRAY_##EnumType] = &_ejs_##arraytype##array_specops; \ \ PROTO_METHOD_IMPL(ArrayType##Array, get); \ PROTO_METHOD_IMPL(ArrayType##Array, set); \ PROTO_METHOD_IMPL(ArrayType##Array, subarray); \ PROTO_GETTER(ArrayType##Array, toStringTag); /* XXX needs to be enumerable: false, configurable: true */ \ EJS_MACRO_END ADD_TYPEDARRAY(INT8, Int8, int8, 1); ADD_TYPEDARRAY(UINT8, Uint8, uint8, 1); //ADD_TYPEDARRAY(UINT8CLAMPED, Uint8Clamped, uint8clamped, 1); ADD_TYPEDARRAY(INT16, Int16, int16, 2); ADD_TYPEDARRAY(UINT16, Uint16, uint16, 2); ADD_TYPEDARRAY(INT32, Int32, int32, 4); ADD_TYPEDARRAY(UINT32, Uint32, uint32, 4); ADD_TYPEDARRAY(FLOAT32, Float32, float32, 4); ADD_TYPEDARRAY(FLOAT64, Float64, float64, 8); }
void Module_init (ejsval exports) { _ejs_Module_specops = _ejs_Object_specops; _ejs_Module_specops.class_name = "LLVMModule"; _ejs_Module_specops.Allocate = Module_allocate; _ejs_Module_specops.Finalize = Module_finalize; _ejs_gc_add_root (&_ejs_Module_prototype); _ejs_Module_prototype = _ejs_object_new(_ejs_Object_prototype, &_ejs_Module_specops); _ejs_Module = _ejs_function_new_utf8_with_proto (_ejs_null, "LLVMModule", (EJSClosureFunc)Module_impl, _ejs_Module_prototype); _ejs_object_setprop_utf8 (exports, "Module", _ejs_Module); #define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION(_ejs_Module_prototype, x, Module_prototype_##x) PROTO_METHOD(getGlobalVariable); PROTO_METHOD(getOrInsertIntrinsic); PROTO_METHOD(getOrInsertFunction); PROTO_METHOD(getOrInsertGlobal); PROTO_METHOD(getOrInsertExternalFunction); PROTO_METHOD(getFunction); PROTO_METHOD(dump); PROTO_METHOD(toString); PROTO_METHOD(writeToFile); PROTO_METHOD(writeBitcodeToFile); PROTO_METHOD(setDataLayout); PROTO_METHOD(setTriple); #undef PROTO_METHOD EJS_INSTALL_SYMBOL_FUNCTION_FLAGS (_ejs_Module, create, Module_create, EJS_PROP_NOT_ENUMERABLE); }