libsee.pas 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. { $define libseehelper}
  2. {$mode objfpc}
  3. {$h+}
  4. unit libsee;
  5. interface
  6. uses
  7. ctypes;
  8. {
  9. Automatically converted by H2Pas 1.0.0 from libsee.c
  10. The following command line parameters were used:
  11. -D
  12. -l
  13. see
  14. -C
  15. -u
  16. libsee
  17. -T
  18. -o
  19. libsee.pas
  20. -P
  21. libsee.c
  22. }
  23. const
  24. {$ifdef unix}
  25. LibSeeLibraryName='libsee.so';
  26. {$else}
  27. LibSeeLibraryName='libsee.dll';
  28. {$endif}
  29. Type
  30. Tsize_t = csize_t;
  31. tcuchar = char;
  32. Tuint16_t = word;
  33. Tuint32_t = cardinal;
  34. Tuint64_t = qword;
  35. Tint16_t = integer;
  36. Tint32_t = longint;
  37. Tint64_t = int64;
  38. TDouble = double;
  39. tcuint = word;
  40. tcint = integer;
  41. PTcchar = pchar;
  42. PPTcchar = ^PTcchar;
  43. Ptcint = ^tcint;
  44. PTcuint = ^tcuint;
  45. tcchar = char;
  46. var
  47. SEE_literal_NaN : array[0..7] of Tcuchar;cvar;external;
  48. Type
  49. PFILE = Pointer;
  50. PTFILE = Pointer;
  51. PPSEE_string = ^PSEE_string;
  52. PSEE_context = ^TSEE_context;
  53. PSEE_enum = ^TSEE_enum;
  54. PSEE_growable = ^TSEE_growable;
  55. PSEE_input = ^TSEE_input;
  56. PSEE_interpreter = ^TSEE_interpreter;
  57. PSEE_module = ^TSEE_module;
  58. PSEE_native = ^TSEE_native;
  59. PSEE_object = ^TSEE_object;
  60. PSEE_objectclass = ^TSEE_objectclass;
  61. PSEE_scope = ^TSEE_scope;
  62. PSEE_string = ^TSEE_string;
  63. PSEE_throw_location = ^TSEE_throw_location;
  64. PSEE_try_context = ^TSEE_try_context;
  65. PSEE_unicode_t = ^TSEE_unicode_t;
  66. PSEE_value = ^TSEE_value;
  67. PTSEE_char_t = ^TSEE_Char_t;
  68. PTSEE_Code = Pointer;
  69. PTSEE_context = ^TSEE_context;
  70. PTSEE_enum = ^TSEE_enum;
  71. PTSEE_growable = ^TSEE_growable;
  72. PTSEE_input = ^TSEE_input;
  73. PTSEE_interpreter = ^TSEE_interpreter;
  74. PTSEE_module = ^TSEE_module;
  75. PTSEE_native = ^TSEE_native;
  76. PTSEE_object = ^TSEE_object;
  77. PTSEE_objectclass = ^TSEE_objectclass;
  78. PTSEE_scope = ^TSEE_scope;
  79. PTSEE_string = ^TSEE_string;
  80. TPSEE_string = PTSEE_string;
  81. PTSEE_throw_location = ^TSEE_throw_location;
  82. PTSEE_try_context = ^TSEE_try_context;
  83. PTSEE_unicode_t = ^TSEE_unicode_t;
  84. PTSEE_value = ^TSEE_value;
  85. PPTSEE_value = ^PSEE_value;
  86. PTSEE_enumclass = ^TSEE_enumclass;
  87. PSEE_system = ^TSEE_System;
  88. // PTSEE_property = ^TSEE_property;
  89. PTSEE_property = Pointer;
  90. TPSEE_object = ^TSEE_object;
  91. PTSEE_inputclass = ^TSEE_inputclass;
  92. PTSEE_traceback = ^TSEE_traceback;
  93. PTSEE_regex_engine = Pointer;
  94. PTSEE_stringclass = ^TSEE_stringclass;
  95. TPSEE_enum = PSEE_Enum;
  96. TPSEE_input = PSEE_INPUT;
  97. PTPSEE_string = ^TSEE_STRING;
  98. TPSEE_interpreter_state = Pointer; //^TSEE_interpreter_state;
  99. {$IFDEF FPC}
  100. {$PACKRECORDS C}
  101. {$ENDIF}
  102. TSEE_uint16_t = Tuint16_t;
  103. TSEE_uint32_t = Tuint32_t;
  104. TSEE_int32_t = Tint32_t;
  105. TSEE_uint64_t = Tuint64_t;
  106. TSEE_int64_t = Tint64_t;
  107. TSEE_number_t = Tdouble;
  108. TSEE_boolean_t = Tcuchar;
  109. TSEE_char_t = TSEE_uint16_t;
  110. TSEE_unicode_t = TSEE_uint32_t;
  111. TSEE_type = (SEE_UNDEFINED,SEE_NULL,SEE_BOOLEAN,SEE_NUMBER,
  112. SEE_STRING,SEE_OBJECT,SEE_REFERENCE,SEE_COMPLETION
  113. );
  114. TSEE_reference = record
  115. base : PTSEE_object;
  116. _property : PTSEE_string;
  117. end;
  118. TSEE_completion = record
  119. value : PTSEE_value;
  120. target : Tcuint;
  121. _type : (SEE_COMPLETION_NORMAL,SEE_COMPLETION_BREAK,
  122. SEE_COMPLETION_CONTINUE,SEE_COMPLETION_RETURN,
  123. SEE_COMPLETION_THROW);
  124. end;
  125. TSEE_value = record
  126. _type : TSEE_type;
  127. u : record
  128. case longint of
  129. 0 : ( number : TSEE_number_t );
  130. 1 : ( boolean : TSEE_boolean_t );
  131. 2 : ( _object : PTSEE_object );
  132. 3 : ( _string : PTSEE_string );
  133. 4 : ( reference : TSEE_reference );
  134. 5 : ( completion : TSEE_completion );
  135. 6 : ( _padding : array[0..3] of pointer );
  136. end;
  137. end;
  138. TSEE_get_fn_t = procedure (i:PTSEE_interpreter; obj:PTSEE_object; prop:PTSEE_string; res:PTSEE_value);cdecl;
  139. TSEE_put_fn_t = procedure (i:PTSEE_interpreter; obj:PTSEE_object; prop:PTSEE_string; res:PTSEE_value; flags:Tcint);cdecl;
  140. TSEE_boolean_fn_t = function (i:PTSEE_interpreter; obj:PTSEE_object; prop:PTSEE_string):Tcint;cdecl;
  141. TSEE_hasinstance_fn_t = function (i:PTSEE_interpreter; obj:PTSEE_object; instance:PTSEE_value):Tcint;cdecl;
  142. TSEE_default_fn_t = procedure (i:PTSEE_interpreter; obj:PTSEE_object; hint:PTSEE_value; res:PTSEE_value);cdecl;
  143. TSEE_call_fn_t = procedure (i:PTSEE_interpreter; obj:PTSEE_object; thisobj:PTSEE_object; argc:Tcint; argv:PPTSEE_value;
  144. res:PTSEE_value);cdecl;
  145. TSEE_enumerator_fn_t = function (i:PTSEE_interpreter; obj:PTSEE_object):PTSEE_enum;cdecl;
  146. TSEE_get_sec_domain_fn_t = function (i:PTSEE_interpreter; obj:PTSEE_object):pointer;cdecl;
  147. (* Const before type ignored *)
  148. TSEE_objectclass = record
  149. _Class : PTcchar;
  150. Get : TSEE_get_fn_t;
  151. Put : TSEE_put_fn_t;
  152. CanPut : TSEE_boolean_fn_t;
  153. HasProperty : TSEE_boolean_fn_t;
  154. Delete : TSEE_boolean_fn_t;
  155. DefaultValue : TSEE_default_fn_t;
  156. enumerator : TSEE_enumerator_fn_t;
  157. Construct : TSEE_call_fn_t;
  158. Call : TSEE_call_fn_t;
  159. HasInstance : TSEE_hasinstance_fn_t;
  160. get_sec_domain : TSEE_get_sec_domain_fn_t;
  161. end;
  162. TSEE_object = record
  163. objectclass : PTSEE_objectclass;
  164. Prototype : PTSEE_object;
  165. host_data : pointer;
  166. end;
  167. TSEE_enumclass = record
  168. unused : pointer;
  169. next : function (i:PTSEE_interpreter; e:PTSEE_enum; flags_return:pTcint):TPSEE_string;cdecl;
  170. end;
  171. TSEE_enum = record
  172. enumclass : PTSEE_enumclass;
  173. end;
  174. TSEE_native = record
  175. _object : TSEE_object;
  176. properties : array[0..256] of PTSEE_property;
  177. lru : PTSEE_property;
  178. end;
  179. TSEE_scope = record
  180. next : PTSEE_scope;
  181. obj : TPSEE_object;
  182. end;
  183. TSEE_inputclass = record
  184. next : function (para1:PTSEE_input):TSEE_unicode_t;cdecl;
  185. close : procedure (para1:PTSEE_input);
  186. end;
  187. TSEE_input = record
  188. inputclass : PTSEE_inputclass;
  189. eof : TSEE_boolean_t;
  190. lookahead : TSEE_unicode_t;
  191. filename : TPSEE_string;
  192. first_lineno : Tcint;
  193. interpreter : PTSEE_interpreter;
  194. end;
  195. TSEE_trace_event = (SEE_TRACE_CALL,SEE_TRACE_RETURN,SEE_TRACE_STATEMENT,
  196. SEE_TRACE_THROW);
  197. TSEE_interpreter = record
  198. host_data : pointer;
  199. compatibility : Tcint;
  200. Global : TPSEE_object;
  201. _Object : TPSEE_object;
  202. Object_prototype : TPSEE_object;
  203. Error : TPSEE_object;
  204. EvalError : TPSEE_object;
  205. RangeError : TPSEE_object;
  206. ReferenceError : TPSEE_object;
  207. SyntaxError : TPSEE_object;
  208. TypeError : TPSEE_object;
  209. URIError : TPSEE_object;
  210. _String : TPSEE_object;
  211. String_prototype : TPSEE_object;
  212. _Function : TPSEE_object;
  213. Function_prototype : TPSEE_object;
  214. _Array : TPSEE_object;
  215. Array_prototype : TPSEE_object;
  216. Number : TPSEE_object;
  217. Number_prototype : TPSEE_object;
  218. Boolean : TPSEE_object;
  219. Boolean_prototype : TPSEE_object;
  220. Math : TPSEE_object;
  221. RegExp : TPSEE_object;
  222. RegExp_prototype : TPSEE_object;
  223. Date : TPSEE_object;
  224. Date_prototype : TPSEE_object;
  225. Global_eval : TPSEE_object;
  226. Global_scope : PTSEE_scope;
  227. try_context : PTSEE_try_context;
  228. try_location : PTSEE_throw_location;
  229. traceback : PTSEE_traceback;
  230. module_private : Ppointer;
  231. intern_tab : pointer;
  232. random_seed : Tcuint;
  233. locale : PTcchar;
  234. recursion_limit : Tcint;
  235. sec_domain : pointer;
  236. trace : procedure (para1:PTSEE_interpreter; para2:PTSEE_throw_location; para3:PTSEE_context; para4:TSEE_trace_event);cdecl;
  237. regex_engine : PTSEE_regex_engine;
  238. end;
  239. TSEE_traceback = record
  240. call_location : PTSEE_throw_location;
  241. callee : TPSEE_object;
  242. call_type : Tcint;
  243. prev : PTSEE_traceback;
  244. end;
  245. TSEE_context = record
  246. interpreter : PTSEE_interpreter;
  247. activation : TPSEE_object;
  248. variable : TPSEE_object;
  249. varattr : Tcint;
  250. thisobj : TPSEE_object;
  251. scope : PTSEE_scope;
  252. end;
  253. TSEE_growable = record
  254. data_ptr : Ppointer;
  255. length_ptr : PTcuint;
  256. element_size : Tsize_t;
  257. allocated : Tsize_t;
  258. flag0 : word;
  259. end;
  260. TSEE_module = record
  261. magic : TSEE_uint32_t;
  262. name : PTcchar;
  263. version : PTcchar;
  264. index : Tcuint;
  265. mod_init : function :Tcint;cdecl;
  266. alloc : procedure (para1:PTSEE_interpreter);cdecl;
  267. init : procedure (para1:PTSEE_interpreter);cdecl;
  268. end;
  269. TSEE_string = record
  270. length : Tcuint;
  271. data : PTSEE_char_t;
  272. stringclass : PTSEE_stringclass;
  273. interpreter : PTSEE_interpreter;
  274. flags : Tcint;
  275. end;
  276. TSEE_stringclass = record
  277. growby : procedure (para1:TPSEE_string; para2:Tcuint);cdecl;
  278. end;
  279. TFinalProc = procedure (para1:PTSEE_interpreter; para2:pointer; para3:pointer); cdecl;
  280. TSEE_system = record
  281. default_locale : PTcchar;
  282. default_recursion_limit : Tcint;
  283. default_trace : procedure (para1:PTSEE_interpreter; para2:PTSEE_throw_location; para3:PTSEE_context; para4:TSEE_trace_event);cdecl;
  284. default_compat_flags : Tcint;
  285. random_seed : function :Tcuint;
  286. abort : procedure (para1:PTSEE_interpreter; para2:PTcchar);
  287. periodic : procedure (para1:PTSEE_interpreter);
  288. malloc : function (para1:PTSEE_interpreter; para2:Tsize_t; para3:PTcchar; para4:Tcint):pointer;
  289. malloc_finalize : function (para1:PTSEE_interpreter; para2:Tsize_t; para3:tfinalproc; para4:pointer; para5:PTcchar; para6:Tcint):pointer;
  290. malloc_string : function (para1:PTSEE_interpreter; para2:Tsize_t; para3:PTcchar; para4:Tcint):pointer;
  291. free : procedure (para1:PTSEE_interpreter; para2:pointer; para3:PTcchar; para4:Tcint);
  292. mem_exhausted : procedure (para1:PTSEE_interpreter);
  293. gcollect : procedure (para1:PTSEE_interpreter);
  294. transit_sec_domain : function (para1:PTSEE_interpreter; para2:pointer):pointer;
  295. code_alloc : function (para1:PTSEE_interpreter): PTSEE_code;
  296. object_construct : procedure (interp:PTSEE_interpreter; self:TPSEE_object; thisobj:TPSEE_object; argc:Tcint; argv:PPTSEE_value;
  297. res:PTSEE_value);
  298. default_regex_engine : PTSEE_regex_engine;
  299. end;
  300. TSEE_throw_location = record
  301. filename : TPSEE_string;
  302. lineno : Tcint;
  303. end;
  304. Tjmp_buf = record
  305. a : array[1..200] of byte;
  306. end;
  307. TSEE_try_context_t = record
  308. interpreter : PTSEE_interpreter;
  309. previous : PTSEE_try_context;
  310. thrown : TSEE_value;
  311. done : Tcint;
  312. env : Tjmp_buf; //
  313. throw_file : PTcchar;
  314. throw_line : Tcint;
  315. saved_traceback : PTSEE_traceback;
  316. traceback : PTSEE_traceback;
  317. end;
  318. TSEE_try_context = TSEE_try_context_t;
  319. const
  320. bm_TSEE_growable_is_string = $1;
  321. bp_TSEE_growable_is_string = 0;
  322. var
  323. _SEE_isnan : function(n:TSEE_number_t):Tcint;cdecl;
  324. _SEE_isfinite : function(n:TSEE_number_t):Tcint;cdecl;
  325. _SEE_copysign : function(x:TSEE_number_t; y:TSEE_number_t):TSEE_number_t;cdecl;
  326. _SEE_ispinf : function(n:TSEE_number_t):Tcint;cdecl;
  327. _SEE_isninf : function(n:TSEE_number_t):Tcint;cdecl;
  328. SEE_ToPrimitive : procedure(i:PTSEE_interpreter; val:PTSEE_value; _type:PTSEE_value; res:PTSEE_value);cdecl;
  329. SEE_ToBoolean : procedure(i:PTSEE_interpreter; val:PTSEE_value; res:PTSEE_value);cdecl;
  330. SEE_ToNumber : procedure(i:PTSEE_interpreter; val:PTSEE_value; res:PTSEE_value);cdecl;
  331. SEE_ToInteger : procedure(i:PTSEE_interpreter; val:PTSEE_value; res:PTSEE_value);cdecl;
  332. SEE_ToString : procedure(i:PTSEE_interpreter; val:PTSEE_value; res:PTSEE_value);cdecl;
  333. SEE_ToObject : procedure(i:PTSEE_interpreter; val:PTSEE_value; res:PTSEE_value);cdecl;
  334. SEE_ToInt32 : function(i:PTSEE_interpreter; val:PTSEE_value):TSEE_int32_t;cdecl;
  335. SEE_ToUint32 : function(i:PTSEE_interpreter; val:PTSEE_value):TSEE_uint32_t;cdecl;
  336. SEE_ToUint16 : function(i:PTSEE_interpreter; val:PTSEE_value):TSEE_uint16_t;cdecl;
  337. SEE_hexstr_lowercase : array[0..15] of Tcchar;cvar;external;
  338. _SEE_intern_assert : function(i:PTSEE_interpreter; s:TPSEE_string):TPSEE_string;cdecl;
  339. SEE_intern_ascii : function(para1:PTSEE_interpreter; para2:PTcchar):TPSEE_string;cdecl;
  340. SEE_function_is_joined : function(a:PTSEE_object; b:PTSEE_object):Tcint;cdecl;
  341. SEE_Object_new : function(para1:PTSEE_interpreter):TPSEE_object;cdecl;
  342. SEE_object_call : procedure(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_object; para4:Tcint; para5:PPTSEE_value;
  343. para6:PTSEE_value);cdecl;
  344. SEE_object_construct : procedure(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_object; para4:Tcint; para5:PPTSEE_value;
  345. para6:PTSEE_value);cdecl;
  346. SEE_object_instanceof : function(interp:PTSEE_interpreter; val:PTSEE_value; obj:TPSEE_object):Tcint;cdecl;
  347. SEE_native_get : procedure(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string; res:PTSEE_value);cdecl;
  348. SEE_native_put : procedure(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string; val:PTSEE_value; flags:Tcint);cdecl;
  349. SEE_native_canput : function(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string):Tcint;cdecl;
  350. SEE_native_hasproperty : function(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string):Tcint;cdecl;
  351. SEE_native_hasownproperty : function(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string):Tcint;cdecl;
  352. SEE_native_getownattr : function(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string):Tcint;cdecl;
  353. SEE_native_delete : function(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string):Tcint;cdecl;
  354. SEE_native_defaultvalue : procedure(i:PTSEE_interpreter; obj:TPSEE_object; hint:PTSEE_value; res:PTSEE_value);cdecl;
  355. SEE_native_enumerator : function(i:PTSEE_interpreter; obj:TPSEE_object):TPSEE_enum;cdecl;
  356. SEE_native_new : function(i:PTSEE_interpreter):TPSEE_object;cdecl;
  357. SEE_native_init : procedure(obj:PTSEE_native; i:PTSEE_interpreter; obj_class:PTSEE_objectclass; prototype:TPSEE_object);cdecl;
  358. SEE_cfunction_make : function(i:PTSEE_interpreter; func:TSEE_call_fn_t; name:TPSEE_string; length:Tcint):TPSEE_object;cdecl;
  359. SEE_parse_args : procedure(i:PTSEE_interpreter; argc:Tcint; argv:PPTSEE_value; fmt:pTcchar);cdecl;varargs;
  360. SEE_call_args : procedure(i:PTSEE_interpreter; func:TPSEE_object; thisobj:TPSEE_object; ret:PTSEE_value; fmt:pTcchar);cdecl;varargs;
  361. SEE_PrintValue : procedure(i:PTSEE_interpreter; v:PTSEE_value; f:PTFILE);cdecl;
  362. SEE_PrintObject : procedure(i:PTSEE_interpreter; o:TPSEE_object; f:PTFILE);cdecl;
  363. SEE_PrintString : procedure(i:PTSEE_interpreter; s:TPSEE_string; f:PTFILE);cdecl;
  364. SEE_PrintTraceback : procedure(i:PTSEE_interpreter; f:PTFILE);cdecl;
  365. SEE_PrintContextTraceback : procedure(i:PTSEE_interpreter; context:PTSEE_try_context; f:PTFILE);cdecl;
  366. SEE_Global_eval : procedure(i:PTSEE_interpreter; input:PTSEE_input; res:PTSEE_value);cdecl;
  367. SEE_eval : procedure(i:PTSEE_interpreter; input:PTSEE_input; thisobj:TPSEE_object; variable:TPSEE_object; scope:PTSEE_scope;
  368. res:PTSEE_value);cdecl;
  369. SEE_Function_new : function(i:PTSEE_interpreter; name:TPSEE_string; param_input:PTSEE_input; body_input:PTSEE_input):TPSEE_object;cdecl;
  370. SEE_error__throw_string : procedure(i:PTSEE_interpreter; errorobj:TPSEE_object; filename:pTcchar; lineno:Tcint; message:TPSEE_string);cdecl;
  371. SEE_error__throw : procedure(i:PTSEE_interpreter; errorobj:TPSEE_object; filename:pTcchar; lineno:Tcint; fmt:pTcchar);cdecl; varargs;
  372. SEE_error__throw_sys : procedure(i:PTSEE_interpreter; errorobj:TPSEE_object; filename:pTcchar; lineno:Tcint; fmt:pTcchar);cdecl; varargs;
  373. SEE_Error_make : function(i:PTSEE_interpreter; name:TPSEE_string):TPSEE_object;cdecl;
  374. SEE_error__throw0 : procedure(i:PTSEE_interpreter; errorobj:TPSEE_object; fmt:pTcchar);cdecl;varargs;
  375. SEE_error__throw_sys0 : procedure(i:PTSEE_interpreter; errorobj:TPSEE_object; fmt:pTcchar);cdecl;varargs;
  376. SEE_input_file : function(i:PTSEE_interpreter; f:PTFILE; filename:pTcchar; encoding:pTcchar):TPSEE_input;cdecl;
  377. SEE_input_string : function(i:PTSEE_interpreter; s:TPSEE_string):TPSEE_input;cdecl;
  378. SEE_input_utf8 : function(i:PTSEE_interpreter; s:pTcchar):TPSEE_input;cdecl;
  379. SEE_input_lookahead : function(i:TPSEE_input; maxlookahead:Tcint):TPSEE_input;cdecl;
  380. SEE_input_lookahead_copy : function(li:TPSEE_input; buf:PTSEE_unicode_t; buflen:Tcint):Tcint;cdecl;
  381. _SEE_intern_init : procedure(i:PTSEE_interpreter);cdecl;
  382. SEE_intern : function(i:PTSEE_interpreter; s:TPSEE_string):TPSEE_string;cdecl;
  383. SEE_intern_and_free : procedure(i:PTSEE_interpreter; s:PTPSEE_string);cdecl;
  384. // SEE_intern_ascii : function(i:PTSEE_interpreter; s:pTcchar):TPSEE_string;cdecl;
  385. SEE_intern_global : function(s:pTcchar):TPSEE_string;cdecl;
  386. SEE_interpreter_init : procedure(i:PTSEE_interpreter);cdecl;
  387. SEE_interpreter_init_compat : procedure(i:PTSEE_interpreter; compat_flags:Tcint);cdecl;
  388. SEE_interpreter_save_state : function(i:PTSEE_interpreter):TPSEE_interpreter_state;cdecl;
  389. SEE_interpreter_restore_state : procedure(i:PTSEE_interpreter; state:TPSEE_interpreter_state);cdecl;
  390. SEE_context_eval : procedure(context:PTSEE_context; expr:TPSEE_string; res:PTSEE_value);cdecl;
  391. Type
  392. Tfinalizefn = procedure( i:PTSEE_interpreter; p:pointer; closure:pointer);cdecl;
  393. Var
  394. SEE_malloc : function(i:PTSEE_interpreter; sz:Tsize_t):pointer;cdecl;
  395. SEE_malloc_string : function(i:PTSEE_interpreter; sz:Tsize_t):pointer;cdecl;
  396. SEE_malloc_finalize : function(i:PTSEE_interpreter; sz:Tsize_t; finalizefn:Tfinalizefn; closure:pointer):pointer;cdecl;
  397. SEE_free : procedure(i:PTSEE_interpreter; memp:Ppointer);cdecl;
  398. SEE_gcollect : procedure(i:PTSEE_interpreter);cdecl;
  399. _SEE_malloc_debug : function(i:PTSEE_interpreter; sz:Tsize_t; _file:pTcchar; line:Tcint):pointer;cdecl;
  400. _SEE_malloc_string_debug : function(i:PTSEE_interpreter; sz:Tsize_t; _file:pTcchar; line:Tcint):pointer;cdecl;
  401. _SEE_malloc_finalize_debug : function(i:PTSEE_interpreter; sz:Tsize_t; finalizefn:Tfinalizefn; closure:pointer; _file:pTcchar; line:Tcint):pointer;cdecl;
  402. _SEE_free_debug : procedure(i:PTSEE_interpreter; memp:Ppointer; _file:pTcchar; line:Tcint);cdecl;
  403. function is_string(var a : TSEE_growable) : boolean;
  404. procedure set_is_string(var a : TSEE_growable; __is_string : boolean);
  405. var
  406. SEE_grow_to : procedure(i:PTSEE_interpreter; grow:PTSEE_growable; new_len:Tcuint);cdecl;
  407. _SEE_grow_to_debug : procedure(i:PTSEE_interpreter; grow:PTSEE_growable; new_len:Tcuint; _file:pTcchar; line:Tcint);cdecl;
  408. SEE_module_add : function(module:PTSEE_module):Tcint;cdecl;
  409. SEE_no_get : procedure(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_string; val:PTSEE_value);cdecl;
  410. SEE_no_put : procedure(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_string; val:PTSEE_value; para5:Tcint);cdecl;
  411. SEE_no_canput : function(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_string):Tcint;cdecl;
  412. SEE_no_hasproperty : function(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_string):Tcint;cdecl;
  413. SEE_no_delete : function(para1:PTSEE_interpreter; para2:TPSEE_object; para3:TPSEE_string):Tcint;cdecl;
  414. SEE_no_defaultvalue : procedure(para1:PTSEE_interpreter; para2:TPSEE_object; para3:PTSEE_value; para4:PTSEE_value);cdecl;
  415. SEE_no_enumerator : function(para1:PTSEE_interpreter; para2:TPSEE_object):TPSEE_enum;cdecl;
  416. var
  417. SEE_string_addch : procedure(s:TPSEE_string; ch:Tcint);cdecl;
  418. SEE_string_append : procedure(s:TPSEE_string; sffx:TPSEE_string);cdecl;
  419. SEE_string_append_ascii : procedure(s:TPSEE_string; ascii:pTcchar);cdecl;
  420. SEE_string_append_int : procedure(s:TPSEE_string; i:Tcint);cdecl;
  421. SEE_string_append_unicode : procedure(s:TPSEE_string; uch:TSEE_unicode_t);cdecl;
  422. SEE_string_fputs : function(s:TPSEE_string; _file:PTFILE):Tcint;cdecl;
  423. SEE_string_cmp : function(s1:TPSEE_string; s2:TPSEE_string):Tcint;cdecl;
  424. SEE_string_cmp_ascii : function(s1:TPSEE_string; s2:pTcchar):Tcint;cdecl;
  425. SEE_string_new : function(i:PTSEE_interpreter; space:Tcuint):TPSEE_string;cdecl;
  426. SEE_string_dup : function(i:PTSEE_interpreter; s:TPSEE_string):TPSEE_string;cdecl;
  427. SEE_string_substr : function(i:PTSEE_interpreter; s:TPSEE_string; index:Tcint; length:Tcint):TPSEE_string;cdecl;
  428. SEE_string_concat : function(i:PTSEE_interpreter; s1:TPSEE_string; s2:TPSEE_string):TPSEE_string;cdecl;
  429. SEE_string_sprintf : function(i:PTSEE_interpreter; fmt:pTcchar):TPSEE_string;cdecl; varargs;
  430. SEE_string_literal : function(i:PTSEE_interpreter; s:TPSEE_string):TPSEE_string;cdecl;
  431. SEE_string_fix : function(s:TPSEE_string):TPSEE_string;cdecl;
  432. SEE_string_free : procedure(i:PTSEE_interpreter; sp:PTPSEE_string);cdecl;
  433. SEE_string_toutf8 : procedure(i:PTSEE_interpreter; buf:pTcchar; buflen:Tsize_t; s:TPSEE_string);cdecl;
  434. SEE_string_utf8_size : function(interp:PTSEE_interpreter; s:TPSEE_string):Tsize_t;cdecl;
  435. _SEE_string_dup_fix : function(para1:PTSEE_interpreter; para2:TPSEE_string):TPSEE_string;cdecl;
  436. var
  437. SEE_system : TSEE_system;cvar;external;
  438. SEE_init : procedure;cdecl;
  439. SEE_regex_engine_list : function:PPTcchar;cdecl;
  440. SEE_regex_engine : function(name:pTcchar):PTSEE_regex_engine;cdecl;
  441. var
  442. SEE_throw_abort : procedure(para1:PTSEE_interpreter; para2:PTSEE_value; para3:PTcchar; para4:Tcint);cdecl;
  443. SEE_location_string : function(i:PTSEE_interpreter; loc:PTSEE_throw_location):TPSEE_string;cdecl;
  444. SEE_throw : procedure;cdecl;
  445. SEE_version : function: PTcchar;cdecl;
  446. procedure see_input_close(Inp : PSEE_INPUT);
  447. function SEE_VALUE_GET_TYPE(v : PSEE_value) : TSEE_type;
  448. procedure SEE_VALUE_COPY(dst, src : PSEE_value);
  449. procedure SEE_SET_UNDEFINED(v : PSEE_value);
  450. procedure SEE_SET_NULL(v : PSEE_value);
  451. procedure SEE_SET_BOOLEAN(v : PSEE_value; b : Boolean);
  452. procedure SEE_SET_NUMBER(v : PSEE_value; n : TSEE_number_t);
  453. procedure SEE_SET_STRING(v :PSEE_value; s: PSEE_STRING);
  454. procedure SEE_SET_OBJECT(v :PSEE_value; o: PSEE_OBJECT);
  455. function SEE_isnan (n:TSEE_number_t):Tcint;
  456. function SEE_isfinite (n:TSEE_number_t):Tcint;
  457. function SEE_copysign (x:TSEE_number_t; y:TSEE_number_t):TSEE_number_t;
  458. function SEE_ispinf (n:TSEE_number_t):Tcint;
  459. function SEE_isninf (n:TSEE_number_t):Tcint;
  460. Function SEE_MODULE_PRIVATE(i : PTSEE_interpreter; m : PSEE_module) : Pointer;
  461. procedure SEE_OBJECT_PUT(Interp : PTSEE_interpreter; Obj : PSEE_object; prop:TPSEE_string; val:PTSEE_value; flags:Tcint);
  462. CONST
  463. SEE_ATTR_READONLY = $01;
  464. SEE_ATTR_DONTENUM = $02;
  465. SEE_ATTR_DONTDELETE = $04;
  466. SEE_ATTR_INTERNAL = $08;
  467. SEE_MODULE_MAGIC = $5345456d;
  468. SEE_ATTR_DEFAULT = SEE_ATTR_DONTENUM;
  469. SEE_ATTR_LENGTH = SEE_ATTR_READONLY or SEE_ATTR_DONTDELETE or SEE_ATTR_DONTENUM;
  470. {$ifdef libseehelper}
  471. {$l libsee.so}
  472. {$l libseewrap.o}
  473. function SEE_help_Global_eval (para1 : PSEE_Interpreter; para2: PSEE_input; para3 : PSEE_value) : cint; cdecl; external;
  474. function SEE_help_CAUGHT(para1: TSEE_try_context) : PSEE_value; cdecl; external;
  475. procedure SEE_help_THROW(para1: PSEE_Interpreter; para2: PSEE_value); cdecl; external;
  476. procedure SEE_help_RETHROW(para1: PSEE_Interpreter; para2: PSEE_value); cdecl; external;
  477. procedure SEE_help_DEFAULT_CATCH(para1: PSEE_Interpreter; para2: PSEE_try_context); cdecl; external;
  478. function new_SEE_interpreter : PSEE_Interpreter; cdecl; external;
  479. function new_SEE_value : PSEE_Value; cdecl; external;
  480. function new_SEE_objectclass : PSEE_objectclass; cdecl; external;
  481. function new_SEE_object : PSEE_object; cdecl; external;
  482. function new_SEE_enumclass : PTSEE_enumclass; cdecl; external;
  483. function new_SEE_enum : PSEE_enum; cdecl; external;
  484. function new_SEE_native : PSEE_native; cdecl; external;
  485. function new_SEE_scope : PSEE_scope; cdecl; external;
  486. function new_SEE_inputclass : PTSEE_inputclass; cdecl; external;
  487. function new_SEE_input : PSEE_input; cdecl; external;
  488. function new_SEE_traceback : PTSEE_traceback; cdecl; external;
  489. function new_SEE_context : PSEE_context; cdecl; external;
  490. function new_SEE_stringclass : PTSEE_stringclass; cdecl; external;
  491. function new_SEE_throw_location : PSEE_throw_location; cdecl; external;
  492. function new_SEE_try_context : PSEE_try_context; cdecl; external;
  493. procedure free_SEE_struct(P : pointer); cdecl; external;
  494. {$else}
  495. function new_SEE_interpreter : PSEE_Interpreter;
  496. function new_SEE_value : PSEE_Value;
  497. function new_SEE_objectclass : PSEE_objectclass;
  498. function new_SEE_object : PSEE_object;
  499. function new_SEE_enumclass : PTSEE_enumclass;
  500. function new_SEE_enum : PSEE_enum;
  501. function new_SEE_native : PSEE_native;
  502. function new_SEE_scope : PSEE_scope;
  503. function new_SEE_inputclass : PTSEE_inputclass;
  504. function new_SEE_input : PSEE_input;
  505. function new_SEE_traceback : PTSEE_traceback;
  506. function new_SEE_context : PSEE_context;
  507. function new_SEE_stringclass : PTSEE_stringclass;
  508. function new_SEE_throw_location : PSEE_throw_location;
  509. function new_SEE_try_context : PSEE_try_context;
  510. procedure free_SEE_struct(P : pointer);
  511. {$endif}
  512. procedure Loadlibsee(Const Alib : string);
  513. procedure Freelibsee;
  514. Function LibseeLoaded : Boolean;
  515. implementation
  516. uses
  517. SysUtils, dynlibs;
  518. {$ifndef libseehelper}
  519. function new_SEE_interpreter : PSEE_Interpreter;
  520. begin
  521. Result:=SEE_malloc(Nil,SizeOf(TSEE_interpreter));
  522. end;
  523. function new_SEE_value : PSEE_Value;
  524. begin
  525. Result:=SEE_malloc(Nil,SizeOf(TSEE_Value));
  526. end;
  527. function new_SEE_objectclass : PSEE_objectclass;
  528. begin
  529. Result:=SEE_malloc(Nil,SizeOf(TSEE_objectclass));
  530. end;
  531. function new_SEE_object : PSEE_object;
  532. begin
  533. Result:=SEE_malloc(Nil,SizeOf(TSEE_object));
  534. end;
  535. function new_SEE_enumclass : PTSEE_enumclass;
  536. begin
  537. Result:=SEE_malloc(Nil,SizeOf(TSEE_enumclass));
  538. end;
  539. function new_SEE_enum : PSEE_enum;
  540. begin
  541. Result:=SEE_malloc(Nil,SizeOf(TSEE_enum));
  542. end;
  543. function new_SEE_native : PSEE_native;
  544. begin
  545. Result:=SEE_malloc(Nil,SizeOf(TSEE_native));
  546. end;
  547. function new_SEE_scope : PSEE_scope;
  548. begin
  549. Result:=SEE_malloc(Nil,SizeOf(TSEE_scope));
  550. end;
  551. function new_SEE_inputclass : PTSEE_inputclass;
  552. begin
  553. Result:=SEE_malloc(Nil,SizeOf(TSEE_inputclass));
  554. end;
  555. function new_SEE_input : PSEE_input;
  556. begin
  557. Result:=SEE_malloc(Nil,SizeOf(TSEE_input));
  558. end;
  559. function new_SEE_traceback : PTSEE_traceback;
  560. begin
  561. Result:=SEE_malloc(Nil,SizeOf(TSEE_traceback));
  562. end;
  563. function new_SEE_context : PSEE_context;
  564. begin
  565. Result:=SEE_malloc(Nil,SizeOf(TSEE_context));
  566. end;
  567. function new_SEE_stringclass : PTSEE_stringclass;
  568. begin
  569. Result:=SEE_malloc(Nil,SizeOf(TSEE_stringclass));
  570. end;
  571. function new_SEE_throw_location : PSEE_throw_location;
  572. begin
  573. Result:=SEE_malloc(Nil,SizeOf(TSEE_throw_location));
  574. end;
  575. function new_SEE_try_context : PSEE_try_context;
  576. begin
  577. Result:=SEE_malloc(Nil,SizeOf(TSEE_try_context));
  578. end;
  579. procedure free_SEE_struct(P : pointer);
  580. begin
  581. SEE_free(Nil,P);
  582. end;
  583. {$endif}
  584. procedure SEE_OBJECT_PUT(Interp : PTSEE_interpreter; Obj : PSEE_object; prop:TPSEE_string; val:PTSEE_value; flags:Tcint);
  585. begin
  586. obj^.objectclass^.Put(Interp,obj,prop,val,flags);
  587. end;
  588. // SEE_native_put : procedure(i:PTSEE_interpreter; obj:TPSEE_object; prop:TPSEE_string; val:PTSEE_value; flags:Tcint);cdecl;
  589. function SEE_VALUE_GET_TYPE(v : PSEE_value) : TSEE_type;
  590. begin
  591. Result:=v^._type;
  592. end;
  593. procedure SEE_VALUE_COPY(dst, src : PSEE_value);
  594. begin
  595. dst^:=src^;
  596. end;
  597. procedure SEE_SET_TYPE(v: PSEE_VALUE; t : TSEE_type);
  598. begin
  599. v^._type:=t;
  600. end;
  601. procedure SEE_SET_UNDEFINED(v : PSEE_value);
  602. begin
  603. SEE_SET_TYPE(v,SEE_UNDEFINED);
  604. end;
  605. procedure SEE_SET_NULL(v : PSEE_value);
  606. begin
  607. SEE_SET_TYPE(V,SEE_NULL);
  608. end;
  609. procedure SEE_SET_BOOLEAN(v : PSEE_value; b : Boolean);
  610. begin
  611. SEE_SET_TYPE(V,SEE_BOOLEAN);
  612. V^.u.boolean:=char(ord(B));
  613. end;
  614. procedure SEE_SET_NUMBER(v : PSEE_value; n : TSEE_number_t);
  615. begin
  616. SEE_SET_TYPE(V,SEE_NUMBER);
  617. V^.u.number:=N;
  618. end;
  619. procedure SEE_SET_STRING(v :PSEE_value; s: PSEE_STRING);
  620. begin
  621. SEE_SET_TYPE(V,SEE_STRING);
  622. V^.u._string:=s
  623. end;
  624. procedure SEE_SET_OBJECT(v :PSEE_value; o: PSEE_OBJECT);
  625. begin
  626. SEE_SET_TYPE(V,SEE_OBJECT);
  627. V^.u._object:=o;
  628. end;
  629. function SEE_isnan (n:TSEE_number_t):Tcint;
  630. begin
  631. Result:=_see_isnan(n);
  632. end;
  633. function SEE_isfinite (n:TSEE_number_t):Tcint;
  634. begin
  635. result:=_see_isfinite(n);
  636. end;
  637. function SEE_copysign (x:TSEE_number_t; y:TSEE_number_t):TSEE_number_t;
  638. begin
  639. result:=_see_copysign(x,y);
  640. end;
  641. function SEE_ispinf (n:TSEE_number_t):Tcint;
  642. begin
  643. result:=_see_ispinf(n);
  644. end;
  645. function SEE_isninf (n:TSEE_number_t):Tcint;
  646. begin
  647. result:=_see_isninf(n);
  648. end;
  649. function is_string(var a : TSEE_growable) : Boolean;
  650. begin
  651. is_string:=((a.flag0 and bm_TSEE_growable_is_string) shr bp_TSEE_growable_is_string)<>0;
  652. end;
  653. procedure set_is_string(var a : TSEE_growable; __is_string : Boolean);
  654. begin
  655. a.flag0:=a.flag0 or ((ord(__is_string) shl bp_TSEE_growable_is_string) and bm_TSEE_growable_is_string);
  656. end;
  657. Function SEE_MODULE_PRIVATE(i : PTSEE_interpreter; m : PSEE_module) : Pointer;
  658. begin
  659. Result:=@I^.module_private[Integer(m^.index)];
  660. end;
  661. procedure see_input_close(Inp : PSEE_INPUT);
  662. begin
  663. Inp^.inputclass^.close(inp);
  664. end;
  665. var
  666. hlib : tlibhandle;
  667. procedure Freelibsee;
  668. begin
  669. If HLib<>NilHandle then
  670. FreeLibrary(hlib);
  671. _SEE_isnan:=nil;
  672. _SEE_isfinite:=nil;
  673. _SEE_copysign:=nil;
  674. _SEE_ispinf:=nil;
  675. _SEE_isninf:=nil;
  676. SEE_ToPrimitive:=nil;
  677. SEE_ToBoolean:=nil;
  678. SEE_ToNumber:=nil;
  679. SEE_ToInteger:=nil;
  680. SEE_ToString:=nil;
  681. SEE_ToObject:=nil;
  682. SEE_ToInt32:=nil;
  683. SEE_ToUint32:=nil;
  684. SEE_ToUint16:=nil;
  685. _SEE_intern_assert:=nil;
  686. SEE_intern_ascii:=nil;
  687. SEE_function_is_joined:=nil;
  688. SEE_Object_new:=nil;
  689. SEE_object_call:=nil;
  690. SEE_object_construct:=nil;
  691. SEE_object_instanceof:=nil;
  692. SEE_native_get:=nil;
  693. SEE_native_put:=nil;
  694. SEE_native_canput:=nil;
  695. SEE_native_hasproperty:=nil;
  696. SEE_native_hasownproperty:=nil;
  697. SEE_native_getownattr:=nil;
  698. SEE_native_delete:=nil;
  699. SEE_native_defaultvalue:=nil;
  700. SEE_native_enumerator:=nil;
  701. SEE_native_new:=nil;
  702. SEE_native_init:=nil;
  703. SEE_cfunction_make:=nil;
  704. SEE_parse_args:=nil;
  705. SEE_parse_args:=nil;
  706. SEE_call_args:=nil;
  707. SEE_call_args:=nil;
  708. SEE_PrintValue:=nil;
  709. SEE_PrintObject:=nil;
  710. SEE_PrintString:=nil;
  711. SEE_PrintTraceback:=nil;
  712. SEE_PrintContextTraceback:=nil;
  713. SEE_Global_eval:=nil;
  714. SEE_eval:=nil;
  715. SEE_Function_new:=nil;
  716. SEE_error__throw_string:=nil;
  717. SEE_error__throw:=nil;
  718. SEE_error__throw:=nil;
  719. SEE_error__throw_sys:=nil;
  720. SEE_error__throw_sys:=nil;
  721. SEE_Error_make:=nil;
  722. SEE_error__throw0:=nil;
  723. SEE_error__throw0:=nil;
  724. SEE_error__throw_sys0:=nil;
  725. SEE_error__throw_sys0:=nil;
  726. SEE_input_file:=nil;
  727. SEE_input_string:=nil;
  728. SEE_input_utf8:=nil;
  729. SEE_input_lookahead:=nil;
  730. SEE_input_lookahead_copy:=nil;
  731. _SEE_intern_init:=nil;
  732. SEE_intern:=nil;
  733. SEE_intern_and_free:=nil;
  734. SEE_intern_ascii:=nil;
  735. SEE_intern_global:=nil;
  736. SEE_interpreter_init:=nil;
  737. SEE_interpreter_init_compat:=nil;
  738. SEE_interpreter_save_state:=nil;
  739. SEE_interpreter_restore_state:=nil;
  740. SEE_context_eval:=nil;
  741. SEE_malloc:=nil;
  742. SEE_malloc_string:=nil;
  743. SEE_malloc_finalize:=nil;
  744. SEE_free:=nil;
  745. SEE_gcollect:=nil;
  746. _SEE_malloc_debug:=nil;
  747. _SEE_malloc_string_debug:=nil;
  748. _SEE_malloc_finalize_debug:=nil;
  749. _SEE_free_debug:=nil;
  750. SEE_grow_to:=nil;
  751. _SEE_grow_to_debug:=nil;
  752. SEE_module_add:=nil;
  753. SEE_no_get:=nil;
  754. SEE_no_put:=nil;
  755. SEE_no_canput:=nil;
  756. SEE_no_hasproperty:=nil;
  757. SEE_no_delete:=nil;
  758. SEE_no_defaultvalue:=nil;
  759. SEE_no_enumerator:=nil;
  760. SEE_string_addch:=nil;
  761. SEE_string_append:=nil;
  762. SEE_string_append_ascii:=nil;
  763. SEE_string_append_int:=nil;
  764. SEE_string_append_unicode:=nil;
  765. SEE_string_fputs:=nil;
  766. SEE_string_cmp:=nil;
  767. SEE_string_cmp_ascii:=nil;
  768. SEE_string_new:=nil;
  769. SEE_string_dup:=nil;
  770. SEE_string_substr:=nil;
  771. SEE_string_concat:=nil;
  772. SEE_string_sprintf:=nil;
  773. SEE_string_sprintf:=nil;
  774. SEE_string_literal:=nil;
  775. SEE_string_fix:=nil;
  776. SEE_string_free:=nil;
  777. SEE_string_toutf8:=nil;
  778. SEE_string_utf8_size:=nil;
  779. _SEE_string_dup_fix:=nil;
  780. SEE_init:=nil;
  781. SEE_regex_engine_list:=nil;
  782. SEE_regex_engine:=nil;
  783. SEE_throw_abort:=nil;
  784. SEE_location_string:=nil;
  785. SEE_throw:=nil;
  786. SEE_version:=nil;
  787. end;
  788. Function LibseeLoaded : Boolean;
  789. begin
  790. Result:=hlib<>nilhandle;
  791. end;
  792. procedure Loadlibsee(Const Alib : string);
  793. begin
  794. Freelibsee;
  795. hlib:=LoadLibrary(pchar(Alib));
  796. if hlib=0 then
  797. raise Exception.Create(format('Could not load library: %s',[Alib]));
  798. pointer(_SEE_isnan):=GetProcAddress(hlib,'_SEE_isnan');
  799. pointer(_SEE_isfinite):=GetProcAddress(hlib,'_SEE_isfinite');
  800. pointer(_SEE_copysign):=GetProcAddress(hlib,'_SEE_copysign');
  801. pointer(_SEE_ispinf):=GetProcAddress(hlib,'_SEE_ispinf');
  802. pointer(_SEE_isninf):=GetProcAddress(hlib,'_SEE_isninf');
  803. pointer(SEE_ToPrimitive):=GetProcAddress(hlib,'SEE_ToPrimitive');
  804. pointer(SEE_ToBoolean):=GetProcAddress(hlib,'SEE_ToBoolean');
  805. pointer(SEE_ToNumber):=GetProcAddress(hlib,'SEE_ToNumber');
  806. pointer(SEE_ToInteger):=GetProcAddress(hlib,'SEE_ToInteger');
  807. pointer(SEE_ToString):=GetProcAddress(hlib,'SEE_ToString');
  808. pointer(SEE_ToObject):=GetProcAddress(hlib,'SEE_ToObject');
  809. pointer(SEE_ToInt32):=GetProcAddress(hlib,'SEE_ToInt32');
  810. pointer(SEE_ToUint32):=GetProcAddress(hlib,'SEE_ToUint32');
  811. pointer(SEE_ToUint16):=GetProcAddress(hlib,'SEE_ToUint16');
  812. pointer(_SEE_intern_assert):=GetProcAddress(hlib,'_SEE_intern_assert');
  813. pointer(SEE_intern_ascii):=GetProcAddress(hlib,'SEE_intern_ascii');
  814. pointer(SEE_function_is_joined):=GetProcAddress(hlib,'SEE_function_is_joined');
  815. pointer(SEE_Object_new):=GetProcAddress(hlib,'SEE_Object_new');
  816. pointer(SEE_object_call):=GetProcAddress(hlib,'SEE_object_call');
  817. pointer(SEE_object_construct):=GetProcAddress(hlib,'SEE_object_construct');
  818. pointer(SEE_object_instanceof):=GetProcAddress(hlib,'SEE_object_instanceof');
  819. pointer(SEE_native_get):=GetProcAddress(hlib,'SEE_native_get');
  820. pointer(SEE_native_put):=GetProcAddress(hlib,'SEE_native_put');
  821. pointer(SEE_native_canput):=GetProcAddress(hlib,'SEE_native_canput');
  822. pointer(SEE_native_hasproperty):=GetProcAddress(hlib,'SEE_native_hasproperty');
  823. pointer(SEE_native_hasownproperty):=GetProcAddress(hlib,'SEE_native_hasownproperty');
  824. pointer(SEE_native_getownattr):=GetProcAddress(hlib,'SEE_native_getownattr');
  825. pointer(SEE_native_delete):=GetProcAddress(hlib,'SEE_native_delete');
  826. pointer(SEE_native_defaultvalue):=GetProcAddress(hlib,'SEE_native_defaultvalue');
  827. pointer(SEE_native_enumerator):=GetProcAddress(hlib,'SEE_native_enumerator');
  828. pointer(SEE_native_new):=GetProcAddress(hlib,'SEE_native_new');
  829. pointer(SEE_native_init):=GetProcAddress(hlib,'SEE_native_init');
  830. pointer(SEE_cfunction_make):=GetProcAddress(hlib,'SEE_cfunction_make');
  831. pointer(SEE_parse_args):=GetProcAddress(hlib,'SEE_parse_args');
  832. pointer(SEE_parse_args):=GetProcAddress(hlib,'SEE_parse_args');
  833. pointer(SEE_call_args):=GetProcAddress(hlib,'SEE_call_args');
  834. pointer(SEE_call_args):=GetProcAddress(hlib,'SEE_call_args');
  835. pointer(SEE_PrintValue):=GetProcAddress(hlib,'SEE_PrintValue');
  836. pointer(SEE_PrintObject):=GetProcAddress(hlib,'SEE_PrintObject');
  837. pointer(SEE_PrintString):=GetProcAddress(hlib,'SEE_PrintString');
  838. pointer(SEE_PrintTraceback):=GetProcAddress(hlib,'SEE_PrintTraceback');
  839. pointer(SEE_PrintContextTraceback):=GetProcAddress(hlib,'SEE_PrintContextTraceback');
  840. pointer(SEE_Global_eval):=GetProcAddress(hlib,'SEE_Global_eval');
  841. pointer(SEE_eval):=GetProcAddress(hlib,'SEE_eval');
  842. pointer(SEE_Function_new):=GetProcAddress(hlib,'SEE_Function_new');
  843. pointer(SEE_error__throw_string):=GetProcAddress(hlib,'SEE_error__throw_string');
  844. pointer(SEE_error__throw):=GetProcAddress(hlib,'SEE_error__throw');
  845. pointer(SEE_error__throw):=GetProcAddress(hlib,'SEE_error__throw');
  846. pointer(SEE_error__throw_sys):=GetProcAddress(hlib,'SEE_error__throw_sys');
  847. pointer(SEE_error__throw_sys):=GetProcAddress(hlib,'SEE_error__throw_sys');
  848. pointer(SEE_Error_make):=GetProcAddress(hlib,'SEE_Error_make');
  849. pointer(SEE_error__throw0):=GetProcAddress(hlib,'SEE_error__throw0');
  850. pointer(SEE_error__throw0):=GetProcAddress(hlib,'SEE_error__throw0');
  851. pointer(SEE_error__throw_sys0):=GetProcAddress(hlib,'SEE_error__throw_sys0');
  852. pointer(SEE_error__throw_sys0):=GetProcAddress(hlib,'SEE_error__throw_sys0');
  853. pointer(SEE_input_file):=GetProcAddress(hlib,'SEE_input_file');
  854. pointer(SEE_input_string):=GetProcAddress(hlib,'SEE_input_string');
  855. pointer(SEE_input_utf8):=GetProcAddress(hlib,'SEE_input_utf8');
  856. pointer(SEE_input_lookahead):=GetProcAddress(hlib,'SEE_input_lookahead');
  857. pointer(SEE_input_lookahead_copy):=GetProcAddress(hlib,'SEE_input_lookahead_copy');
  858. pointer(_SEE_intern_init):=GetProcAddress(hlib,'_SEE_intern_init');
  859. pointer(SEE_intern):=GetProcAddress(hlib,'SEE_intern');
  860. pointer(SEE_intern_and_free):=GetProcAddress(hlib,'SEE_intern_and_free');
  861. pointer(SEE_intern_ascii):=GetProcAddress(hlib,'SEE_intern_ascii');
  862. pointer(SEE_intern_global):=GetProcAddress(hlib,'SEE_intern_global');
  863. pointer(SEE_interpreter_init):=GetProcAddress(hlib,'SEE_interpreter_init');
  864. pointer(SEE_interpreter_init_compat):=GetProcAddress(hlib,'SEE_interpreter_init_compat');
  865. pointer(SEE_interpreter_save_state):=GetProcAddress(hlib,'SEE_interpreter_save_state');
  866. pointer(SEE_interpreter_restore_state):=GetProcAddress(hlib,'SEE_interpreter_restore_state');
  867. pointer(SEE_context_eval):=GetProcAddress(hlib,'SEE_context_eval');
  868. pointer(SEE_malloc):=GetProcAddress(hlib,'SEE_malloc');
  869. pointer(SEE_malloc_string):=GetProcAddress(hlib,'SEE_malloc_string');
  870. pointer(SEE_malloc_finalize):=GetProcAddress(hlib,'SEE_malloc_finalize');
  871. pointer(SEE_free):=GetProcAddress(hlib,'SEE_free');
  872. pointer(SEE_gcollect):=GetProcAddress(hlib,'SEE_gcollect');
  873. pointer(_SEE_malloc_debug):=GetProcAddress(hlib,'_SEE_malloc_debug');
  874. pointer(_SEE_malloc_string_debug):=GetProcAddress(hlib,'_SEE_malloc_string_debug');
  875. pointer(_SEE_malloc_finalize_debug):=GetProcAddress(hlib,'_SEE_malloc_finalize_debug');
  876. pointer(_SEE_free_debug):=GetProcAddress(hlib,'_SEE_free_debug');
  877. pointer(SEE_grow_to):=GetProcAddress(hlib,'SEE_grow_to');
  878. pointer(_SEE_grow_to_debug):=GetProcAddress(hlib,'_SEE_grow_to_debug');
  879. pointer(SEE_module_add):=GetProcAddress(hlib,'SEE_module_add');
  880. pointer(SEE_no_get):=GetProcAddress(hlib,'SEE_no_get');
  881. pointer(SEE_no_put):=GetProcAddress(hlib,'SEE_no_put');
  882. pointer(SEE_no_canput):=GetProcAddress(hlib,'SEE_no_canput');
  883. pointer(SEE_no_hasproperty):=GetProcAddress(hlib,'SEE_no_hasproperty');
  884. pointer(SEE_no_delete):=GetProcAddress(hlib,'SEE_no_delete');
  885. pointer(SEE_no_defaultvalue):=GetProcAddress(hlib,'SEE_no_defaultvalue');
  886. pointer(SEE_no_enumerator):=GetProcAddress(hlib,'SEE_no_enumerator');
  887. pointer(SEE_string_addch):=GetProcAddress(hlib,'SEE_string_addch');
  888. pointer(SEE_string_append):=GetProcAddress(hlib,'SEE_string_append');
  889. pointer(SEE_string_append_ascii):=GetProcAddress(hlib,'SEE_string_append_ascii');
  890. pointer(SEE_string_append_int):=GetProcAddress(hlib,'SEE_string_append_int');
  891. pointer(SEE_string_append_unicode):=GetProcAddress(hlib,'SEE_string_append_unicode');
  892. pointer(SEE_string_fputs):=GetProcAddress(hlib,'SEE_string_fputs');
  893. pointer(SEE_string_cmp):=GetProcAddress(hlib,'SEE_string_cmp');
  894. pointer(SEE_string_cmp_ascii):=GetProcAddress(hlib,'SEE_string_cmp_ascii');
  895. pointer(SEE_string_new):=GetProcAddress(hlib,'SEE_string_new');
  896. pointer(SEE_string_dup):=GetProcAddress(hlib,'SEE_string_dup');
  897. pointer(SEE_string_substr):=GetProcAddress(hlib,'SEE_string_substr');
  898. pointer(SEE_string_concat):=GetProcAddress(hlib,'SEE_string_concat');
  899. pointer(SEE_string_sprintf):=GetProcAddress(hlib,'SEE_string_sprintf');
  900. pointer(SEE_string_sprintf):=GetProcAddress(hlib,'SEE_string_sprintf');
  901. pointer(SEE_string_literal):=GetProcAddress(hlib,'SEE_string_literal');
  902. pointer(SEE_string_fix):=GetProcAddress(hlib,'SEE_string_fix');
  903. pointer(SEE_string_free):=GetProcAddress(hlib,'SEE_string_free');
  904. pointer(SEE_string_toutf8):=GetProcAddress(hlib,'SEE_string_toutf8');
  905. pointer(SEE_string_utf8_size):=GetProcAddress(hlib,'SEE_string_utf8_size');
  906. pointer(_SEE_string_dup_fix):=GetProcAddress(hlib,'_SEE_string_dup_fix');
  907. pointer(SEE_init):=GetProcAddress(hlib,'SEE_init');
  908. pointer(SEE_regex_engine_list):=GetProcAddress(hlib,'SEE_regex_engine_list');
  909. pointer(SEE_regex_engine):=GetProcAddress(hlib,'SEE_regex_engine');
  910. pointer(SEE_throw_abort):=GetProcAddress(hlib,'SEE_throw_abort');
  911. pointer(SEE_location_string):=GetProcAddress(hlib,'SEE_location_string');
  912. pointer(SEE_throw):=GetProcAddress(hlib,'SEE_throw');
  913. pointer(SEE_version):=GetProcAddress(hlib,'SEE_version');
  914. end;
  915. initialization
  916. try
  917. Loadlibsee(LibSeeLibraryName);
  918. except
  919. // Ignore errors.
  920. end;
  921. finalization
  922. Freelibsee;
  923. end.