home *** CD-ROM | disk | FTP | other *** search
- {$B-,D-,F-,I+,N-,R-,S+,V+}
-
- (*
- Timo Salmi UNiT E
- All rights reserved 19-Aug-89,
- Updated 25-Sep-89, 8-Oct-89, 4-Nov-89, 6-Dec-89, 24-Feb-90, 22-Jul-90,
- 1-Aug-90
-
- Cursor routines, keyboard status, configuration information, file information,
- calendar routines.
- TSUNTE first appeared in release TSPAS13 of my Turbo Pascal units package.
-
- 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 TSUNTE;
-
- (* ======================================================================= *)
- interface
- (* ======================================================================= *)
-
- uses Dos;
-
- (* =======================================================================
- Screen related
- ======================================================================= *)
-
- (* Turns cursor off, and (since the update tspas13) retains the original
- cursor size behind the scenes *)
- procedure CURSOFF;
-
- (* Restores the cursor as it was before cursoff (unless, of course, you
- have manipulated cursor size yourself in between) *)
- procedure CURSON;
-
- (* Turns cursor on using user defined cursor size, the ordinary
- color monitor CGA and EGA values are 6 and 7; VGA: 13,14 *)
- procedure CURSOR (LowerScanLine, UpperScanLine : byte);
-
- (* Turns on a colored border, CGA and VGA, not EGA *)
- procedure BORDER (color : byte);
-
- (* Is the monitor a monochrome monitor, if false, then color monitor *)
- function MONOFN : boolean;
-
- (* =======================================================================
- Keyboard related
- ======================================================================= *)
-
- (* Clear the keyboard typeahead buffer *)
- procedure CLB;
-
- (* Is CapsLock on *)
- function CAPSONFN : boolean;
-
- (* Is NumLock on *)
- function NUMLONFN : boolean;
-
- (* Is ScrollLock on *)
- function SCRLONFN : boolean;
-
- (* Set CapsLock. Use true to turn on, false to turn off *)
- procedure CAPS (TurnOn : boolean);
-
- (* Set NumLock. Use true to turn on, false to turn off *)
- procedure NUMLOCK (TurnOn : boolean);
-
- (* Set ScrollLock. Use true to turn on, false to turn off *)
- procedure SCRLOCK (TurnOn : boolean);
-
- (* =======================================================================
- File related
- ======================================================================= *)
-
- (* Does a file exist. Detects also read-only and/or hidden files.
- If the name is a directory, false is returned, since directory
- is not considered a file.
- IMPORTANT: Never apply on an open file! *)
- function FEXISTFN (fnimi : string) : boolean;
-
- (* The size of any file in bytes. In case of an error, returns -1
- IMPORTANT: Never apply on an open file! *)
- function FSIZEFN (filename : string) : longint;
-
- (* An alternative method for finding the file size. Can handle also
- hidden files. Returns -1 if the file is not found or if FileName
- is a directory or the volumeID *)
- function FSIZE2FN (FileName : string) : longint;
-
- (* Space to files is allocated in whole clusters rather than by byte.
- This function gives the cluster size of a device.
- In case of an error, the function returns -1. *)
- function CLUSIZFN (device : char) : longint;
-
- {$IFNDEF VER40} (* Not Turbo Pascal 4.0 *)
- (* The size of a file in total allocated bytes.
- In case of an error, returns -1
- IMPORTANT: Never apply on an open file! *)
- function ALLSIZFN (filename : string) : longint;
- {$ENDIF}
-
- (* Returns the entire command line, first appearance in tspas14.arc
- IMPORTANT: Must be applied before any file access *)
- function CMDLNFN : string;
-
- (* =======================================================================
- Date related
- ======================================================================= *)
-
- (* Modern weekday based on Zeller's congruence, valid after 14-Sep-1752,
- Sun = 0, Mon = 1 ,..., Sat = 6 *)
- function WKDAYFN (day, month, year : word) : byte;
-
- (* The number of days in a given month and year, that is the last day
- of a month. Based on Zeller's congruence, valid after 14-Sep-1752 *)
- function LASTDMFN (month, year : word) : integer;
-
- (* Is a given date a valid date.
- Based on Zeller's congruence, valid from 1-Jan-1753 *)
- function DATEOKFN (day, month, year : word) : boolean;
-
- (* This function returns the weeknumber of a given date.
- If you consider that it starts on Sunday, set sunday_is_first true.
- If you consider that the week starts on Monday, set sunday_is_first false.
- Valid after 14-Sep-1752.
- This function was programmed by Seppo Pynnönen, Ph.D.,
- University of Vaasa, Finland, sjp@chyde.uwasa.fi *)
- function WEEKNRFN (day, month, year : word;
- sunday_is_first : boolean) : integer;
-
- (* Zeller function, valid after 14-Sep-1752 *)
- function ZELLERFN (day, month, year : word) : real;
-