home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / jr_tools / jrdsk201.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-07-14  |  3.3 KB  |  105 lines

  1. Unit JRDSK201 ;
  2.  
  3. (*╔═════════════════════════════════════════════════════════════════════════╗*)
  4. (*║                                                                         ║*)
  5. (*║             JR Unit Library  -  Version 2.01  -  June xxrd 1988         ║*)
  6. (*║                                                                         ║*)
  7. (*║                      Disc functions and procedures                      ║*)
  8. (*║                                                                         ║*)
  9. (*╚═════════════════════════════════════════════════════════════════════════╝*)
  10.  
  11. Interface
  12.  
  13. (*───────────────────────────────────────────────────────────────────────────*)
  14.  
  15. Uses Dos ;
  16.  
  17. (*───────────────────────────────────────────────────────────────────────────*)
  18.  
  19. Const _DOSService          = $21 ;
  20.  
  21.       _first = True ; _next = False ;
  22.  
  23. (*───────────────────────────────────────────────────────────────────────────*)
  24.  
  25. Var  _regs8086    : Registers ;
  26.  
  27. (*───────────────────────────────────────────────────────────────────────────*)
  28.  
  29. Function _ExistFile(_filename : String) : Boolean ;
  30. Function _FindFile(mask : String ; first : Boolean ;
  31.                    Var found : Boolean) : String ;
  32. Function _CurrentDrive : String ;
  33.  
  34. (*───────────────────────────────────────────────────────────────────────────*)
  35.  
  36. Implementation
  37.  
  38. (*───────────────────────────────────────────────────────────────────────────*)
  39.  
  40.  
  41. Function _Dummy(_filename : String) : Boolean ;
  42. (*  Version 1.02  *)
  43. (*                                              *)
  44. (*  Checks for files with any attribute set.    *)
  45. (*  Function published in PC Magazine, Nov 1987 *)
  46. (*  Author : Paul A Neumann, Denver, Colorado   *)
  47. (*                                              *)
  48. Var _file_to_test : String ;
  49. Begin ;
  50.    _file_to_test:=_filename+#0 ;
  51.    With _regs8086 Do Begin ;
  52.       ah:=$3D ; al:=$00 ;
  53.       ds:=Seg(_file_to_test) ;
  54.       dx:=Ofs(_file_to_test) ;
  55.    End ;
  56.    Intr(_DOSService,_regs8086) ;
  57.    If ((_regs8086.flags OR $FFFE)=$FFFE) Then Begin ;
  58.    (*If (Not _Bit(Lo(_regs8086.flags),0)) Then Begin ;*)
  59.       _regs8086.bx:=_regs8086.ax ;
  60.       _regs8086.ah:=$3E ;
  61.       Intr(_DOSService,_regs8086) ;
  62.       _Dummy:=True ;
  63.    End Else _Dummy:=False ;
  64. End  (* Function _ExistFile *) ;
  65.  
  66. (*───────────────────────────────────────────────────────────────────────────*)
  67.  
  68. Function _ExistFile ;
  69. (*  Version 1.02  *)
  70. Var _file : File ;
  71. Begin ;
  72.    Assign(_file,_filename) ;
  73.    (*$I-*)
  74.    Reset(_file) ;
  75.    (*$I+*)
  76.    If (IOResult=0) Then Begin ;
  77.       Close(_file) ;
  78.       _ExistFile:=True ;
  79.    End Else _ExistFile:=False ;
  80. End  (* Function _ExistFile *) ;
  81.  
  82. (*───────────────────────────────────────────────────────────────────────────*)
  83.  
  84. Function _FindFile ;
  85. (*  Version 2.01  *)
  86. Var sr : SearchRec ;
  87. Begin ;
  88.    If (first) Then FindFirst(mask,AnyFile,sr) Else FindNext(sr) ;
  89.    found:=(DosError=0) ; _FindFile:=sr.Name ;
  90. End  (* Function FindFile *) ;
  91.  
  92. (*───────────────────────────────────────────────────────────────────────────*)
  93.  
  94. Function _CurrentDrive ;
  95. (*  Version 1.02  *)
  96. Begin ;
  97.    _regs8086.ah:=25 ;
  98.    Intr(_DOSService,_regs8086) ;
  99.    _CurrentDrive:=Chr(65+_regs8086.al)+':' ;
  100. End  (* Function _CurrentDrive *) ;
  101.  
  102. (*───────────────────────────────────────────────────────────────────────────*)
  103.  
  104. End  (* Of Unit JRDSK201 *).
  105.