pxlib.pp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. {$IFDEF FPC}
  2. {$mode objfpc}
  3. {$h+}
  4. {$PACKRECORDS C}
  5. {$ENDIF}
  6. unit pxlib;
  7. interface
  8. uses
  9. {$ifdef unix}
  10. unixtype,
  11. {$endif}
  12. ctypes;
  13. { Automatically converted by H2Pas 1.0.0 from pxlib.h
  14. The following command line parameters were used:
  15. pxlib.h -D -l pxlib -o pxlib.pp -P -u pxlib -C -p
  16. MVC : Heavily edited after generation. C is a mess :( }
  17. const
  18. {$ifdef windows}
  19. pxlibraryname='pxlib.dll';
  20. {$else}
  21. pxlibraryname='libpx.so.0'; { Default name }
  22. {$endif}
  23. const
  24. px_true = 1;
  25. px_false = 0;
  26. { Error codes }
  27. PX_MemoryError = 1;
  28. PX_IOError = 2;
  29. PX_RuntimeError = 3;
  30. PX_Warning = 100;
  31. { IO Stream types }
  32. pxfIOFile = 1; { pxfIOGsf is defined as 2 in paradox-gsf.h }
  33. pxfIOStream = 3;
  34. { Field types }
  35. pxfAlpha = $01;
  36. pxfDate = $02;
  37. pxfShort = $03;
  38. pxfLong = $04;
  39. pxfCurrency = $05;
  40. pxfNumber = $06;
  41. pxfLogical = $09;
  42. pxfMemoBLOb = $0C;
  43. pxfBLOb = $0D;
  44. pxfFmtMemoBLOb = $0E;
  45. pxfOLE = $0F;
  46. pxfGraphic = $10;
  47. pxfTime = $14;
  48. pxfTimestamp = $15;
  49. pxfAutoInc = $16;
  50. pxfBCD = $17;
  51. pxfBytes = $18;
  52. pxfNumTypes = $18;
  53. { File types }
  54. pxfFileTypIndexDB = 0;
  55. pxfFileTypPrimIndex = 1;
  56. pxfFileTypNonIndexDB = 2;
  57. pxfFileTypNonIncSecIndex = 3;
  58. pxfFileTypSecIndex = 4;
  59. pxfFileTypIncSecIndex = 5;
  60. pxfFileTypNonIncSecIndexG = 6;
  61. pxfFileTypSecIndexG = 7;
  62. pxfFileTypIncSecIndexG = 8;
  63. { File modes }
  64. pxfFileRead = $1;
  65. pxfFileWrite = $2;
  66. Type
  67. PLongint = ^Longint;
  68. PSmallInt = ^SmallInt;
  69. PByte = ^Byte;
  70. PWord = ^Word;
  71. PDWord = ^DWord;
  72. PDouble = ^Double;
  73. Pcchar = pchar;
  74. {$ifndef unix}
  75. size_t = Integer;
  76. {$endif}
  77. PFILE = ^FILE;
  78. iconv_t = pointer;
  79. Ppxstream_t = ^pxstream_t;
  80. Ppxfield_t = ^pxfield_t;
  81. ppxval_t = ^pxval_t;
  82. Ppxhead_t = ^pxhead_t;
  83. Ppxdoc_t = ^pxdoc_t;
  84. ppxblockcache_t = ^pxblockcache_t;
  85. ppxmbblockinfo_t = ^pxmbblockinfo_t;
  86. Ppxblob_t = ^pxblob_t;
  87. Pmbhead_t = ^mbhead_t;
  88. Ppxdatablockinfo_t = ^pxdatablockinfo_t;
  89. PPpxval_t = ^ppxval_t;
  90. Ppcchar = ^pcchar;
  91. Ppx_field = ^px_field;
  92. px_field = record
  93. px_fname : pcchar;
  94. px_ftype : cchar;
  95. px_flen : cint;
  96. px_fdc : cint;
  97. end;
  98. pxfield_t = px_field;
  99. Ppx_val = ^px_val;
  100. px_val = record
  101. isnull : cchar;
  102. _type : cint;
  103. value : record
  104. case longint of
  105. 0 : ( lval : clong );
  106. 1 : ( dval : double );
  107. 2 : ( str : record
  108. val : pcchar;
  109. len : cint;
  110. end );
  111. end;
  112. end;
  113. pxval_t = px_val;
  114. Ppx_head = ^px_head;
  115. px_head = record
  116. px_tablename : pcchar;
  117. px_recordsize : cint;
  118. px_filetype : cchar;
  119. px_fileversion : cint;
  120. px_numrecords : cint;
  121. px_theonumrecords : cint;
  122. px_numfields : cint;
  123. px_maxtablesize : cint;
  124. px_headersize : cint;
  125. px_fileblocks : cuint;
  126. px_firstblock : cuint;
  127. px_lastblock : cuint;
  128. px_indexfieldnumber : cint;
  129. px_indexroot : cint;
  130. px_numindexlevels : cint;
  131. px_writeprotected : cint;
  132. px_doscodepage : cint;
  133. px_primarykeyfields : cint;
  134. px_modifiedflags1 : cchar;
  135. px_modifiedflags2 : cchar;
  136. px_sortorder : cchar;
  137. px_autoinc : cint;
  138. px_fileupdatetime : cint;
  139. px_refintegrity : cchar;
  140. px_fields : Ppx_field;
  141. px_encryption : culong;
  142. end;
  143. pxhead_t = px_head;
  144. Ppx_stream = ^px_stream;
  145. px_stream = record
  146. _type : cint;
  147. mode : cint;
  148. close : cint;
  149. s : record
  150. case longint of
  151. 0 : ( fp : PFILE );
  152. 1 : ( stream : pointer );
  153. end;
  154. read : function (p:Ppxdoc_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t;cdecl;
  155. seek : function (p:Ppxdoc_t; stream:Ppxstream_t; offset:clong; whence:cint):cint; cdecl;
  156. tell : function (p:Ppxdoc_t; stream:Ppxstream_t):clong; cdecl;
  157. write : function (p:Ppxdoc_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t;cdecl;
  158. end;
  159. pxstream_t = px_stream;
  160. Ppx_doc = ^px_doc;
  161. px_doc = record
  162. px_stream : Ppxstream_t;
  163. px_name : pcchar;
  164. px_close_fp : cint;
  165. px_head : Ppxhead_t;
  166. px_data : pointer;
  167. px_datalen : cint;
  168. px_indexdata : pointer;
  169. px_indexdatalen : cint;
  170. px_pindex : Ppxdoc_t;
  171. px_blob : Ppxblob_t;
  172. last_position : cint;
  173. warnings : cint;
  174. writeproc : function (p:Ppxdoc_t; data:pointer; size:size_t):size_t; cdecl;
  175. errorhandler : procedure (p:Ppxdoc_t; level:cint; msg:pcchar; data:pointer); cdecl;
  176. errorhandler_user_data : pointer;
  177. malloc : function (p:Ppxdoc_t; size:size_t; caller:pcchar):pointer; cdecl;
  178. calloc : function (p:Ppxdoc_t; size:size_t; caller:pcchar):pointer; cdecl;
  179. realloc : function (p:Ppxdoc_t; mem:pointer; size:size_t; caller:pcchar):pointer; cdecl;
  180. free : procedure (p:Ppxdoc_t; mem:pointer); cdecl;
  181. read : function (p:Ppxdoc_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t; cdecl;
  182. seek : function (p:Ppxdoc_t; stream:Ppxstream_t; offset:clong; whence:cint):cint; cdecl;
  183. tell : function (p:Ppxdoc_t; stream:Ppxstream_t):clong; cdecl;
  184. write : function (p:Ppxdoc_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t; cdecl;
  185. targetencoding : pcchar;
  186. inputencoding : pcchar;
  187. out_iconvcd : iconv_t;
  188. in_iconvcd : iconv_t;
  189. curblocknr : clong;
  190. curblockdirty : cint;
  191. curblock : pcuchar;
  192. end;
  193. pxdoc_t = px_doc;
  194. px_blockcache = record
  195. start : clong;
  196. size : size_t;
  197. data : pcuchar;
  198. end;
  199. pxblockcache_t = px_blockcache;
  200. Ppx_mbblockinfo = ^px_mbblockinfo;
  201. px_mbblockinfo = record
  202. number : cint;
  203. _type : cchar;
  204. numblobs : cchar;
  205. numblocks : cint;
  206. allocspace : cint;
  207. end;
  208. pxmbblockinfo_t = px_mbblockinfo;
  209. px_blob = record
  210. mb_name : pcchar;
  211. pxdoc : Ppxdoc_t;
  212. mb_stream : Ppxstream_t;
  213. mb_head : Pmbhead_t;
  214. used_datablocks : cint;
  215. subblockoffset : cint;
  216. subblockinneroffset : cint;
  217. subblockfree : cint;
  218. subblockblobcount : cint;
  219. read : function (p:Ppxblob_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t; cdecl;
  220. seek : function (p:Ppxblob_t; stream:Ppxstream_t; offset:clong; whence:cint):cint; cdecl;
  221. tell : function (p:Ppxblob_t; stream:Ppxstream_t):clong; cdecl;
  222. write : function (p:Ppxblob_t; stream:Ppxstream_t; numbytes:size_t; buffer:pointer):size_t; cdecl;
  223. blockcache : pxblockcache_t;
  224. blocklist : Ppxmbblockinfo_t;
  225. blocklistlen : cint;
  226. end;
  227. pxblob_t = px_blob;
  228. Pmb_head = ^mb_head;
  229. mb_head = record
  230. modcount : cint;
  231. end;
  232. mbhead_t = mb_head;
  233. Ppx_datablockinfo = ^px_datablockinfo;
  234. px_datablockinfo = record
  235. blockpos : clong;
  236. recordpos : clong;
  237. size : cint;
  238. recno : cint;
  239. numrecords : cint;
  240. prev : cint;
  241. next : cint;
  242. number : cint;
  243. end;
  244. pxdatablockinfo_t = px_datablockinfo;
  245. Ppx_pindex = ^px_pindex;
  246. px_pindex = record
  247. data : pcchar;
  248. blocknumber : cint;
  249. numrecords : cint;
  250. dummy : cint;
  251. myblocknumber : cint;
  252. level : cint;
  253. end;
  254. pxpindex_t = px_pindex;
  255. TPXErrorhandler = procedure (p:Ppxdoc_t; _type:cint; msg:pcchar; data:pointer); cdecl;
  256. TPXAllocHandler = function (p:Ppxdoc_t; size:size_t; caller:pcchar):pointer; cdecl;
  257. TPXReAllocHandler = function (p:Ppxdoc_t; mem:pointer; size:size_t; caller:pcchar):pointer;cdecl;
  258. TPXFreeHandler = procedure (p:Ppxdoc_t; mem:pointer); cdecl;
  259. var
  260. PX_get_majorversion : function:cint;cdecl;
  261. PX_get_minorversion : function:cint;cdecl;
  262. PX_get_subminorversion : function:cint;cdecl;
  263. PX_has_recode_support : function:cint;cdecl;
  264. PX_has_gsf_support : function:cint;cdecl;
  265. PX_is_bigendian : function:cint;cdecl;
  266. PX_get_builddate : function:pcchar;cdecl;
  267. PX_boot : procedure;cdecl;
  268. PX_shutdown : procedure;cdecl;
  269. PX_new3 : function(errorhandler: TPXErrorHandler;
  270. allocproc: TPXAllocHandler;
  271. reallocproc: TPXReallocHandler;
  272. freeproc : TPXFreeHandler;
  273. errorhandler_user_data : pointer) : Ppxdoc_t; cdecl;
  274. PX_new2 : function(errorhandler: TPXErrorHandler;
  275. allocproc: TPXAllocHandler;
  276. reallocproc: TPXReallocHandler;
  277. freeproc : TPXFreeHandler) : Ppxdoc_t; cdecl;
  278. PX_new : function:Ppxdoc_t;cdecl;
  279. PX_open_fp : function(pxdoc:Ppxdoc_t; fp:PFILE):cint;cdecl;
  280. PX_open_file : function(pxdoc:Ppxdoc_t; filename:pcchar):cint;cdecl;
  281. PX_create_file : function(pxdoc:Ppxdoc_t; pxf:Ppxfield_t; numfields:cint; filename:pcchar; _type:cint):cint;cdecl;
  282. PX_create_fp : function(pxdoc:Ppxdoc_t; pxf:Ppxfield_t; numfields:cint; fp:PFILE; _type:cint):cint;cdecl;
  283. PX_get_opaque : function(pxdoc:Ppxdoc_t):pointer;cdecl;
  284. PX_write_primary_index : function(pxdoc:Ppxdoc_t; pxindex:Ppxdoc_t):cint;cdecl;
  285. PX_read_primary_index : function(pindex:Ppxdoc_t):cint;cdecl;
  286. PX_add_primary_index : function(pxdoc:Ppxdoc_t; pindex:Ppxdoc_t):cint;cdecl;
  287. PX_get_record : function(pxdoc:Ppxdoc_t; recno:cint; data:pcchar):pcchar;cdecl;
  288. PX_get_record2 : function(pxdoc:Ppxdoc_t; recno:cint; data:pcchar; deleted:pcint; pxdbinfo:Ppxdatablockinfo_t):pcchar;cdecl;
  289. PX_put_recordn : function(pxdoc:Ppxdoc_t; data:pcchar; recpos:cint):cint;cdecl;
  290. PX_put_record : function(pxdoc:Ppxdoc_t; data:pcchar):cint;cdecl;
  291. PX_insert_record : function(pxdoc:Ppxdoc_t; dataptr:PPpxval_t):cint;cdecl;
  292. PX_update_record : function(pxdoc:Ppxdoc_t; dataptr:PPpxval_t; recno:cint):cint;cdecl;
  293. PX_delete_record : function(pxdoc:Ppxdoc_t; recno:cint):cint;cdecl;
  294. PX_retrieve_record : function(pxdoc:Ppxdoc_t; recno:cint):PPpxval_t;cdecl;
  295. PX_close : procedure(pxdoc:Ppxdoc_t);cdecl;
  296. PX_delete : procedure(pxdoc:Ppxdoc_t);cdecl;
  297. PX_pack : function(pxdoc:Ppxdoc_t):cint;cdecl;
  298. PX_get_fields : function(pxdoc:Ppxdoc_t):Ppxfield_t;cdecl;
  299. PX_get_field : function(pxdoc:Ppxdoc_t; i:cint):Ppxfield_t;cdecl;
  300. PX_get_num_fields : function(pxdoc:Ppxdoc_t):cint;cdecl;
  301. PX_get_num_records : function(pxdoc:Ppxdoc_t):cint;cdecl;
  302. PX_get_recordsize : function(pxdoc:Ppxdoc_t):cint;cdecl;
  303. PX_set_parameter : function(pxdoc:Ppxdoc_t; name:pcchar; value:pcchar):cint;cdecl;
  304. PX_get_parameter : function(pxdoc:Ppxdoc_t; name:pcchar; value:Ppcchar):cint;cdecl;
  305. PX_set_value : function(pxdoc:Ppxdoc_t; name:pcchar; value:double):cint;cdecl;
  306. PX_get_value : function(pxdoc:Ppxdoc_t; name:pcchar; value:Pdouble):cint;cdecl;
  307. PX_set_targetencoding : function(pxdoc:Ppxdoc_t; encoding:pcchar):cint;cdecl;
  308. PX_set_inputencoding : function(pxdoc:Ppxdoc_t; encoding:pcchar):cint;cdecl;
  309. PX_set_tablename : function(pxdoc:Ppxdoc_t; tablename:pcchar):cint;cdecl;
  310. PX_set_blob_file : function(pxdoc:Ppxdoc_t; filename:pcchar):cint;cdecl;
  311. PX_set_blob_fp : function(pxdoc:Ppxdoc_t; fp:PFILE):cint;cdecl;
  312. PX_has_blob_file : function(pxdoc:Ppxdoc_t):cint;cdecl;
  313. PX_new_blob : function(pxdoc:Ppxdoc_t):Ppxblob_t;cdecl;
  314. PX_open_blob_fp : function(pxdoc:Ppxblob_t; fp:PFILE):cint;cdecl;
  315. PX_open_blob_file : function(pxdoc:Ppxblob_t; filename:pcchar):cint;cdecl;
  316. PX_create_blob_fp : function(pxdoc:Ppxblob_t; fp:PFILE):cint;cdecl;
  317. PX_create_blob_file : function(pxblob:Ppxblob_t; filename:pcchar):cint;cdecl;
  318. PX_close_blob : procedure(pxdoc:Ppxblob_t);cdecl;
  319. PX_delete_blob : procedure(pxblob:Ppxblob_t);cdecl;
  320. PX_read_blobdata : function(pxblob:Ppxblob_t; data:pcchar; len:cint; _mod:pcint; blobsize:pcint):pcchar;cdecl;
  321. PX_read_graphicdata : function(pxblob:Ppxblob_t; data:pcchar; len:cint; _mod:pcint; blobsize:pcint):pcchar;cdecl;
  322. PX_read_grahicdata : function(pxblob:Ppxblob_t; data:pcchar; len:cint; _mod:pcint; blobsize:pcint):pcchar;cdecl;
  323. PX_get_data_alpha : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:Ppcchar):cint;cdecl;
  324. PX_get_data_bytes : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:Ppcchar):cint;cdecl;
  325. PX_get_data_double : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:Pdouble):cint;cdecl;
  326. PX_get_data_long : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pclong):cint;cdecl;
  327. PX_get_data_short : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcsshort):cint;cdecl;
  328. PX_get_data_byte : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcchar):cint;cdecl;
  329. PX_get_data_bcd : function(pxdoc:Ppxdoc_t; data:pcuchar; len:cint; value:Ppcchar):cint;cdecl;
  330. PX_get_data_blob : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; _mod:pcint; blobsize:pcint;
  331. value:Ppcchar):cint;cdecl;
  332. PX_get_data_graphic : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; _mod:pcint; blobsize:pcint;
  333. value:Ppcchar):cint;cdecl;
  334. PX_put_data_alpha : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcchar);cdecl;
  335. PX_put_data_bytes : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcchar);cdecl;
  336. PX_put_data_double : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:double);cdecl;
  337. PX_put_data_long : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:cint);cdecl;
  338. PX_put_data_short : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:csshort);cdecl;
  339. PX_put_data_byte : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:cchar);cdecl;
  340. PX_put_data_bcd : procedure(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcchar);cdecl;
  341. PX_put_data_blob : function(pxdoc:Ppxdoc_t; data:pcchar; len:cint; value:pcchar; valuelen:cint):cint;cdecl;
  342. {$ifndef windows}
  343. PX_SdnToGregorian : procedure(sdn:clong; pYear:pcint; pMonth:pcint; pDay:pcint);cdecl;
  344. {$endif}
  345. PX_GregorianToSdn : function(year:cint; month:cint; day:cint):clong;cdecl;
  346. PX_make_time : function(pxdoc:Ppxdoc_t; hour:cint; minute:cint; second:cint):Ppxval_t;cdecl;
  347. PX_make_date : function(pxdoc:Ppxdoc_t; year:cint; month:cint; day:cint):Ppxval_t;cdecl;
  348. PX_make_timestamp : function(pxdoc:Ppxdoc_t; year:cint; month:cint; day:cint; hour:cint;
  349. minute:cint; second:cint):Ppxval_t;cdecl;
  350. PX_timestamp2string : function(pxdoc:Ppxdoc_t; value:double; format:pcchar):pcchar;cdecl;
  351. PX_time2string : function(pxdoc:Ppxdoc_t; value:clong; format:pcchar):pcchar;cdecl;
  352. PX_date2string : function(pxdoc:Ppxdoc_t; value:clong; format:pcchar):pcchar;cdecl;
  353. PX_strdup : function(pxdoc:Ppxdoc_t; str:pcchar):pcchar;cdecl;
  354. procedure Freepxlib;
  355. Procedure Loadpxlib(lib : String);
  356. implementation
  357. uses
  358. SysUtils, dynlibs;
  359. var
  360. hlib : tlibhandle;
  361. Procedure Freepxlib;
  362. begin
  363. if (HLib<>NilHandle) then
  364. begin
  365. FreeLibrary(hlib);
  366. hlib:=Nilhandle;
  367. end;
  368. PX_get_majorversion:=nil;
  369. PX_get_minorversion:=nil;
  370. PX_get_subminorversion:=nil;
  371. PX_has_recode_support:=nil;
  372. PX_has_gsf_support:=nil;
  373. PX_is_bigendian:=nil;
  374. PX_get_builddate:=nil;
  375. PX_boot:=nil;
  376. PX_shutdown:=nil;
  377. PX_new3:=nil;
  378. PX_new2:=nil;
  379. PX_new:=nil;
  380. PX_open_fp:=nil;
  381. PX_open_file:=nil;
  382. PX_create_file:=nil;
  383. PX_create_fp:=nil;
  384. PX_get_opaque:=nil;
  385. PX_write_primary_index:=nil;
  386. PX_read_primary_index:=nil;
  387. PX_add_primary_index:=nil;
  388. PX_get_record:=nil;
  389. PX_get_record2:=nil;
  390. PX_put_recordn:=nil;
  391. PX_put_record:=nil;
  392. PX_insert_record:=nil;
  393. PX_update_record:=nil;
  394. PX_delete_record:=nil;
  395. PX_retrieve_record:=nil;
  396. PX_close:=nil;
  397. PX_delete:=nil;
  398. PX_pack:=nil;
  399. PX_get_fields:=nil;
  400. PX_get_field:=nil;
  401. PX_get_num_fields:=nil;
  402. PX_get_num_records:=nil;
  403. PX_get_recordsize:=nil;
  404. PX_set_parameter:=nil;
  405. PX_get_parameter:=nil;
  406. PX_set_value:=nil;
  407. PX_get_value:=nil;
  408. PX_set_targetencoding:=nil;
  409. PX_set_inputencoding:=nil;
  410. PX_set_tablename:=nil;
  411. PX_set_blob_file:=nil;
  412. PX_set_blob_fp:=nil;
  413. PX_has_blob_file:=nil;
  414. PX_new_blob:=nil;
  415. PX_open_blob_fp:=nil;
  416. PX_open_blob_file:=nil;
  417. PX_create_blob_fp:=nil;
  418. PX_create_blob_file:=nil;
  419. PX_close_blob:=nil;
  420. PX_delete_blob:=nil;
  421. PX_read_blobdata:=nil;
  422. PX_read_graphicdata:=nil;
  423. PX_read_grahicdata:=nil;
  424. PX_get_data_alpha:=nil;
  425. PX_get_data_bytes:=nil;
  426. PX_get_data_double:=nil;
  427. PX_get_data_long:=nil;
  428. PX_get_data_short:=nil;
  429. PX_get_data_byte:=nil;
  430. PX_get_data_bcd:=nil;
  431. PX_get_data_blob:=nil;
  432. PX_get_data_graphic:=nil;
  433. PX_put_data_alpha:=nil;
  434. PX_put_data_bytes:=nil;
  435. PX_put_data_double:=nil;
  436. PX_put_data_long:=nil;
  437. PX_put_data_short:=nil;
  438. PX_put_data_byte:=nil;
  439. PX_put_data_bcd:=nil;
  440. PX_put_data_blob:=nil;
  441. {$ifndef windows}
  442. PX_SdnToGregorian:=nil;
  443. {$endif}
  444. PX_GregorianToSdn:=nil;
  445. PX_make_time:=nil;
  446. PX_make_date:=nil;
  447. PX_make_timestamp:=nil;
  448. PX_timestamp2string:=nil;
  449. PX_time2string:=nil;
  450. PX_date2string:=nil;
  451. PX_strdup:=nil;
  452. end;
  453. Procedure Loadpxlib(lib : String);
  454. begin
  455. Freepxlib;
  456. hlib:=LoadLibrary(Pchar(lib));
  457. if hlib=0 then
  458. raise Exception.Create(format('Could not load library: %s',[lib]));
  459. pointer(PX_get_majorversion):=GetProcAddress(hlib,'PX_get_majorversion');
  460. pointer(PX_get_minorversion):=GetProcAddress(hlib,'PX_get_minorversion');
  461. pointer(PX_get_subminorversion):=GetProcAddress(hlib,'PX_get_subminorversion');
  462. pointer(PX_has_recode_support):=GetProcAddress(hlib,'PX_has_recode_support');
  463. pointer(PX_has_gsf_support):=GetProcAddress(hlib,'PX_has_gsf_support');
  464. pointer(PX_is_bigendian):=GetProcAddress(hlib,'PX_is_bigendian');
  465. pointer(PX_get_builddate):=GetProcAddress(hlib,'PX_get_builddate');
  466. pointer(PX_boot):=GetProcAddress(hlib,'PX_boot');
  467. pointer(PX_shutdown):=GetProcAddress(hlib,'PX_shutdown');
  468. pointer(PX_new3):=GetProcAddress(hlib,'PX_new3');
  469. pointer(PX_new2):=GetProcAddress(hlib,'PX_new2');
  470. pointer(PX_new):=GetProcAddress(hlib,'PX_new');
  471. pointer(PX_open_fp):=GetProcAddress(hlib,'PX_open_fp');
  472. pointer(PX_open_file):=GetProcAddress(hlib,'PX_open_file');
  473. pointer(PX_create_file):=GetProcAddress(hlib,'PX_create_file');
  474. pointer(PX_create_fp):=GetProcAddress(hlib,'PX_create_fp');
  475. pointer(PX_get_opaque):=GetProcAddress(hlib,'PX_get_opaque');
  476. pointer(PX_write_primary_index):=GetProcAddress(hlib,'PX_write_primary_index');
  477. pointer(PX_read_primary_index):=GetProcAddress(hlib,'PX_read_primary_index');
  478. pointer(PX_add_primary_index):=GetProcAddress(hlib,'PX_add_primary_index');
  479. pointer(PX_get_record):=GetProcAddress(hlib,'PX_get_record');
  480. pointer(PX_get_record2):=GetProcAddress(hlib,'PX_get_record2');
  481. pointer(PX_put_recordn):=GetProcAddress(hlib,'PX_put_recordn');
  482. pointer(PX_put_record):=GetProcAddress(hlib,'PX_put_record');
  483. pointer(PX_insert_record):=GetProcAddress(hlib,'PX_insert_record');
  484. pointer(PX_update_record):=GetProcAddress(hlib,'PX_update_record');
  485. pointer(PX_delete_record):=GetProcAddress(hlib,'PX_delete_record');
  486. pointer(PX_retrieve_record):=GetProcAddress(hlib,'PX_retrieve_record');
  487. pointer(PX_close):=GetProcAddress(hlib,'PX_close');
  488. pointer(PX_delete):=GetProcAddress(hlib,'PX_delete');
  489. pointer(PX_pack):=GetProcAddress(hlib,'PX_pack');
  490. pointer(PX_get_fields):=GetProcAddress(hlib,'PX_get_fields');
  491. pointer(PX_get_field):=GetProcAddress(hlib,'PX_get_field');
  492. pointer(PX_get_num_fields):=GetProcAddress(hlib,'PX_get_num_fields');
  493. pointer(PX_get_num_records):=GetProcAddress(hlib,'PX_get_num_records');
  494. pointer(PX_get_recordsize):=GetProcAddress(hlib,'PX_get_recordsize');
  495. pointer(PX_set_parameter):=GetProcAddress(hlib,'PX_set_parameter');
  496. pointer(PX_get_parameter):=GetProcAddress(hlib,'PX_get_parameter');
  497. pointer(PX_set_value):=GetProcAddress(hlib,'PX_set_value');
  498. pointer(PX_get_value):=GetProcAddress(hlib,'PX_get_value');
  499. pointer(PX_set_targetencoding):=GetProcAddress(hlib,'PX_set_targetencoding');
  500. pointer(PX_set_inputencoding):=GetProcAddress(hlib,'PX_set_inputencoding');
  501. pointer(PX_set_tablename):=GetProcAddress(hlib,'PX_set_tablename');
  502. pointer(PX_set_blob_file):=GetProcAddress(hlib,'PX_set_blob_file');
  503. pointer(PX_set_blob_fp):=GetProcAddress(hlib,'PX_set_blob_fp');
  504. pointer(PX_has_blob_file):=GetProcAddress(hlib,'PX_has_blob_file');
  505. pointer(PX_new_blob):=GetProcAddress(hlib,'PX_new_blob');
  506. pointer(PX_open_blob_fp):=GetProcAddress(hlib,'PX_open_blob_fp');
  507. pointer(PX_open_blob_file):=GetProcAddress(hlib,'PX_open_blob_file');
  508. pointer(PX_create_blob_fp):=GetProcAddress(hlib,'PX_create_blob_fp');
  509. pointer(PX_create_blob_file):=GetProcAddress(hlib,'PX_create_blob_file');
  510. pointer(PX_close_blob):=GetProcAddress(hlib,'PX_close_blob');
  511. pointer(PX_delete_blob):=GetProcAddress(hlib,'PX_delete_blob');
  512. pointer(PX_read_blobdata):=GetProcAddress(hlib,'PX_read_blobdata');
  513. pointer(PX_read_graphicdata):=GetProcAddress(hlib,'PX_read_graphicdata');
  514. pointer(PX_read_grahicdata):=GetProcAddress(hlib,'PX_read_grahicdata');
  515. pointer(PX_get_data_alpha):=GetProcAddress(hlib,'PX_get_data_alpha');
  516. pointer(PX_get_data_bytes):=GetProcAddress(hlib,'PX_get_data_bytes');
  517. pointer(PX_get_data_double):=GetProcAddress(hlib,'PX_get_data_double');
  518. pointer(PX_get_data_long):=GetProcAddress(hlib,'PX_get_data_long');
  519. pointer(PX_get_data_short):=GetProcAddress(hlib,'PX_get_data_short');
  520. pointer(PX_get_data_byte):=GetProcAddress(hlib,'PX_get_data_byte');
  521. pointer(PX_get_data_bcd):=GetProcAddress(hlib,'PX_get_data_bcd');
  522. pointer(PX_get_data_blob):=GetProcAddress(hlib,'PX_get_data_blob');
  523. pointer(PX_get_data_graphic):=GetProcAddress(hlib,'PX_get_data_graphic');
  524. pointer(PX_put_data_alpha):=GetProcAddress(hlib,'PX_put_data_alpha');
  525. pointer(PX_put_data_bytes):=GetProcAddress(hlib,'PX_put_data_bytes');
  526. pointer(PX_put_data_double):=GetProcAddress(hlib,'PX_put_data_double');
  527. pointer(PX_put_data_long):=GetProcAddress(hlib,'PX_put_data_long');
  528. pointer(PX_put_data_short):=GetProcAddress(hlib,'PX_put_data_short');
  529. pointer(PX_put_data_byte):=GetProcAddress(hlib,'PX_put_data_byte');
  530. pointer(PX_put_data_bcd):=GetProcAddress(hlib,'PX_put_data_bcd');
  531. pointer(PX_put_data_blob):=GetProcAddress(hlib,'PX_put_data_blob');
  532. {$ifndef windows}
  533. pointer(PX_SdnToGregorian):=GetProcAddress(hlib,'PX_SdnToGregorian');
  534. {$endif windows}
  535. pointer(PX_GregorianToSdn):=GetProcAddress(hlib,'PX_GregorianToSdn');
  536. pointer(PX_make_time):=GetProcAddress(hlib,'PX_make_time');
  537. pointer(PX_make_date):=GetProcAddress(hlib,'PX_make_date');
  538. pointer(PX_make_timestamp):=GetProcAddress(hlib,'PX_make_timestamp');
  539. pointer(PX_timestamp2string):=GetProcAddress(hlib,'PX_timestamp2string');
  540. pointer(PX_time2string):=GetProcAddress(hlib,'PX_time2string');
  541. pointer(PX_date2string):=GetProcAddress(hlib,'PX_date2string');
  542. pointer(PX_strdup):=GetProcAddress(hlib,'PX_strdup');
  543. end;
  544. finalization
  545. Freepxlib;
  546. end.