home *** CD-ROM | disk | FTP | other *** search
- {$B-,D-,F-,I+,N-,R-,S+,V+}
-
- (*
- Timo Salmi UNiT H
- A Turbo Pascal unit of system information and more miscellania
- All rights reserved 24-Feb-90
- Updated 15-Apr-90, 23-Jul-90, 1-Aug-90, 8-Aug-90, 5-Jan-90, 21-Jul-91
-
- This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
- NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
- ANY other usage, such as use in a business enterprise or a university,
- contact the author for the terms of registration.
-
- The units are under development. Comments and contacts are solicited. If
- you have any questions, please do not hesitate to use electronic mail for
- communication.
- InterNet address: ts@chyde.uwasa.fi (preferred)
- Funet address: GADO::SALMI
- Bitnet address: SALMI@FINFUN
-
- The author shall not be liable to the user for any direct, indirect or
- consequential loss arising from the use of, or inability to use, any unit,
- program or file howsoever caused. No warranty is given that the units and
- programs will work under all circumstances.
-
- Timo Salmi
- Professor of Accounting and Business Finance
- School of Business Studies, University of Vaasa
- P.O. BOX 297, SF-65101 Vaasa, Finland
- *)
-
- unit TSUNTH;
-
- (* ======================================================================= *)
- interface
- (* ======================================================================= *)
-
- uses Dos
- {$IFDEF VER40}
- ,TSUNT45
- {$ENDIF}
- ;
-
- (* ====================================================================
- Software information
- ==================================================================== *)
-
- (* Graftabl MsDos command loads the extended character set to be used in
- the graphics mode. This function tells whether the table has been
- already loaded, or not *)
- function GRTABLFN : boolean;
-
- (* This function returns whether a name is a directory or not *)
- function ISDIRFN (name : string) : boolean;
-
- (* This function returns whether a text file is open or closed.
- ^^^^
- Naturally the FilePointer must have been assigned at an earlier stage.
- Very convenient as a test in routines which close a file.
- e.g. use: if OPENEDFN(f) then close(f); *)
- function OPENEDFN (var FilePointer : text) : boolean;
-
- (* Returns the country code if MsDos 3+. For an error and earlier MsDos
- versions returns zero. See MsDos manual "How to use Code Pages" for
- the country codes *)
- function COUNTRFN : word;
-
- (* Return the country-dependent date format, reguires 3.0+,
- Principal return formats: MM-DD-YY ('-' or whatever is the
- DD-MM-YY relevant separator)
- YY-MM-DD
- On error or MsDos < 3.0 returns ('XX*XX*XX');
- Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
- function DATEFMFN : string;
-
- (* Return the country-dependent time format, reguires 3.0+,
- Principal return formats: 12-hour HH:MM:SS (':' or whatever is the
- 24-hour HH:MM:SS relevant separator)
- On error or MsDos < 3.0 returns ('00h');
- Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
- function TIMEFMFN : string;
-
- (* Returns from which drive the system was booted, requires MsDos 4.0+,
- else returns '.' *)
- function BOOTDRFN : char;
-
- (* ====================================================================
- Hardware information
- ==================================================================== *)
-
- (* Is a math coprocessor present. And, yes, yes, I know that there is a
- Test8087 variable in Turbo Pascal, but I have found it unreliable *)
- function MATHCOFN : boolean;
-
- (* Number of serial ports *)
- function RS232FN : byte;
-
- (* Number of parallel ports (printers installed) *)
- function PARPORFN : byte;
-
- (* Returns the type of the processor chip. If not known, returns the
- string 'error'. This function is based on the public inline code in
- Michael Tischer, PC System Programming for Developers, Abacus, p. 660.
- I have written the interface to it. Does not detect 80486. Sometimes
- gives conflicting information. Use with care, if at all. There are
- alternatives *)
- function CHIPFN : string;
-
- (* Get the version (date) of the ROM BIOS. It is of the format mm/dd/yy.
- Returns 'NotKnown' if unavailable *)
- function ROMDTEFN : string;
-
- (* Is the keyboard an enhanced keyboard *)
- function ISENHAFN : boolean;
-
- (* Last drive of the system, softcoded, not for XTs *)
- function LASTDRFN : char;
-
- (* This function gives the interleave factor of a given drive.
- If you give a non-existent drive name, interlfn return zero.
- This is for fixed disks. Applying on a floppy drive will give
- nonsensical values, not for XTs. I am not convinced that this
- works with all the different conrollers around *)
- function INTERLFN (drive : char) : byte;
-
- (* Number of FATs, not for XTs *)
- function FATSFN (drive : char) : byte;
-
- (* Number of cylinders on a device, requires MsDos 3.2+,
- In case of modia not present, error, or MsDos < 3.2 returns 0 *)
- function NRCYLFN (drive : char) : byte;
-
- (* ====================================================================
- Redirection status
- ==================================================================== *)
-
- (* Is the standard input from redirection. Based on PC-Mag Vol 10 No 7, 374,
- Duncan 412, Dettmann 602-603 *)
- function PIPEDIFN : boolean;
-
- (* Is the standard output redirected. Based on PC-Mag Vol 10 No 7, 374,
- Duncan 412, Dettmann 602-603 *)
- function PIPEDOFN : boolean;
-
- (* Is the standard output redirected to nul. Based on PC-Mag Vol 10 No 7, 374,
- Duncan 412, Dettmann 602-603 *)
- function PIPEDNFN : boolean;
-
- (* ====================================================================
- Perform tasks
- ==================================================================== *)
-
- (* Copy a file (of any type)
- Status codes:
- 0 : ok
- 1 : FromFile does not exits
- 2 : ToFile already exists
- 3 : ToFile cannot be opened for writing (read-only,
- write protected, invalid device)
- 4 : Error in writing to ToFile
- 5 : Copy error (disk probably full)
- 6 : Date stamp error
- 7 : Out of memory
- *)
- procedure COPYFILE (FromFile, ToFile : string; var status : byte);
-
- (* Convert an Asciiz (#0 limited) string into an ordinary ascii string.
- Some of the routines in this unit internally need Z2ASCFN, but why
- not make it also generally available as well *)
- function Z2ASCFN (asciiz : string) : string;
-