home *** CD-ROM | disk | FTP | other *** search
- { ╔═══╦══════════════════════════════════════════════╦═══╗
- ║ ║ Pascal Library by Scott Wade ║ ║
- ║ ║ 715 FM 1959 Apt 310 ║ ║
- ║ ║ Houston, TX 77034 ║ ║
- ┌──────╨───╨──────────────────────────────────────────────╨───╨──────┐
- │ This group of routines is contributed to public domain, and no │
- │ one can possibly get any commercial value out of them since they │
- │ must be used in other programs. I require that if these are used │
- │ as is in any program, that this banner remain with the source │
- │ code of the program. I would appreciate any comments or sugges- │
- │ tions on improvements, & am curious to hear how these are used. │
- │ You can leave a message for me on these BBS's: │
- │ Ziggy's 821-1391 ScoreBoard 583-7848 │
- │ TBL-COMM 661-9040 Test-Mode 660-9252 │
- └────────────────────────────────────────────────────────────────────┘
- VIOERR.LIB v1.0 File/device IO err trap and message generator
- v1.0: 10/ 1/85 : Original. Returns errflag, errmessage and errnumber if any
- disk IO error occurs. Must be executed immediately after disk IO call.
- v1.1 12/ 7/85 : Put remark statements in the right place & added to msg 02.
- v1.2 4/ 6/86 : Function vTrueIfErr added. This will print the errmsg, if
- there is one, and returns True if IOErrVal is non-zero.
-
- }(**)
- procedure vIOerr(var IOErrMsg : Buffer ;var IOErrVal : Integer ;
- var IOErr : Boolean );
- begin
- IOErrVal := IOresult;
- IOErr := (IOErrVal <> 0);
- if IOErr then begin
- case IOErrVal of
- $01 : IOErrMsg := 'File does not exist.';
- $02 : IOErrMsg := 'File not open for input, or does not exist.';
- $03 : IOErrMsg := 'File not open for output.';
- $04 : IOErrMsg := 'File not open.';
- $05 : IOErrMsg := 'Can''t read from this file.';
- $06 : IOErrMsg := 'Can''t write to this file.';
- $10 : IOErrMsg := 'Error in numeric format.';
- $20 : IOErrMsg := 'Operation not allowed on a logical device.';
- $21 : IOErrMsg := 'Not allowed in direct mode.';
- $22 : IOErrMsg := 'Assign to standard files not allowed.';
- $90 : IOErrMsg := 'Record length mismatch.';
- $91 : IOErrMsg := 'Seek beyond end of file.';
- $99 : IOErrMsg := 'Unexpected end of file.';
- $F0 : IOErrMsg := 'Disk write error.';
- $F1 : IOErrMsg := 'Directory is full.';
- $F2 : IOErrMsg := 'File size overflow.';
- $FF : IOErrMsg := 'File disappeared.'
- else
- begin
- Str( IOErrVal:3, IOErrMsg);
- IOErrMsg := ConCat('Unknown I/O error: ', IOErrMsg);
- end{ Case Else Begin };
- end{ Case };
- end{ If IOErr };
- end{ IOCheck };
-
- Function vTrueIfErr( IOErrVal: integer; IOErrMsg : Buffer ): Boolean ;{
- NOTE: This uses writeln, not yPrnt, so yPrnt programs must set wX to 1
- following this, IF it returns True! An alternative is to call:
- yPrnt( wX, '^')
- to force a <CR> before the function call, then don't even worry
- about it afterwards, except to take an errexit if it's True. }
- begin
- If IOErrVal > 0 then begin
- writeln( IOErrMsg );
- vTrueIfErr := True
- end else vTrueIfErr := False ;
- end{ F vTrueIfErr };
-
- { End of vIOErr.LIB
- *****************************************************************************}