README.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. This is the Free Pascal interface to the GDBM library routines.
  2. Essentially, this is a translation of the gdbm.h header files, with some
  3. additional routines.
  4. The headers translated without any problems, the only thing that should
  5. be taken into account is that the
  6. GDBM_SYNC constant (for open flags) has been renamed to GDMB_DOSYNC
  7. because it conflicts with the gdbm_sync function.
  8. Be careful: the TDatum.dptr data pointer which is allocated by the
  9. gdbm routines should be freed by the C free() call, NOT with the
  10. pascal FreeMem() call.
  11. A solution for this is to use the 'cmem' unit, which replaces the standard
  12. FPC memory manager with the C memory manager. In that case, freemem()
  13. may be used to free the dptr field of the TDatum record.
  14. On top of the plain C header translations, The GDBM routines have been
  15. overloaded with routines that accept plain strings as key or data
  16. parameters. This means the following routines have been added:
  17. function gdbm_open(Const para1:string; para2:longint; para3:longint; para4:longint; para5:TGDBMErrorCallBack ):PGDBM_FILE;
  18. function gdbm_store(para1:PGDBM_FILE; Const para2:string; Const para3:string; para4:longint):Boolean;
  19. function gdbm_fetch(para1:PGDBM_FILE; Const para2:string):string;
  20. function gdbm_delete(para1:PGDBM_FILE; Const para2:string):boolean;
  21. procedure gdbm_firstkey(para1:PGDBM_FILE; var key :string);
  22. function gdbm_nextkey(para1:PGDBM_FILE; Const para2:string):string;
  23. function gdbm_exists(para1:PGDBM_FILE; Const para2:string):boolean;
  24. They are just the C routines, but with the TDatum type (a record)
  25. replaced by a string. The routines take automatically care of memory
  26. deallocation.
  27. Functions that returned an integer to indicate success or failure have been
  28. replaced by functions that return a boolean.
  29. Careful:
  30. When using ansistrings, make sure the gdbm unit has been compiled
  31. with the -Sh switch. The unit should work with both kinds of strings.
  32. There are 2 test programs:
  33. testgdbm tests the raw C header translation
  34. testgdbm2 tests the String interface to the GDBM routines.
  35. That's about it.
  36. Enjoy!
  37. Michael. ([email protected])