home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Pascal / BPASCAL.700 / D12 / PXWIN.ZIP / PXENGINE.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1992-10-01  |  35.1 KB  |  911 lines

  1. {************************************************}
  2. {                                                }
  3. {   Paradox Engine demo interface unit           }
  4. {   Copyright (c) 1991 by Borland International  }
  5. {                                                }
  6. {************************************************}
  7.  
  8. unit PXEngine;
  9.  
  10. interface
  11.  
  12. uses WinProcs,WinTypes;
  13.  
  14. const
  15.  internalVersion  = $02000002;    { version number, same }
  16.                                   { as found in .lib files }
  17. { Type definitions  }
  18. type
  19.   TableHandle = word;             { table handle }
  20.   RecordHandle = word;            { record handle }
  21.   FieldHandle = word;             { field number 1.. }
  22.   LockHandle = Integer;           { lock handle }
  23.   RecordNumber = LongInt;         { record number 1.. }
  24.   Date = LongInt;                 { representation of date }
  25.  
  26. { Maximum and default values for dynamic configuration. }
  27. { The default values are used if not overwritten in PXSetDefaults (DOS) }
  28. { or in WIN.INI (Windows) }
  29. const
  30.   PXDefault =   0;                { use internal default value }
  31.  
  32.   MaxTableHandles =  64;          { maximum number of open }
  33.                                   { tables allowed at a time }
  34.   DefTableHandles =   5;          { default number of open }
  35.                                   { tables allowed at a time }
  36.   MaxRecordHandles = 128;         { maximum number of record }
  37.                                   { buffers available }
  38.   DefRecordHandles =  10;         { default number of record }
  39.                                   { buffers available }
  40.   MaxLockHandles = 128;           { maximum number of lock }
  41.                                   { handles per table }
  42.   DefLockHandles =  32;           { default number of lock }
  43.                                   { handles per table }
  44.   MaxFileHandles = 255;           { maximum number of DOS file }
  45.                                   { handles to use }
  46.   MinFileHandles =   2;           { minimum number of DOS file }
  47.                                   { handles to use }
  48.   DefFileHandles =  10;           { default number of DOS file }
  49.                                   { handles to use }
  50. const
  51.   DefSortOrder = #255;            { default sort order (ASCII) }
  52.  
  53. { Swap buffer size }
  54. const
  55.   MaxSwapSize = 256;              { maximum buffer size allowed (k)}
  56.   MinSwapSize =   8;              { minimum buffer size allowed (k)}
  57.   DefSwapSize =  32;              { default buffer size (k) }
  58.  
  59. { Network codes }
  60. { used in PXNetInit }
  61. const
  62.   NotOnNet = 1;                   { Not on a net }
  63.   NovellNet = 2;                  { Novell }
  64.   ThreeComNet = 3;                { 3Com }
  65.   ThreeOpenNet = 4;               { 3Com 3+Open }
  66.   OtherNet = 5;                   { other: unknown DOS 3.1 compatible }
  67.   StarLanNet = 7;                 { Starlan }
  68.   BanyanNet = 8;                  { Banyan }
  69.   IBMPCNet = 9;                   { IBM PC }
  70.  
  71. const
  72.   LocalShare = 32;                { enables sharing on local drives with }
  73.                                   { any net type }
  74.                                   { (i.e. OTHERNET | LOCALSHARE) }
  75. const
  76.   DefUserName = nil;              { use default username in PXNetInit() }
  77.  
  78.  
  79. { used in PXKeyAdd }
  80. const
  81.   Primary =  0;                   { primary index (key) }
  82.   Secondary =  1;                 { not maintained secondary index }
  83.   IncSecondary =  2;              { maintained secondary index }
  84.  
  85. { used in PXSrchFld, PXSrchKey }
  86. const
  87.   SearchFirst = 0;                { search from beginning of table }
  88.   SearchNext = 1;                 { search from next record in table }
  89.   ClosestRecord = 2;              { (modifier) goto 'nearest' record if }
  90.                                   { no match found (ordered fields only) }
  91.  
  92. { Lock types }
  93. { used in PXNetFileLock, PXNetFileUnlock, PXNetTblLock, PXNetTblUnlock }
  94. const
  95.   FL = 1;                         { full lock, no concurrency }
  96.   WL = 2;                         { write lock }
  97.   PWL = 3;                        { prevent write lock }
  98.   PFL = 4;                        { prevent full lock, full concurrency }
  99.  
  100. { macros for checking blank values }
  101. const
  102.   BlankDate = $80000000;
  103.   BlankLong = $80000000;
  104.   BlankShort = $8000;
  105.  
  106. function IsBlankAlpha(x: PChar): Boolean;
  107. inline(
  108.   $58/       { POP AX       }
  109.   $5A/       { POP DX       }
  110.   $1E/       { PUSH DS      }
  111.   $DA8E/     { MOV DS,DX    }
  112.   $C689/     { MOV SI,AX    }
  113.   $C031/     { XOR AX,AX    }
  114.   $AC/       { LODSB        }
  115.   $1F        { POP DS       }
  116. );
  117.  
  118. function IsBlankShort(x: Integer): Boolean;
  119. inline(
  120.   $58/       { POP AX       }
  121.   $35/$8000/ { XOR AX,$8000 }
  122.   $D8F7/     { NEG AX       }
  123.   $C01B/     { SBB AX,AX    }
  124.   $40        { INC AX       }
  125. );
  126.  
  127. function IsBlankLong(x: LongInt): Boolean;
  128. inline(
  129.   $5A/       { POP DX       }
  130.   $58/       { POP AX       }
  131.   $35/$8000/ { XOR AX,$8000 }
  132.   $C20B/     { OR  AX,DX    }
  133.   $D8F7/     { NEG AX       }
  134.   $C01B/     { SBB AX,AX    }
  135.   $40        { INC AX       }
  136. );
  137.  
  138. function IsBlankDate(x: Date): Boolean;
  139. inline(
  140.   $5A/       { POP DX       }
  141.   $58/       { POP AX       }
  142.   $35/$8000/ { XOR AX,$8000 }
  143.   $C20B/     { OR  AX,DX    }
  144.   $D8F7/     { NEG AX       }
  145.   $C01B/     { SBB AX,AX    }
  146.   $40        { INC AX       }
  147. );
  148.  
  149.  
  150. { successful Engine function operation returns }
  151. const
  152.   PXSuccess = 0;
  153.  
  154. { Error codes from Engine functions }
  155.  
  156. { initialization errors }
  157. const
  158.   PXErr_NotInitErr = 78;          { Engine not initialized }
  159.   PXErr_AlreadyInit = 82;         { Engine already initialized }
  160.   PXErr_NotLoggedIn = 98;         { Could not login on network }
  161.                                   { (to PARADOX.NET) }
  162.   PXErr_NoNetInit = 107;          { Engine not initialized }
  163.                                   { with PXNetInit }
  164.   PXErr_NetMultiple = 15;         { multiple PARADOX.NET files }
  165.  
  166.   PXErr_CantSharePDoxNet = 134;   { can't lock PARADOX.NET -- is }
  167.                                   { SHARE.EXE loaded? }
  168.   PXErr_WindowsRealMode = 135;    { can't run Engine in Windows  }
  169.                                   { real mode }
  170.  
  171. { hardware related errors }
  172. const
  173.   PXErr_DriveNotReady = 1;        { Drive not ready }
  174.   PXErr_DiskWritePro = 124;       { Disk is write protected }
  175.   PXErr_GeneralFailure = 126;     { General hardware error }
  176.  
  177. { directory reg error codes }
  178. const
  179.   PXErr_DirNotFound = 2;          { Directory not found }
  180.   PXErr_DirBusy = 10;             { Sharing violation }
  181.   PXErr_DirLocked  = 11;          { Sharing violation }
  182.   PXErr_DirNoAccess = 12;         { No access to directory }
  183.   PXErr_DirNotPrivate = 14;       { Single user, but directory is }
  184.                                   { shared }
  185.  
  186. { file oriented errors }
  187. const
  188.   PXErr_FileBusy = 3;             { File is busy }
  189.   PXErr_FileLocked = 4;           { File is locked }
  190.   PXErr_FileNotFound = 5;         { Could not find file }
  191.  
  192. { table oriented errors }
  193. const
  194.   PXErr_TableBusy = 118;          { Table is busy }
  195.   PXErr_TableLocked = 119;        { Table is locked }
  196.   PXErr_TableNotFound = 120;      { Table was not found }
  197.   PXErr_TableOpen =  83;          { Unable to perform operation }
  198.                                   { on open table }
  199.   PXErr_TableIndexed =  94;       { Table is indexed }
  200.   PXErr_TableNotIndexed =  95;    { Table is not indexed }
  201.   PXErr_TableEmpty = 105;         { Operation on empty table }
  202.   PXErr_TableWritePro =  22;      { Table is write protected }
  203.  
  204.   PXErr_TableCorrupted =   6;     { Table is corrupted }
  205.   PXErr_TableFull = 128;          { Table is full }
  206.   PXErr_TableSQL = 130;           { Table is SQL replica }
  207.   PXErr_InsufRights =  21;        { Insufficient password rights }
  208.  
  209.  
  210. { index oriented errors }
  211. const
  212.   PXErr_XCorrupted = 7;           { Primary index is corrupted }
  213.   PXErr_XOutOfDate = 8;           { Primary index is out of date }
  214.   PXErr_XSortVersion = 13;        { Sort for index different }
  215.                                   { from table }
  216.  
  217.   PXErr_SXCorrupted = 122;        { Secondary index is corrupted }
  218.   PXErr_SXOutOfDate =  96;        { Secondary index is out of date }
  219.   PXErr_SXNotFound = 121;         { Secondary index was not found }
  220.   PXErr_SXOpen = 123;             { Secondary index is already open }
  221.   PXErr_SXCantUpdate = 136;       { Can't update table open on non-maintained secondary }
  222.  
  223.   PXErr_RecTooBig = 125;          { Record too big for index }
  224.  
  225. { record oriented errors }
  226. const
  227.   PXErr_RecDeleted = 50;          { Another user deleted record }
  228.   PXErr_RecLocked = 9;            { Record is locked }
  229.   PXErr_RecNotFound = 89;         { Record was not found }
  230.   PXErr_KeyViol = 97;             { Key violation }
  231.  
  232.   PXErr_EndOfTable = 101;         { End of table }
  233.   PXErr_StartOfTable = 102;       { Start of table }
  234.  
  235.  
  236. { errors specific for Windows Engine DLL }
  237. const
  238.   PXErr_TooManyClients = 131;
  239.   PXErr_ExceedsConfigLimits = 132;
  240.   PXErr_CantRemapFileHandle = 133;
  241.  
  242. { resource errors }
  243. const
  244.   PXErr_OutOfMem = 40;            { Not enough memory to }
  245.                                   { complete operation }
  246.   PXErr_OutOfDisk = 41;           { Not enough disk space to }
  247.                                   { complete operation }
  248.   PXErr_OutOfStack = 127;         { Not enough stack space to }
  249.                                   { complete operation }
  250.   PXErr_OutOfSwapBuf = 129;       { Not enough swap buffer space to }
  251.                                   { complete operation }
  252.  
  253.   PXErr_OutOfFileHandles = 70;    { No more file handles available }
  254.   PXErr_OutOfTableHandles = 72;   { No more table handles available }
  255.   PXErr_OutOfRecHandles = 103;    { No more record handles available }
  256.   PXErr_OutOfLockHandles = 111;   { Too many locks on table }
  257.  
  258.   PXErr_NoMoreTmpNames = 86;      { No more temporary names }
  259.                                   { available }
  260.   PXErr_TooManyPassw = 115;       { Too many passwords specified }
  261.  
  262.  
  263. { invalid parameters to functions }
  264. const
  265.   PXErr_TypeMismatch = 30;        { Data type mismatch }
  266.   PXErr_OutOfRange = 31;          { Argument out of range }
  267.   PXErr_InvParameter = 33;        { Invalid argument }
  268.   PXErr_InvDate = 73;             { Invalid date given }
  269.  
  270.   PXErr_InvFieldHandle = 75;      { Invalid field handle }
  271.   PXErr_InvRecHandle = 104;       { Invalid record handle }
  272.   PXErr_InvTableHandle = 76;      { Invalid table handle }
  273.   PXErr_InvLockHandle = 110;      { Invalid lock handle }
  274.  
  275.   PXErr_InvDirName = 114;         { Invalid directory name }
  276.   PXErr_InvFileName = 108;        { Invalid file name }
  277.   PXErr_InvTableName = 99;        { Invalid table name }
  278.   PXErr_InvFieldName = 74;        { Invalid field name }
  279.  
  280.   PXErr_InvLockCode = 106;        { Invalid lock code }
  281.   PXErr_InvUnlock = 109;          { Invalid unlock }
  282.   PXErr_InvSortOrder = 112;       { Invalid sort order table }
  283.   PXErr_InvPassw = 116;           { Invalid password }
  284.   PXErr_InvNetType = 113;         { Invalid net type (PXNetInit) }
  285.   PXErr_BufTooSmall = 117;        { Buffer too small for result }
  286.  
  287.   PXErr_StructDiffer = 81;        { Table structures are different }
  288.  
  289.   PXErr_InvEngineState = 79;      { Previous fatal error; }
  290.                                   { cannot proceed }
  291.  
  292. { values for ShareMode argument to PXWinInit }
  293. const
  294.   PXSingleClient = 0;             { allow no other client access to Engine DLL }
  295.   PXExclusive = 1;                { open all tables with FULL LOCK }
  296.   PXShared = 2;                   { open all tables with PREVENT FULL LOCK }
  297.  
  298. { prototypes for engine functions }
  299.  
  300. { declarations of sort order tables, used in PXSetDefaults }
  301. const
  302.   SortOrderAscii = 'a';           { ASCII sort order }
  303.   SortOrderInt = 'i';             { international sort order }
  304.   SortOrderNorDan = 'n';          { Norwegian/Danish sort order }
  305.   SortOrderSwedFin = 's';         { Swedish/Finnish sort order }
  306.  
  307. { INITIALIZATION AND FINALIZATION FUNCTIONS }
  308.  
  309. { initialize Engine connection in Windows environment }
  310. function PXWinInit(
  311.   clientName: PChar;              { string containing name of application }
  312.   ShareMode: Integer              { Share mode: PXSingleClient, }
  313.                                   { PXExclusive, or PXShared }
  314.   ): Integer;
  315.  
  316. { exit and deallocate }
  317. function PXExit: Integer;
  318.  
  319. { overwrites internal default values }
  320. function PXSetDefaults(
  321.   bufSize: Integer;               { internal swap buffer size }
  322.                                   { MinSwapSize..MaxSwapSize (8..256), }
  323.                                   { default DefSwapSize (32) }
  324.                                   { allocated at initialization time }
  325.   maxTables: Integer;             { max number of tables open at a time }
  326.                                   { range 1..MaxTableHandles ,   (1..64) }
  327.                                   { default  DefTableHandles     (5) }
  328.   maxRecBufs: Integer;            { max number of record buffers at a time}
  329.                                   { range 1..MaxRecordHandles ,  (1..128) }
  330.                                   { default  DefRecordHandles    (10) }
  331.   maxLocks: Integer;              { max number of locks per table }
  332.                                   { range 1..MaxLockHandles  ,   (1..128) }
  333.                                   { default DefLockHandles       (32) }
  334.   maxFiles: Integer;              { max number of file handles to use }
  335.                                   { range MinFileHandles..MaxFileHandles }
  336.                                   { default DefFileHandles       (10) }
  337.   sortOrder: Char                 { code for sort order table defined }
  338.                                   { internally in the Engine : }
  339.                                   { SortOrderAscii/SortOrderInt/ }
  340.                                   { SortOrderNorDan/SortOrderSwedFin }
  341.                                   { default : SortOrderAscii }
  342.   ): Integer;
  343.  
  344.  
  345. { returns current default settings }
  346. function PXGetDefaults(
  347.   var swapSize: Integer;          { returns internal swap buffer size }
  348.   var maxTables: Integer;         { returns max number of tables at a time }
  349.   var maxRecBufs: Integer;        { returns max number of record buffers }
  350.   var maxLocks: Integer;          { returns max number of locks per table }
  351.   var maxFiles: Integer;          { returns max number of file handles to use }
  352.   var sortTable: Char             { returns code indicating default sort table }
  353.   ): Integer;
  354.  
  355. { enables/disables internal hardware error handler }
  356. function PXSetHWHandler(
  357.   hwHandler: Bool                 { enable(True) / disable (False) }
  358.   ): Integer;                     { default True }
  359.  
  360.  
  361. { UTILITY FUNCTIONS }
  362.  
  363. function IsBlankDouble(x: Double): Bool;
  364. procedure BlankDouble(var x: Double);
  365.  
  366. { TABLE FUNCTIONS }
  367.  
  368. { open table for access, returning table handle }
  369. function PXTblOpen(
  370.   tblName: PChar;                 { name of table to open }
  371.   var tblHandle: TableHandle;     { returns handle for opened table }
  372.   indexID: Integer;               { =0 mastertable else indexnumber }
  373.   saveEveryChange: Bool           { save each record as it is changed }
  374.                                   { don't buffer changes }
  375.   ): Integer;
  376.  
  377.  
  378. { close access to table }
  379. function PXTblClose(
  380.   tblHandle: TableHandle          { tblHandle of table to close }
  381.   ): Integer;
  382.  
  383. { create empty table }
  384. function PXTblCreate(
  385.   tblName: PChar;                 { name of table to create }
  386.   nFields: Integer;               { number of fields in table }
  387.   var fields;                     { field names }
  388.   var types                       { field types (N, S..) }
  389.   ): Integer;
  390.  
  391. { clear table for records }
  392. function PXTblEmpty(
  393.   tblName: PChar                  { name of table to empty }
  394.   ): Integer;
  395.  
  396. { delete table and its family }
  397. function PXTblDelete(
  398.   tblName: PChar                  { name of table to delete }
  399.   ): Integer;
  400.  
  401. { copy table and its family }
  402. function PXTblCopy(
  403.   fromName: PChar;                { source table of copy }
  404.   toName: PChar                   { destination table of copy }
  405.   ): Integer;
  406.  
  407. { rename table and its family }
  408. function PXTblRename(
  409.   fromName: PChar;                { source table of copy }
  410.   toName: PChar                   { destination table of copy }
  411.   ): Integer;
  412.  
  413. { add records from one table to another table }
  414. function PXTblAdd(
  415.   srcName: PChar;                 { source table of add }
  416.   destName: PChar                 { destination table of add }
  417.   ): Integer;
  418.  
  419.  
  420. { RECORD FUNCTIONS }
  421.  
  422. { insert record buffer in database (as last record if Heap) }
  423. function PXRecAppend(
  424.   tblHandle: TableHandle;         { table to append record to }
  425.   recHandle: RecordHandle         { record to append }
  426.   ): Integer;
  427.  
  428. { insert record buffer in database (before current if Heap) }
  429. function PXRecInsert(
  430.   tblHandle: TableHandle;         { table to insert record into }
  431.   recHandle: RecordHandle         { record to insert }
  432.   ): Integer;
  433.  
  434. { updates current record in database with contents of the record buffer }
  435. function PXRecUpdate(
  436.   tblHandle: TableHandle;         { table to update record into }
  437.   recHandle: RecordHandle         { changed record to post }
  438.   ): Integer;
  439.  
  440. { delete current record in table }
  441. function PXRecDelete(
  442.   tblHandle: TableHandle          { table to delete record in }
  443.   ): Integer;
  444.  
  445. { creates a record buffer for a table }
  446. function PXRecBufOpen(
  447.   tblHandle: TableHandle;         { table to create buffer for }
  448.   var recHandle: RecordHandle     { returns handle to record buffer }
  449.   ): Integer;
  450.  
  451. { deletes a record buffer for a table }
  452. function PXRecBufClose(
  453.   recHandle: RecordHandle         { record buffer to remove }
  454.   ): Integer;
  455.  
  456. { clears the record buffer (to blanks) }
  457. function PXRecBufEmpty(
  458.   recHandle: RecordHandle         { record buffer to clear }
  459.   ): Integer;
  460.  
  461. { copy record from a record buffer to another (compatible) record buffer }
  462. function PXRecBufCopy(
  463.   fromHandle: RecordHandle;       { record buffer to copy from }
  464.   toHandle: RecordHandle          { record buffer to copy to   }
  465.   ): Integer;
  466.  
  467. { gets the current record from the database into the record buffer }
  468. function PXRecGet(
  469.   tblHandle: TableHandle;         { table to get record from }
  470.   recHandle: RecordHandle         { record buffer to put record in }
  471.   ): Integer;
  472.  
  473. { FIELD FUNCTIONS }
  474.  
  475. { put short value into N/$/S field in record buffer }
  476. function PXPutShort(
  477.   recHandle: RecordHandle;        { record buffer to put value in }
  478.   fldHandle: FieldHandle;         { field in record }
  479.   value: Integer                  { value to put }
  480.   ): Integer;
  481.  
  482. { put Double value into N/$/S field in record buffer }
  483. function PXPutDoub(
  484.   recHandle: RecordHandle;        { record buffer to put value in }
  485.   fldHandle: FieldHandle;         { field in record }
  486.   value: Double                   { value to put }
  487.   ): Integer;
  488.  
  489. { put LongInt value into N/$/S field in record buffer }
  490. function PXPutlong(
  491.   recHandle: RecordHandle;        { record buffer to put value in }
  492.   fldHandle: FieldHandle;         { field in record }
  493.   value: LongInt                  { value to put }
  494.   ): Integer;
  495.  
  496. { put string into Alpha field in record buffer }
  497. function PXPutAlpha(
  498.   recHandle: RecordHandle;        { record buffer to put value in }
  499.   fldHandle: FieldHandle;         { field in record }
  500.   value: PChar                    { value to put }
  501.   ): Integer;
  502.  
  503. { put LongInt value into date field (encoded value) in record buffer }
  504. function PXPutDate(
  505.   recHandle: RecordHandle;        { record buffer to put value in }
  506.   fldHandle: FieldHandle;         { field in record }
  507.   value: Date                     { value to put }
  508.   ): Integer;
  509.  
  510. { put blank value into field in record buffer }
  511. function PXPutBlank(
  512.   recHandle: RecordHandle;        { record buffer to put blank in }
  513.   fldHandle: FieldHandle          { field in record }
  514.   ): Integer;
  515.  
  516. { get value from N/$/S field in record buffer, into short }
  517. function PXGetShort(
  518.   recHandle: RecordHandle;        { record buffer to get value from }
  519.   fldHandle: FieldHandle;         { field to get value from }
  520.   var value: Integer              { returns value }
  521.   ): Integer;
  522.  
  523. { get value from N/$/S field in record buffer, into Double }
  524. function PXGetDoub(
  525.   recHandle: RecordHandle;        { record buffer to get value from }
  526.   fldHandle: FieldHandle;         { field to get value from }
  527.   var value: Double               { returns value }
  528.   ): Integer;
  529.  
  530. { get value from N/$/S field in record buffer, into LongInt }
  531. function PXGetlong(
  532.   recHandle: RecordHandle;        { record buffer to get value from }
  533.   fldHandle: FieldHandle;         { field to get value from }
  534.   var value: LongInt              { returns value }
  535.   ): Integer;
  536.  
  537. { get string from alpha field in record buffer }
  538. function PXGetAlpha(
  539.   recHandle: RecordHandle;        { record buffer to get value from }
  540.   fldHandle: FieldHandle;         { field to get value from }
  541.   bufSize: Integer;               { size of return buffer }
  542.   dest: PChar                     { return buffer }
  543.   ): Integer;
  544.  
  545. { get value from date field in record buffer, into LongInt  (encoded value) }
  546. function PXGetDate(
  547.   recHandle: RecordHandle;        { record buffer to get value from }
  548.   fldHandle: FieldHandle;         { field to get value from }
  549.   var value: Date                 { returns value }
  550.   ): Integer;
  551.  
  552. { is value in specified field in record buffer a blank? }
  553. function PXFldBlank(
  554.   recHandle: RecordHandle;        { record to test value in }
  555.   fldHandle: FieldHandle;         { field to test }
  556.   var Blank: Bool                 { returns True/False }
  557.   ): Integer;
  558.  
  559. { move to record with specified record number }
  560. function PXRecGoto(
  561.   tblHandle: TableHandle;         { tblHandle of table to move in }
  562.   recNum: RecordNumber            { record number to move to }
  563.   ): Integer;
  564.  
  565. { move to first record in table }
  566. function PXRecFirst(
  567.   tblHandle: TableHandle          { table to move in }
  568.   ): Integer;
  569.  
  570. { move to last record in table }
  571. function PXRecLast(
  572.   tblHandle: TableHandle          { table to move in }
  573.   ): Integer;
  574.  
  575. { move to next record in table }
  576. function PXRecNext(
  577.   tblHandle: TableHandle          { table to move in }
  578.   ): Integer;
  579.  
  580. { move to previous record in table }
  581. function PXRecPrev(
  582.   tblHandle: TableHandle          { table to move in }
  583.   ): Integer;
  584.  
  585. { INDEX FUNCTIONS }
  586.  
  587. { add a primary or secondary (maintained/nonmaintained) index }
  588. function PXKeyAdd(
  589.   tblName: PChar;                 { name of table to add index for  }
  590.   nFlds: Integer;                 { number of fields in index }
  591.   var fldHandles;                 { array of field numbers in index }
  592.   mode: Integer                   { type of index to create }
  593.                                   { PRIMARY/SECONDARY/INCSECONDARY }
  594.   ): Integer;
  595.  
  596. { delete an index for a table (primary/secondary) }
  597. function PXKeyDrop(
  598.   tblName: PChar;                 { name of table to delete index for }
  599.   indexID: Integer                { 0 if primary key, else field number }
  600.                                   { of secondary index }
  601.   ): Integer;
  602.  
  603.  
  604. { DATE FUNCTIONS }
  605.  
  606. { decodes a date value stored in the Paradox format }
  607. function PXDateDecode(
  608.   aDate: Date;                    { LongInt value to decode }
  609.   var mo: Integer;                { decoded month value }
  610.   var da: Integer;                { decoded date value }
  611.   var yr: Integer                 { decoded year value }
  612.   ): Integer;
  613.  
  614. { encodes a date value to a LongInt value in Paradox format }
  615. function PXDateEncode(
  616.   mo,                             { month value to encode }
  617.   da,                             { date value to encode }
  618.   yr: Integer;                    { year value to encode }
  619.   var aDate: Date                 { encoded date value }
  620.   ): Integer;
  621.  
  622. { SEARCH FUNCTIONS }
  623.  
  624. { Searches a table for a given (sub) key }
  625. function PXSrchKey(
  626.   tblHandle: TableHandle;         { table to search in }
  627.   recHandle: RecordHandle;        { record buffer containing key to find }
  628.   nFlds,                          { number of fields in key }
  629.   mode: Integer                   { searching from first/next record }
  630.   ): Integer;
  631.  
  632. function PXSrchFld(
  633.   tblHandle: TableHandle;         { table to search in }
  634.   recHandle: RecordHandle;        { record buffer containing field to find }
  635.   fldHandle: FieldHandle;         { field number to search on }
  636.   mode: Integer                   { searching from first/next record }
  637.   ): Integer;
  638.  
  639. { PASSWORD FUNCTIONS }
  640.  
  641. { checks if table is encrypted }
  642. function PXTblProtected(
  643.   tblName: PChar;                 { name of table to check }
  644.   var Protected: Bool             { returns True/False }
  645.   ): Integer;
  646.  
  647. { enters a password to the Engine }
  648. function PXPswAdd(
  649.   password: PChar                 { password to enter into system }
  650.   ): Integer;
  651.  
  652. { deletes a password previously entered }
  653. function PXPswDel(
  654.   password: PChar                 { password to remove from system }
  655.   ): Integer;
  656.  
  657. { encrypt a table and make it password protected }
  658. function PXTblEncrypt(
  659.   tblName: PChar;                 { name of table to encrypt }
  660.   password: PChar                 { password for encrypted table }
  661.   ): Integer;
  662.  
  663. { decrypt a table, password must already have been entered }
  664. function PXTblDecrypt(
  665.   tblName: PChar                  { name of table to decrypt }
  666.   ): Integer;
  667.  
  668.  
  669. { INFORMATIONAL FUNCTIONS }
  670.  
  671. { checks if table exists }
  672. function PXTblExist(
  673.   tblName: PChar;                 { name of table to check }
  674.   var Exist: Bool                 { returns TRUE/FALSE }
  675.   ) : Integer;
  676.  
  677. { returns table name corresponding to a table handle }
  678. function PXTblName(
  679.   tblHandle: TableHandle;         { table to return name of }
  680.   bufSize: Integer;               { size of return buffer }
  681.   tblName: PChar                  { name of table, without extension }
  682.   ): Integer;
  683.  
  684. { returns record number of current record in table }
  685. function PXRecNum(
  686.   tblHandle: TableHandle;         { table to get record number from }
  687.   var recNum: RecordNumber        { returns record number }
  688.   ): Integer;
  689.  
  690. { returns number of records in table }
  691. function PXTblNRecs(
  692.   tblHandle: TableHandle;         { table to get number of records from }
  693.   var nRecs: RecordNumber         { returns number of records }
  694.   ): Integer;
  695.  
  696. { returns number of fields in a record }
  697. function PXRecNFlds(
  698.   tblHandle: TableHandle;         { table to get number of fields from }
  699.   var nFlds: Integer              { returns number of fields in a record }
  700.   ): Integer;
  701.  
  702. { return number of fields in key for table }
  703. function PXKeyNFlds(
  704.   tblHandle: TableHandle;         { table to get key size for }
  705.   var nKeyFlds: Integer           { returns number of fields in key }
  706.   ): Integer;
  707.  
  708. { returns field number of a given field name in a table }
  709. function PXFldHandle(
  710.   tblHandle: TableHandle;         { table to get field number from }
  711.   fieldName: PChar;               { name of field in table }
  712.   var fldHandle: FieldHandle      { returns field number }
  713.   ): Integer;
  714.  
  715. { returns field type of a given field in a table }
  716. function PXFldType(
  717.   tblHandle: TableHandle;         { table to get field type from }
  718.   fldHandle: FieldHandle;         { field number of field in table }
  719.   bufSize: Integer;               { size of return buffer }
  720.   fldType: PChar                  { field type of field as string }
  721.   ): Integer;
  722.  
  723. { returns field name of a given field in a table }
  724. function PXFldName(
  725.   tblHandle: TableHandle;         { table to get field name from }
  726.   fldHandle: FieldHandle;         { field number of field in table }
  727.   bufSize: Integer;               { size of return buffer }
  728.   fldName: PChar                  { returns name of field }
  729.   ): Integer;
  730.  
  731.  
  732. { MISCELLANEOUS FUNCTIONS }
  733. { sets maximum size of tables created with PXTblCreat() }
  734. function PXTblMaxSize(
  735.   maxsize: Integer                { maximum size of table }
  736.                                   { 64/128/256  (Megabytes) }
  737.   ): Integer;
  738.  
  739. { saves all buffered changes to disk }
  740. function PXSave: Integer;
  741.  
  742. { CONCURRENCY FUNCTIONS }
  743. { can be used only if PXNetInit() or PXWinInit() was successful }
  744.  
  745. { returns name of user as known on network }
  746. function PXNetUserName(
  747.   bufSize: Integer;               { size of return buffer }
  748.   userName: PChar                 { returns user name }
  749.   ): Integer;
  750.  
  751. { locks a file with specified lock (general function) }
  752. function PXNetFileLock(
  753.   fileName: PChar;                { name of file to lock }
  754.   lockType: Integer               { type of lock to put on file }
  755.                                   { (FL, WL, PFL, PWL) }
  756.   ): Integer;
  757.  
  758.  
  759. { unlocks a file with specified lock (general function) }
  760. function PXNetFileUnlock(
  761.   fileName: PChar;                { name of file to unlock }
  762.   lockType: Integer               { type of lock to remove from file }
  763.                                   { (FL, WL, PFL, PWL) }
  764.   ): Integer;
  765.  
  766.  
  767. { locks an open table with specified lock }
  768. function PXNetTblLock(
  769.   tblHandle: TableHandle;         { table to lock }
  770.   lockType: Integer               { type of lock to put on table }
  771.                                   { (FL, WL, PFL, PWL) }
  772.   ): Integer;
  773.  
  774.  
  775. { unlocks an open table with specified lock }
  776. function PXNetTblUnlock(
  777.   tblHandle: TableHandle;         { table to unlock }
  778.   lockType: Integer               { type of lock to remove from table }
  779.                                   { (FL, WL, PFL, PWL) }
  780.   ): Integer;
  781.  
  782. { locks the current record in a table }
  783. function PXNetRecLock(
  784.   tblHandle: TableHandle;         { table to lock record in }
  785.   var lckHandle: LockHandle       { returns handle to lock  }
  786.   ): Integer;
  787.  
  788. { unlocks record associated with lock handle in the table }
  789. function PXNetRecUnlock(
  790.   tblHandle: TableHandle;         { table to unlock record in }
  791.   lckHandle: LockHandle           { lock handle of record to unlock }
  792.   ): Integer;
  793.  
  794. { checks if current record in table is locked (by any user) }
  795. function PXNetRecLocked(
  796.   tblHandle: TableHandle;         { table to check record in }
  797.   var Locked: Bool                { returns True/False }
  798.   ): Integer;
  799.  
  800. { moves to the record in the table associated with the lock handle }
  801. function PXNetRecGotoLock(
  802.   tblHandle: TableHandle;         { table to move in }
  803.   lckHandle: LockHandle           { lock handle to record }
  804.   ): Integer;
  805.  
  806. { checks if table was changed by other user since last refresh }
  807. function PXNetTblChanged(
  808.   tblHandle: TableHandle;         { table to test }
  809.   var Changed: Bool               { returns True/False }
  810.   ): Integer;
  811.  
  812. { forces a refresh of a table if it was changed by another user }
  813. function PXNetTblRefresh(
  814.   tblHandle: TableHandle          { table to refresh }
  815.   ): Integer;
  816.  
  817.  
  818. { ERROR FUNCTIONS }
  819.  
  820. { returns error text associated with the error number }
  821. function PXErrMsg(
  822.   errCode: Integer                { errcode to return text for }
  823.   ): PChar;
  824.  
  825. { returns name of user causing a locking error }
  826. function PXNetErrUser(
  827.   bufSize: Integer;               { size of return buffer }
  828.   userName: PChar                 { returns user name }
  829.   ): Integer;
  830.  
  831. implementation
  832.  
  833. function PXExit;           external 'PXENGWIN' index  4;
  834. function PXSetDefaults;    external 'PXENGWIN' index  5;
  835. function PXGetDefaults;    external 'PXENGWIN' index  6;
  836. function PXSetHWHandler;   external 'PXENGWIN' index  7;
  837. function PXTblOpen;        external 'PXENGWIN' index  8;
  838. function PXTblClose;       external 'PXENGWIN' index  9;
  839. function PXTblCreate;      external 'PXENGWIN' index 10;
  840. function PXTblEmpty;       external 'PXENGWIN' index 11;
  841. function PXTblDelete;      external 'PXENGWIN' index 12;
  842. function PXTblCopy;        external 'PXENGWIN' index 13;
  843. function PXTblRename;      external 'PXENGWIN' index 14;
  844. function PXTblAdd;         external 'PXENGWIN' index 15;
  845. function PXRecAppend;      external 'PXENGWIN' index 16;
  846. function PXRecInsert;      external 'PXENGWIN' index 17;
  847. function PXRecUpdate;      external 'PXENGWIN' index 18;
  848. function PXRecBufOpen;     external 'PXENGWIN' index 19;
  849. function PXRecBufClose;    external 'PXENGWIN' index 20;
  850. function PXRecBufEmpty;    external 'PXENGWIN' index 21;
  851. function PXRecBufCopy;     external 'PXENGWIN' index 22;
  852. function PXRecGet;         external 'PXENGWIN' index 23;
  853. function PXPutShort;       external 'PXENGWIN' index 24;
  854. function PXPutDoub;        external 'PXENGWIN' index 25;
  855. function PXPutLong;        external 'PXENGWIN' index 26;
  856. function PXPutAlpha;       external 'PXENGWIN' index 27;
  857. function PXPutDate;        external 'PXENGWIN' index 28;
  858. function PXPutBlank;       external 'PXENGWIN' index 29;
  859. function PXGetShort;       external 'PXENGWIN' index 30;
  860. function PXGetDoub;        external 'PXENGWIN' index 31;
  861. function PXGetLong;        external 'PXENGWIN' index 32;
  862. function PXGetAlpha;       external 'PXENGWIN' index 33;
  863. function PXGetDate;        external 'PXENGWIN' index 34;
  864. function PXFldBlank;       external 'PXENGWIN' index 35;
  865. function PXRecGoto;        external 'PXENGWIN' index 36;
  866. function PXRecFirst;       external 'PXENGWIN' index 37;
  867. function PXRecLast;        external 'PXENGWIN' index 38;
  868. function PXRecNext;        external 'PXENGWIN' index 39;
  869. function PXRecPrev;        external 'PXENGWIN' index 40;
  870. function PXRecDelete;      external 'PXENGWIN' index 41;
  871. function PXKeyAdd;         external 'PXENGWIN' index 42;
  872. function PXKeyDrop;        external 'PXENGWIN' index 43;
  873. function PXDateDecode;     external 'PXENGWIN' index 44;
  874. function PXDateEncode;     external 'PXENGWIN' index 45;
  875. function PXSrchKey;        external 'PXENGWIN' index 46;
  876. function PXSrchFld;        external 'PXENGWIN' index 47;
  877. function PXTblProtected;   external 'PXENGWIN' index 48;
  878. function PXPswAdd;         external 'PXENGWIN' index 49;
  879. function PXPswDel;         external 'PXENGWIN' index 50;
  880. function PXTblEncrypt;     external 'PXENGWIN' index 51;
  881. function PXTblDecrypt;     external 'PXENGWIN' index 52;
  882. function PXTblExist;       external 'PXENGWIN' index 53;
  883. function PXTblName;        external 'PXENGWIN' index 54;
  884. function PXRecNum;         external 'PXENGWIN' index 55;
  885. function PXTblNRecs;       external 'PXENGWIN' index 56;
  886. function PXRecNFlds;       external 'PXENGWIN' index 57;
  887. function PXKeyNFlds;       external 'PXENGWIN' index 58;
  888. function PXFldHandle;      external 'PXENGWIN' index 59;
  889. function PXFldType;        external 'PXENGWIN' index 60;
  890. function PXFldName;        external 'PXENGWIN' index 61;
  891. function PXTblMaxSize;     external 'PXENGWIN' index 62;
  892. function PXSave;           external 'PXENGWIN' index 63;
  893. function PXNetUserName;    external 'PXENGWIN' index 64;
  894. function PXNetFileLock;    external 'PXENGWIN' index 65;
  895. function PXNetFileUnlock;  external 'PXENGWIN' index 66;
  896. function PXNetTblLock;     external 'PXENGWIN' index 67;
  897. function PXNetTblUnlock;   external 'PXENGWIN' index 68;
  898. function PXNetRecLock;     external 'PXENGWIN' index 69;
  899. function PXNetRecUnlock;   external 'PXENGWIN' index 70;
  900. function PXNetRecLocked;   external 'PXENGWIN' index 71;
  901. function PXNetRecGotoLock; external 'PXENGWIN' index 72;
  902. function PXNetTblChanged;  external 'PXENGWIN' index 73;
  903. function PXNetTblRefresh;  external 'PXENGWIN' index 74;
  904. function PXErrMsg;         external 'PXENGWIN' index 75;
  905. function PXNetErrUser;     external 'PXENGWIN' index 76;
  906. function PXWinInit;        external 'PXENGWIN' index 84;
  907. procedure BlankDouble;     external 'PXENGWIN' index 85;
  908. function IsBlankDouble;    external 'PXENGWIN' index 86;
  909.  
  910. end.
  911.