@@ -308,9 +308,9 @@ proc JS_NewRuntime2*(mf: ptr JSMallocFunctions; opaque: pointer): JSRuntime {.
308308 importc , header : headerquickjs.}
309309proc JS_FreeRuntime * (rt: JSRuntime ) {.importc , header : headerquickjs.}
310310type
311- JS_MarkFunc* = proc (rt: JSRuntime ; val: JSValue ): void
311+ JS_MarkFunc* = proc (rt: JSRuntime ; val: JSValue ) {. cdecl .}
312312
313- proc JS_MarkValue * (rt: JSRuntime ; val: JSValue ; mark_func: ptr JS_MarkFunc) {.
313+ proc JS_MarkValue * (rt: JSRuntime ; val: JSValue ; mark_func: JS_MarkFunc) {.
314314 importc , header : headerquickjs.}
315315proc JS_RunGC * (rt: JSRuntime ) {.importc , header : headerquickjs.}
316316proc JS_IsLiveObject * (rt: JSRuntime ; obj: JSValue ): int32 {.
@@ -437,47 +437,46 @@ type
437437 getter* {.importc : " getter" .}: JSValue
438438 setter* {.importc : " setter" .}: JSValue
439439
440- JSClassExoticMethods * {.importc , header : headerquickjs,
441- bycopy .} = object
442- get_own_property* {.importc : " get_own_property" .}: proc (ctx: JSContext ;
440+ JSClassExoticMethods * {.bycopy .} = object
441+ get_own_property* : proc (ctx: JSContext ;
443442 desc: ptr JSPropertyDescriptor ; obj: JSValue ; prop: JSAtom ): int32 # # Return -1 if exception (can only happen in case of Proxy object),
444443 # # FALSE if the property does not exists, TRUE if it exists. If 1 is
445444 # # returned, the property descriptor 'desc' is filled if != NULL.
446445 # # '*ptab' should hold the '*plen' property keys. Return 0 if OK,
447446 # # -1 if exception. The 'is_enumerable' field is ignored.
448447 # #
449- get_own_property_names* {. importc : " get_own_property_names " .} : proc (
448+ get_own_property_names* : proc (
450449 ctx: JSContext ; ptab: ptr ptr JSPropertyEnum ; plen: ptr uint32 ; obj: JSValue ): int32 # # return < 0 if exception, or TRUE/FALSE
451- delete_property* {. importc : " delete_property " .} : proc (ctx: JSContext ;
450+ delete_property* : proc (ctx: JSContext ;
452451 obj: JSValue ; prop: JSAtom ): int32 # # return < 0 if exception or TRUE/FALSE
453- define_own_property* {. importc : " define_own_property " .} : proc (
452+ define_own_property* : proc (
454453 ctx: JSContext ; this_obj: JSValue ; prop: JSAtom ; val: JSValue ;
455454 getter: JSValue ; setter: JSValue ; flags: int32 ): int32 # # The following methods can be emulated with the previous ones,
456455 # # so they are usually not needed
457456 # # return < 0 if exception or TRUE/FALSE
458- has_property* {. importc : " has_property " .} : proc (ctx: JSContext ; obj: JSValue ;
457+ has_property* : proc (ctx: JSContext ; obj: JSValue ;
459458 atom: JSAtom ): int32
460- get_property* {. importc : " get_property " .} : proc (ctx: JSContext ; obj: JSValue ;
459+ get_property* : proc (ctx: JSContext ; obj: JSValue ;
461460 atom: JSAtom ; receiver: JSValue ): JSValue # # return < 0 if exception or TRUE/FALSE
462- set_property* {. importc : " set_property " .} : proc (ctx: JSContext ; obj: JSValue ;
461+ set_property* : proc (ctx: JSContext ; obj: JSValue ;
463462 atom: JSAtom ; value: JSValue ; receiver: JSValue ; flags: int32 ): int32
464463
465- JSClassFinalizer * = proc (rt: JSRuntime ; val: JSValue ): void {.cdecl .}
466- JSClassGCMark * = proc (rt: JSRuntime ; val: JSValue ; mark_func: ptr JS_MarkFunc): void {.cdecl .}
464+ JSClassFinalizer * = proc (rt: JSRuntime ; val: JSValue ) {.cdecl .}
465+ JSClassGCMark * = proc (rt: JSRuntime ; val: JSValue ; mark_func: JS_MarkFunc) {.cdecl .}
467466 JSClassCall * = proc (ctx: JSContext ; func_obj: JSValue ; this_val: JSValue ;
468467 argc: int32 ; argv: ptr UncheckedArray [JSValue ]): JSValue {.cdecl .}
469- JSClassDef * {.importc , header : headerquickjs, bycopy .} = object
470- class_name* {. importc : " class_name " .} : cstring
471- finalizer* {. importc : " finalizer " .} : JSClassFinalizer
472- gc_mark* {. importc : " gc_mark " .} : JSClassGCMark
473- call* {. importc : " call " .} : JSClassCall # # XXX: suppress this indirection ? It is here only to save memory
468+ JSClassDef * {.bycopy .} = object
469+ class_name* : cstring
470+ finalizer* : JSClassFinalizer
471+ gc_mark* : JSClassGCMark
472+ call* : JSClassCall # # XXX: suppress this indirection ? It is here only to save memory
474473 # # because only a few classes need these methods
475- exotic* {. importc : " exotic " .} : JSClassExoticMethods
474+ exotic* : JSClassExoticMethods
476475
477- proc JS_NewClassID * (pclass_id: JSClassID ): JSClassID {.importc , header : headerquickjs.}
478- proc JS_NewClass * (rt: JSRuntime ; class_id: JSClassID ; class_def: JSClassDef ): int32 {.
476+ proc JS_NewClassID * (pclass_id: ptr JSClassID ): JSClassID {.importc , header : headerquickjs.}
477+ proc JS_NewClass * (rt: JSRuntime ; class_id: JSClassID ; class_def: ptr JSClassDef ): int32 {.
479478 importc , header : headerquickjs.}
480- proc JS_IsRegisteredClass * (rt: JSRuntime ; class_id: JSClassID ): int32 {.
479+ proc JS_IsRegisteredClass * (rt: JSRuntime ; class_id: JSClassID ): bool {.
481480 importc , header : headerquickjs.}
482481# # value handling
483482
@@ -561,7 +560,7 @@ proc JS_ToCString*(ctx: JSContext; val1: JSValue): cstring {.
561560proc JS_FreeCString * (ctx: JSContext ; `ptr`: cstring ) {.importc , header : headerquickjs.}
562561proc JS_NewObjectProtoClass * (ctx: JSContext ; proto: JSValue ; class_id: JSClassID ): JSValue {.
563562 importc , header : headerquickjs.}
564- proc JS_NewObjectClass * (ctx: JSContext ; class_id: int32 ): JSValue {.
563+ proc JS_NewObjectClass * (ctx: JSContext ; class_id: JSClassID ): JSValue {.
565564 importc , header : headerquickjs.}
566565proc JS_NewObjectProto * (ctx: JSContext ; proto: JSValue ): JSValue {.
567566 importc , header : headerquickjs.}
@@ -718,16 +717,16 @@ proc JS_EvalFunction*(ctx: JSContext; fun_obj: JSValue): JSValue {.
718717 importc , header : headerquickjs.}
719718
720719# # C function definition
721- proc JS_NewCFunction2 * (ctx: JSContext ; `func` : JSCFunction ; name: cstring ;
720+ proc JS_NewCFunction2 * (ctx: JSContext ; fn : JSCFunction ; name: cstring ;
722721 length: int32 ; cproto: JSCFunctionEnum ; magic: int32 ): JSValue {.
723722 importc , header : headerquickjs.}
724- proc JS_NewCFunctionData * (ctx: JSContext ; `func` : ptr JSCFunctionData ;
723+ proc JS_NewCFunctionData * (ctx: JSContext ; fn : ptr JSCFunctionData ;
725724 length: int32 ; magic: int32 ; data_len: int32 ; data: ptr JSValue ): JSValue {.
726725 importc , header : headerquickjs.}
727- proc JS_NewCFunction * (ctx: JSContext ; `func` : JSCFunction ; name: cstring ;
726+ proc JS_NewCFunction * (ctx: JSContext ; fn : JSCFunction ; name: cstring ;
728727 length: int32 ): JSValue {.importc , header : headerquickjs.}
729728
730- proc JS_NewCFunctionMagic * (ctx: JSContext ; `func` : ptr JSCFunctionMagic ;
729+ proc JS_NewCFunctionMagic * (ctx: JSContext ; fn : ptr JSCFunctionMagic ;
731730 name: cstring ; length: int32 ; cproto: JSCFunctionEnum ;
732731 magic: int32 ): JSValue {.importc , header : headerquickjs.}
733732
@@ -741,19 +740,18 @@ type
741740 JSModuleInitFunc * = proc (ctx: JSContext ; m: JSModuleDef ): int32 {.cdecl .}
742741
743742proc JS_NewCModule * (ctx: JSContext ; name_str: cstring ;
744- fn: JSModuleInitFunc ): JSModuleDef {.
745- importc , header : headerquickjs.}
743+ fn: JSModuleInitFunc ): JSModuleDef {.importc , header : headerquickjs.}
746744# # can only be called before the module is instantiated
747745
748- proc JS_AddModuleExport * (ctx: JSContext ; m: JSModuleDef ; name_str: cstring ): int32 {.
749- importc , header : headerquickjs.}
746+ proc JS_AddModuleExport * (ctx: JSContext ; m: JSModuleDef ; name_str: cstring ): int32 {.importc , header : headerquickjs.}
750747proc JS_AddModuleExportList * (ctx: JSContext ; m: JSModuleDef ;
751- tab: ptr JSCFunctionListEntry ; len: int32 ): int32 {.
752- importc , header : headerquickjs.}
748+ tab: ptr JSCFunctionListEntry ; len: int32 ): int32 {.importc , header : headerquickjs.}
753749# # can only be called after the module is instantiated
754750
755751proc JS_SetModuleExport * (ctx: JSContext ; m: JSModuleDef ; export_name: cstring ;
756752 val: JSValue ): int32 {.importc , header : headerquickjs.}
757753proc JS_SetModuleExportList * (ctx: JSContext ; m: JSModuleDef ;
758- tab: ptr JSCFunctionListEntry ; len: int32 ): int32 {.
759- importc , header : headerquickjs.}
754+ tab: ptr JSCFunctionListEntry ; len: int32 ): int32 {.importc , header : headerquickjs.}
755+
756+
757+ proc JS_SetConstructor * (ctx: JSContext , func_obj: JSValueConst , proto: JSValueConst ) {.importc , header : headerquickjs.}
0 commit comments