3232{ $IfDef FPC}
3333 { $IfNDef windows}
3434 { $LinkLib 'libquickjs.a'}
35+ // {$LinkLib 'libquickjs.lto.a'} { Faster Code - Link Time Optimization - Slow Compiling }
3536 { $EndIf}
3637{ $EndIf}
3738
38- (* Faster Code - Link Time Optimization - Slow Compiling *)
39- // {'libquickjs.lto.a'}
4039
41- // {'libquickjs.bn.a'} {$Define BIGNUM} // BigNumbers support.
42-
43- (* Faster Code - BigNumbers support + Link Time Optimization - Slow Compiling *)
44- // {'libquickjs.bn.lto.a'}
4540
4641{ $IfDef FPC}
4742 { $IfNDef CPU64}
@@ -128,8 +123,8 @@ interface
128123 JS_EVAL_TYPE_INDIRECT = (3 shl 0 ); { indirect call (internal use) }
129124 JS_EVAL_TYPE_MASK = (3 shl 0 );
130125
131- JS_EVAL_FLAG_STRICT = (1 shl 3 ); { force 'strict' mode }
132- JS_EVAL_FLAG_STRIP = (1 shl 4 ); { force 'strip' mode }
126+ JS_EVAL_FLAG_STRICT = (1 shl 3 ); { force 'strict' mode }
127+ JS_EVAL_FLAG_STRIP = (1 shl 4 ); { force 'strip' mode }
133128 (*
134129 compile but do not run. The result is an object with a
135130 JS_TAG_FUNCTION_BYTECODE or JS_TAG_MODULE tag. It can be executed
@@ -148,33 +143,33 @@ interface
148143 JS_READ_OBJ_ROM_DATA = (1 shl 1 ); { avoid duplicating 'buf' data }
149144
150145 { C property definition }
151- JS_DEF_CFUNC = 0 ;
152- JS_DEF_CGETSET = 1 ;
153- JS_DEF_CGETSET_MAGIC = 2 ;
154- JS_DEF_PROP_STRING = 3 ;
155- JS_DEF_PROP_INT32 = 4 ;
156- JS_DEF_PROP_INT64 = 5 ;
157- JS_DEF_PROP_DOUBLE = 6 ;
158- JS_DEF_PROP_UNDEFINED = 7 ;
159- JS_DEF_OBJECT = 8 ;
160- JS_DEF_ALIAS = 9 ;
146+ JS_DEF_CFUNC = 0 ;
147+ JS_DEF_CGETSET = 1 ;
148+ JS_DEF_CGETSET_MAGIC = 2 ;
149+ JS_DEF_PROP_STRING = 3 ;
150+ JS_DEF_PROP_INT32 = 4 ;
151+ JS_DEF_PROP_INT64 = 5 ;
152+ JS_DEF_PROP_DOUBLE = 6 ;
153+ JS_DEF_PROP_UNDEFINED = 7 ;
154+ JS_DEF_OBJECT = 8 ;
155+ JS_DEF_ALIAS = 9 ;
161156
162157
163158 { C function definition }
164159 { JSCFunctionEnum }
165- JS_CFUNC_generic = 0 ;
166- JS_CFUNC_generic_magic = 1 ;
167- JS_CFUNC_constructor = 2 ;
168- JS_CFUNC_constructor_magic = 3 ;
169- JS_CFUNC_constructor_or_func = 4 ;
160+ JS_CFUNC_generic = 0 ;
161+ JS_CFUNC_generic_magic = 1 ;
162+ JS_CFUNC_constructor = 2 ;
163+ JS_CFUNC_constructor_magic = 3 ;
164+ JS_CFUNC_constructor_or_func = 4 ;
170165 JS_CFUNC_constructor_or_func_magic = 5 ;
171- JS_CFUNC_f_f = 6 ;
172- JS_CFUNC_f_f_f = 7 ;
173- JS_CFUNC_getter = 8 ;
174- JS_CFUNC_setter = 9 ;
175- JS_CFUNC_getter_magic = 10 ;
176- JS_CFUNC_setter_magic = 11 ;
177- JS_CFUNC_iterator_next = 12 ;
166+ JS_CFUNC_f_f = 6 ;
167+ JS_CFUNC_f_f_f = 7 ;
168+ JS_CFUNC_getter = 8 ;
169+ JS_CFUNC_setter = 9 ;
170+ JS_CFUNC_getter_magic = 10 ;
171+ JS_CFUNC_setter_magic = 11 ;
172+ JS_CFUNC_iterator_next = 12 ;
178173
179174 JS_GPN_STRING_MASK = (1 shl 0 );
180175 JS_GPN_SYMBOL_MASK = (1 shl 1 );
@@ -183,7 +178,7 @@ interface
183178 { only include the enumerable properties }
184179 JS_GPN_ENUM_ONLY = (1 shl 4 );
185180 { set theJSPropertyEnum.is_enumerable field }
186- JS_GPN_SET_ENUM = (1 shl 5 );
181+ JS_GPN_SET_ENUM = (1 shl 5 );
187182
188183 { C Call Flags }
189184
@@ -195,30 +190,29 @@ interface
195190 { $IFNDEF FPC}
196191 // Delphi Compatible.
197192 // Anything under XE4.
198- { $IF (CompilerVersion <= 25)}
199- type
200- PUint32 = ^Uint32; // PUint32 not defined in XE4 - Fix by @edwinyzh
201- { $IFEND}
202- pUInt8 = PByte;
203- pInt8 = PShortInt;
204- pInt16 = PSmallint;
205- PInt32 = PLongint;
193+ { $IF (CompilerVersion <= 25)}
194+ PUint32 = ^Uint32; // PUint32 not defined in XE4 - Fix by @edwinyzh
195+ { $IFEND}
196+ pUInt8 = PByte;
197+ pInt8 = PShortInt;
198+ pInt16 = PSmallint;
199+ PInt32 = PLongint;
206200 { $ENDIF}
207201 { $ifdef cpu64}
208- size_t = qword ;
202+ size_t = QWord ;
209203 psize_t = ^size_t;
210204 { $else}
211- size_t = cardinal ;
205+ size_t = Cardinal ;
212206 psize_t = ^size_t;
213207 { $endif}
214208
215- JS_BOOL = Boolean;
209+ JS_BOOL = Boolean;
216210 JSRuntime = Pointer;
217211
218212 PPJSContext = ^_PJSContext; // Pointer to Pointer.
219213 _PJSContext = ^_JSContext;
220- _JSContext = record end ; // Empty record to mimic the JSContext.
221- JSContext = Pointer;
214+ _JSContext = record end ; // Empty record to mimic the JSContext.
215+ JSContext = Pointer;
222216
223217 JSObject = Pointer;
224218 JSClass = Pointer;
@@ -243,16 +237,15 @@ JSRefCountHeader = record
243237 end ;
244238
245239{ $If Defined(JS_NAN_BOXING)}
246- JSValue = UInt64;
247- PJSValue = ^JSValue;
248-
249- JSValueConst = JSValue;
250- PJSValueConst = ^JSValueConst;
251- JSValueConstArr = array [0 ..(MaxInt div SizeOf(JSValueConst))-1 ] of JSValueConst;
240+ JSValue = UInt64;
241+ PJSValue = ^JSValue;
242+ JSValueConst = JSValue;
243+ PJSValueConst = ^JSValueConst;
244+ JSValueConstArr = array [0 ..(MaxInt div SizeOf(JSValueConst))-1 ] of JSValueConst;
252245 PJSValueConstArr = ^JSValueConstArr;
253246const
254247 JS_FLOAT64_TAG_ADDEND = $7ff80000 - JS_TAG_FIRST + 1 ; // quiet NaN encoding
255- JS_NAN = ($7ff8000000000000 - (JS_FLOAT64_TAG_ADDEND shl 32 ));
248+ JS_NAN = ($7ff8000000000000 - (JS_FLOAT64_TAG_ADDEND shl 32 ));
256249{ $Else}
257250type
258251 JSValueUnion = record
@@ -266,11 +259,10 @@ JSValue = record
266259 u : JSValueUnion;
267260 tag : Int64;
268261 end ;
269- PJSValue = ^JSValue;
270-
271- JSValueConst = JSValue;
272- PJSValueConst = ^JSValueConst;
273- JSValueConstArr = array [0 ..(MaxInt div SizeOf(JSValueConst))-1 ] of JSValueConst;
262+ PJSValue = ^JSValue;
263+ JSValueConst = JSValue;
264+ PJSValueConst = ^JSValueConst;
265+ JSValueConstArr = array [0 ..(MaxInt div SizeOf(JSValueConst))-1 ] of JSValueConst;
274266 PJSValueConstArr = ^JSValueConstArr;
275267{ $ENDIF}
276268type
@@ -284,7 +276,7 @@ JSMallocState = record
284276
285277 // c_malloc = function (s : JSMallocState; size : UInt64) : Pointer;
286278 // Pc_malloc = ^c_malloc;
287-
279+ // TODO: Check If funcs need to be Pointers or not. ^^^^^
288280 JSMallocFunctions = record
289281 js_malloc : function (s : PJSMallocState; size : size_t) : Pointer; cdecl;
290282 js_free : procedure (s : PJSMallocState; Ptr : Pointer); cdecl;
0 commit comments