home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TURBOP.ZIP / ACCESS.BIG next >
Encoding:
Text File  |  1985-11-01  |  6.0 KB  |  184 lines

  1. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  2.  
  3.   This modification to the Turbo Access routines has not been tested
  4.   extensively.  Use it at your own risk, on worthless data please!
  5.  
  6. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  7.  
  8.   This file describes how to modify the Turbo Access routines from the Turbo
  9. Toolbox to allow more than 64K records in the data file.  This is done by
  10. using real numbers for date references, and using LongSeek instead of Seek on
  11. the data files.  This is for MS-DOS/PC-DOS only!
  12.  
  13.   These modifications have been tested only in the most minimal way: modifying
  14. BTREE to use them.  PLEASE don't use them on important data without first
  15. testing thoroughly!  If you find any problems, OR if you feel you have done
  16. extensive testing and found no problems, please notify me through the Borland
  17. SIG on CompuServe (GO BOR).
  18.  
  19.   When you make changes, be careful to make them exactly: don't forget any
  20. semicolons or parentheses!
  21.  
  22.   -  Bela Lubkin
  23.      Borland International Technical Support
  24.  
  25. In ACCESS.BOX:
  26.  
  27. Right before the Type definition section, add
  28. Const
  29.   X65536 = 65536.0;  { For integer version, change to 1 (NOT 1.0) }
  30.  
  31. At the beginning of the Type section, add
  32.   RefType = Real;    { Change to Integer for standard, 64K record limit
  33.                        version }
  34.  
  35. In procedure GetRec, change
  36.   Seek(DatF.F,R);
  37. to
  38.   LongSeek(DatF.F,R);
  39.  
  40. In procedure PutRec, change
  41.   Seek(DatF.F,R);
  42. to
  43.   LongSeek(DatF.F,R);
  44.  
  45. In procedure MakeFile, change
  46.     Move(DatF.FirstFree,TaRecBuf,8);
  47. to
  48.     Move(DatF.FirstFree,TaRecBuf,4 * SizeOf(RefType));
  49.  
  50. In procedure OpenFile, change
  51.     Move(TaRecBuf,DatF.FirstFree,8);
  52.     DatF.NewRec :=  DatF.Int2;
  53. to
  54.     Move(TaRecBuf,DatF.FirstFree,4 * SizeOf(REFTYPE));
  55.     DatF.NewRecMSW := Trunc(DatF.Int2 / X65536);
  56.     DatF.NewRec := Trunc(DatF.Int2 - X65536 * DatF.NewRecMSW);
  57.  
  58. In procedure CloseFile, change
  59.   DatF.Int2 := DatF.NewRec;
  60.   Move(DatF.FirstFree,TaRecBuf,8);
  61. to
  62.   DatF.Int2 := DatF.NewRec + X65536 * DatF.NewRecMSW;
  63.   Move(DatF.FirstFree,TaRecBuf,4 * SizeOf(REFTYPE));
  64.  
  65. In procedure AddRec, change
  66.     Move(TaRecBuf,DatF.FirstFree,2);
  67. to
  68.     Move(TaRecBuf,DatF.FirstFree,SizeOf(REFTYPE));
  69.  
  70. In procedure DeleteRec, change
  71.   Move(DatF.FirstFree,TaRecBuf,2);
  72. to
  73.   Move(DatF.FirstFree,TaRecBuf,SizeOf(REFTYPE));
  74.  
  75. In function FileLen, change
  76.   FileLen := DatF.NewRec;
  77. to
  78.   FileLen := DatF.NewRec + X65536*DatF.NewRecMSW;
  79.  
  80. In function TaCompKeys, change
  81.       TaCompKeys := DR1 - DR2
  82. to
  83.       if DR1 > DR2 then TaCompKeys := 1
  84.       else if DR1 < DR2 then TaCompKeys := -1
  85.       else TaCompKeys := 0
  86.  
  87.  
  88.   Now you must change the types of a large number of items from Integer to
  89. RefType.  The items are listed in order of appearance and according to file.
  90.  
  91.   Fields of a record are represented by RecordName.Field1, Field2, ...
  92.   Procedure or function parameters are represented by ProcedureName(Parameter)
  93.   Function types are represented by Function FunctionName
  94.   Local variables are listed below the name of the procedure they belong to.
  95.   In each case, change only the named fields, parameters or functions, or
  96. local variables to RefType.
  97.  
  98. In ACCESS.BOX:
  99.   DataFile.FirstFree, NumberFree, Int1, Int2
  100.   TaItem.DataRef, PageRef
  101.   TaPage.BckwPageRef
  102.   TaSearchStop.PageRef
  103.   IndexFile.RR
  104.   TaStackRef.PageRef
  105.   TaIOCheck(R)
  106.   GetRec(R)
  107.   PutRec(R)
  108.   AddRec(R)
  109.   DeleteRec(R)
  110.   Function FileLen
  111.   Function UsedRecs
  112.   TaGetPage(R)
  113.   TaNewPage(R)
  114.   TaCompKeys(DR1,DR2)
  115.  
  116. In GETKEY.BOX:
  117.   NextKey(ProcDataRef)
  118.     R
  119.   PrevKey(ProcDataRef)
  120.     R
  121.   TaFindKey(ProcDataRef)
  122.     PrPgRef
  123.   FindKey(ProcDataRef)
  124.   SearchKey(ProcDataRef)
  125.  
  126. In ADDKEY.BOX:
  127.   AddKey(ProcDataRef)
  128.     PrPgRef1, PrPgRef2
  129.   Search(PrPgRef1)
  130.  
  131. In DELKEY.BOX:
  132.   DeleteKey(ProcDataRef)
  133.   DelB(PrPgRef)
  134.     XPageRef
  135.   UnderFlow(PrPgRef, PrPgRef2)
  136.     LPageRef
  137.   DelA(PrPgRef2)
  138.     XPageRef
  139.  
  140. In BTREE.INC (if you want to test BTREE):
  141.   Add:
  142.     DataF
  143.   Find:
  144.     D,I
  145.   List:
  146.     D,LD
  147.  
  148.  
  149. NOTES:
  150.   When these modifications have been made, you can switch between integer
  151. data references, allowing 64K records, and real data references, allowing
  152. either 4,294,967,296 records or whatever DOS limits you to (probably the
  153. latter)!  To change the data reference type, just change type RefType to
  154. integer or real.  (You could even use Byte, but that's not very practical).
  155. Note that data files created with one kind of data references are NOT
  156. compatible with those made differently.  Keep this in mind; it will take
  157. interesting contortions to convert files from one type to the other.  Even
  158. more subtle is the fact that data files created with normal Turbo Pascal and
  159. those created with Turbo-87 are not compatible!
  160.  
  161.   Also note that the minimum data record size depends on the type of the data
  162. references.  With integers, it is 8.  With non-8087 reals, it is 24, and with
  163. 8087 reals, it is 32.  If you use less than the minimum, everything will go
  164. haywire!
  165.  
  166.   Please report any bugs or interesting facts to me or Sysop Larry Kraft of
  167. the Borland SIG on CompuServe.
  168.   -  Bela Lubkin
  169.  references, allowing 64K records, and real data references, allowing
  170. either 4,294,967,296 records or whatever DOS limits you to (probably the
  171. latter)!  To change the data reference type, just change type RefType to
  172. integer or real.  (You could even use Byte, but that's not very practical).
  173. Note that data files created with one kind of data references are NOT
  174. compatible with those made differently.  Keep this in mind; it will take
  175. interesting contortions to convert files from one type to the other.  Even
  176. more subtle is the fact that data files created with normal Turbo Pascal and
  177. those created with Turbo-87 are not compatible!
  178.  
  179.   Also note that the minimum data record size depends on the type of the data
  180. references.  With integers, it is 8.  With non-8087 reals, it is 24, and with
  181. 8087 reals, it is 32.  If you use less than the minimum, everything will go
  182. haywire!
  183.  
  184.