@@ -10,61 +10,67 @@ struct js_bind {
1010 static void bind (qjs::Context::Module &mod) {}
1111};
1212
13+ template <> struct qjs ::js_traits<chromatic::js::NativePointer> {
14+ static chromatic::js::NativePointer unwrap (JSContext *ctx, JSValueConst v) {
15+ chromatic::js::NativePointer obj;
16+
17+ return obj;
18+ }
19+
20+ static JSValue wrap (JSContext *ctx, const chromatic::js::NativePointer &val) noexcept {
21+ JSValue obj = JS_NewObject (ctx);
22+
23+ return obj;
24+ }
25+ };
1326template <> struct js_bind <chromatic::js::NativePointer> {
1427 static void bind (qjs::Context::Module &mod) {
15- using NP = chromatic::js::NativePointer;
16- mod.class_ <NP >(" NativePointer" )
28+ mod.class_ <chromatic::js::NativePointer>(" NativePointer" )
1729 .constructor <uint64_t >()
18- // .constructor<std::string>()
19- // Conversion
20- .fun <&NP ::toString>(" toString" )
21- .fun <&NP ::toInt32>(" toInt32" )
22- .fun <&NP ::toUInt32>(" toUInt32" )
23- .fun <&NP ::toNumber>(" toNumber" )
24- .fun <&NP ::value>(" value" )
25- // Comparison
26- .fun <&NP ::isNull>(" isNull" )
27- .fun <&NP ::equals>(" equals" )
28- .fun <&NP ::compare>(" compare" )
29- // Arithmetic
30- .fun <&NP ::add>(" add" )
31- .fun <&NP ::sub>(" sub" )
32- .fun <&NP ::and_>(" and" )
33- .fun <&NP ::or_>(" or" )
34- .fun <&NP ::xor_>(" xor" )
35- .fun <&NP ::shr>(" shr" )
36- .fun <&NP ::shl>(" shl" )
37- .fun <&NP ::not_>(" not" )
38- // Memory Read
39- .fun <&NP ::readU8>(" readU8" )
40- .fun <&NP ::readS8>(" readS8" )
41- .fun <&NP ::readU16>(" readU16" )
42- .fun <&NP ::readS16>(" readS16" )
43- .fun <&NP ::readU32>(" readU32" )
44- .fun <&NP ::readS32>(" readS32" )
45- .fun <&NP ::readU64>(" readU64" )
46- .fun <&NP ::readS64>(" readS64" )
47- .fun <&NP ::readFloat>(" readFloat" )
48- .fun <&NP ::readDouble>(" readDouble" )
49- .fun <&NP ::readPointer>(" readPointer" )
50- .fun <&NP ::readByteArray>(" readByteArray" )
51- .fun <&NP ::readCString>(" readCString" )
52- .fun <&NP ::readUtf8String>(" readUtf8String" )
53- // Memory Write
54- .fun <&NP ::writeU8>(" writeU8" )
55- .fun <&NP ::writeS8>(" writeS8" )
56- .fun <&NP ::writeU16>(" writeU16" )
57- .fun <&NP ::writeS16>(" writeS16" )
58- .fun <&NP ::writeU32>(" writeU32" )
59- .fun <&NP ::writeS32>(" writeS32" )
60- .fun <&NP ::writeU64>(" writeU64" )
61- .fun <&NP ::writeS64>(" writeS64" )
62- .fun <&NP ::writeFloat>(" writeFloat" )
63- .fun <&NP ::writeDouble>(" writeDouble" )
64- .fun <&NP ::writePointer>(" writePointer" )
65- .fun <&NP ::writeByteArray>(" writeByteArray" )
66- .fun <&NP ::writeUtf8String>(" writeUtf8String" )
67- ;
30+ .fun <&chromatic::js::NativePointer::value>(" value" )
31+ .fun <&chromatic::js::NativePointer::toString>(" toString" )
32+ .fun <&chromatic::js::NativePointer::toInt32>(" toInt32" )
33+ .fun <&chromatic::js::NativePointer::toUInt32>(" toUInt32" )
34+ .fun <&chromatic::js::NativePointer::toNumber>(" toNumber" )
35+ .fun <&chromatic::js::NativePointer::isNull>(" isNull" )
36+ .fun <&chromatic::js::NativePointer::equals>(" equals" )
37+ .fun <&chromatic::js::NativePointer::compare>(" compare" )
38+ .fun <&chromatic::js::NativePointer::add>(" add" )
39+ .fun <&chromatic::js::NativePointer::sub>(" sub" )
40+ .fun <&chromatic::js::NativePointer::bitwiseAnd>(" bitwiseAnd" )
41+ .fun <&chromatic::js::NativePointer::bitwiseOr>(" bitwiseOr" )
42+ .fun <&chromatic::js::NativePointer::bitwiseXor>(" bitwiseXor" )
43+ .fun <&chromatic::js::NativePointer::shr>(" shr" )
44+ .fun <&chromatic::js::NativePointer::shl>(" shl" )
45+ .fun <&chromatic::js::NativePointer::bitwiseNot>(" bitwiseNot" )
46+ .fun <&chromatic::js::NativePointer::readU8>(" readU8" )
47+ .fun <&chromatic::js::NativePointer::readS8>(" readS8" )
48+ .fun <&chromatic::js::NativePointer::readU16>(" readU16" )
49+ .fun <&chromatic::js::NativePointer::readS16>(" readS16" )
50+ .fun <&chromatic::js::NativePointer::readU32>(" readU32" )
51+ .fun <&chromatic::js::NativePointer::readS32>(" readS32" )
52+ .fun <&chromatic::js::NativePointer::readU64>(" readU64" )
53+ .fun <&chromatic::js::NativePointer::readS64>(" readS64" )
54+ .fun <&chromatic::js::NativePointer::readFloat>(" readFloat" )
55+ .fun <&chromatic::js::NativePointer::readDouble>(" readDouble" )
56+ .fun <&chromatic::js::NativePointer::readPointer>(" readPointer" )
57+ .fun <&chromatic::js::NativePointer::readByteArray>(" readByteArray" )
58+ .fun <&chromatic::js::NativePointer::readCString>(" readCString" )
59+ .fun <&chromatic::js::NativePointer::readUtf8String>(" readUtf8String" )
60+ .fun <&chromatic::js::NativePointer::writeU8>(" writeU8" )
61+ .fun <&chromatic::js::NativePointer::writeS8>(" writeS8" )
62+ .fun <&chromatic::js::NativePointer::writeU16>(" writeU16" )
63+ .fun <&chromatic::js::NativePointer::writeS16>(" writeS16" )
64+ .fun <&chromatic::js::NativePointer::writeU32>(" writeU32" )
65+ .fun <&chromatic::js::NativePointer::writeS32>(" writeS32" )
66+ .fun <&chromatic::js::NativePointer::writeU64>(" writeU64" )
67+ .fun <&chromatic::js::NativePointer::writeS64>(" writeS64" )
68+ .fun <&chromatic::js::NativePointer::writeFloat>(" writeFloat" )
69+ .fun <&chromatic::js::NativePointer::writeDouble>(" writeDouble" )
70+ .fun <&chromatic::js::NativePointer::writePointer>(" writePointer" )
71+ .fun <&chromatic::js::NativePointer::writeByteArray>(" writeByteArray" )
72+ .fun <&chromatic::js::NativePointer::writeUtf8String>(" writeUtf8String" )
73+ ;
6874 }
6975};
7076
@@ -184,7 +190,7 @@ template <> struct qjs::js_traits<chromatic::js::InstructionInfo> {
184190template <> struct js_bind <chromatic::js::InstructionInfo> {
185191 static void bind (qjs::Context::Module &mod) {
186192 mod.class_ <chromatic::js::InstructionInfo>(" InstructionInfo" )
187- .constructor <>()
193+ .constructor <chromatic::js::InstructionInfo >()
188194 .fun <&chromatic::js::InstructionInfo::mnemonic>(" mnemonic" )
189195 .fun <&chromatic::js::InstructionInfo::opStr>(" opStr" )
190196 .fun <&chromatic::js::InstructionInfo::size>(" size" )
@@ -237,7 +243,7 @@ template <> struct qjs::js_traits<chromatic::js::InstructionAnalysis> {
237243template <> struct js_bind <chromatic::js::InstructionAnalysis> {
238244 static void bind (qjs::Context::Module &mod) {
239245 mod.class_ <chromatic::js::InstructionAnalysis>(" InstructionAnalysis" )
240- .constructor <>()
246+ .constructor <chromatic::js::InstructionAnalysis >()
241247 .fun <&chromatic::js::InstructionAnalysis::isBranch>(" isBranch" )
242248 .fun <&chromatic::js::InstructionAnalysis::isCall>(" isCall" )
243249 .fun <&chromatic::js::InstructionAnalysis::isRelative>(" isRelative" )
@@ -276,7 +282,7 @@ template <> struct qjs::js_traits<chromatic::js::XrefResult> {
276282template <> struct js_bind <chromatic::js::XrefResult> {
277283 static void bind (qjs::Context::Module &mod) {
278284 mod.class_ <chromatic::js::XrefResult>(" XrefResult" )
279- .constructor <>()
285+ .constructor <chromatic::js::XrefResult >()
280286 .fun <&chromatic::js::XrefResult::address>(" address" )
281287 .fun <&chromatic::js::XrefResult::type>(" type" )
282288 .fun <&chromatic::js::XrefResult::size>(" size" )
@@ -505,7 +511,7 @@ template <> struct qjs::js_traits<chromatic::js::ScanMatch> {
505511template <> struct js_bind <chromatic::js::ScanMatch> {
506512 static void bind (qjs::Context::Module &mod) {
507513 mod.class_ <chromatic::js::ScanMatch>(" ScanMatch" )
508- .constructor <>()
514+ .constructor <chromatic::js::ScanMatch >()
509515 .fun <&chromatic::js::ScanMatch::address>(" address" )
510516 .fun <&chromatic::js::ScanMatch::size>(" size" )
511517 ;
@@ -578,7 +584,7 @@ template <> struct qjs::js_traits<chromatic::js::MemoryAccessDetails> {
578584template <> struct js_bind <chromatic::js::MemoryAccessDetails> {
579585 static void bind (qjs::Context::Module &mod) {
580586 mod.class_ <chromatic::js::MemoryAccessDetails>(" MemoryAccessDetails" )
581- .constructor <>()
587+ .constructor <chromatic::js::MemoryAccessDetails >()
582588 .fun <&chromatic::js::MemoryAccessDetails::address>(" address" )
583589 .fun <&chromatic::js::MemoryAccessDetails::pageBase>(" pageBase" )
584590 .fun <&chromatic::js::MemoryAccessDetails::operation>(" operation" )
@@ -679,7 +685,7 @@ template <> struct qjs::js_traits<chromatic::js::ModuleInfo> {
679685template <> struct js_bind <chromatic::js::ModuleInfo> {
680686 static void bind (qjs::Context::Module &mod) {
681687 mod.class_ <chromatic::js::ModuleInfo>(" ModuleInfo" )
682- .constructor <>()
688+ .constructor <chromatic::js::ModuleInfo >()
683689 .fun <&chromatic::js::ModuleInfo::name>(" name" )
684690 .fun <&chromatic::js::ModuleInfo::base>(" base" )
685691 .fun <&chromatic::js::ModuleInfo::size>(" size" )
@@ -721,7 +727,7 @@ template <> struct qjs::js_traits<chromatic::js::RangeInfo> {
721727template <> struct js_bind <chromatic::js::RangeInfo> {
722728 static void bind (qjs::Context::Module &mod) {
723729 mod.class_ <chromatic::js::RangeInfo>(" RangeInfo" )
724- .constructor <>()
730+ .constructor <chromatic::js::RangeInfo >()
725731 .fun <&chromatic::js::RangeInfo::base>(" base" )
726732 .fun <&chromatic::js::RangeInfo::size>(" size" )
727733 .fun <&chromatic::js::RangeInfo::protection>(" protection" )
@@ -758,7 +764,7 @@ template <> struct qjs::js_traits<chromatic::js::ExportInfo> {
758764template <> struct js_bind <chromatic::js::ExportInfo> {
759765 static void bind (qjs::Context::Module &mod) {
760766 mod.class_ <chromatic::js::ExportInfo>(" ExportInfo" )
761- .constructor <>()
767+ .constructor <chromatic::js::ExportInfo >()
762768 .fun <&chromatic::js::ExportInfo::type>(" type" )
763769 .fun <&chromatic::js::ExportInfo::name>(" name" )
764770 .fun <&chromatic::js::ExportInfo::address>(" address" )
0 commit comments