home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / opus / opin103d.lzh / OP-PROC.TXT < prev    next >
Text File  |  1989-12-03  |  23KB  |  360 lines

  1. {*****************************************************************************}
  2. {*                                                                           *}
  3. {*   O p u s   I n t e r f a c e    V e r  1.03                              *}
  4. {*                                                                           *}
  5. {*   Opus V 1.0x Interface for Turbo Pascal Ver 4.0, 5.0 and 5.5             *}
  6. {*                                                                           *}
  7. {*   (C) COPYRIGHT  Per Holm & Bifrost Unlimited - 1988, 1989                *}
  8. {*                                                                           *}
  9. {*     FidoNet:  Per Holm - Asgaard BBS 2:230/22.0                           *}
  10. {*     Internet: perholm@daimi.DK                                            *}
  11. {*                                                                           *}
  12. {*****************************************************************************}
  13.  
  14. FUNCTION OpIntERROR: Integer;      { ERROR Variable Check this Allways }
  15.     {*************************************************************************}
  16.     {*  ERROR Returns                                                        *}
  17.     {*                                                                       *}
  18.     {*  0 = Everything is Bright and Sunny, Just go on                       *}
  19.     {*  2 = File not found, Check your filename                              *}
  20.     {*  3 = Path not found, Check your pathname                              *}
  21.     {*  4 = Too many open files, We need one extra file.                     *}
  22.     {*  5 = Fileaccess denied, Check file status.                            *}
  23.     {*  12 = Invalid file acces code.                                        *}
  24.     {*  100 = Disk read error.                                               *}
  25.     {*  101 = Disk write error.                                              *}
  26.     {*  190 = Fossil is not loaded.                                          *}
  27.     {*  191 = Unable to find carrier.                                        *}
  28.     {*  192 = Carrier on current port has changed.                           *}
  29.     {*  193 = Timeout reading port.                                          *}
  30.     {*  194 = Timeout writing port.                                          *}
  31.     {*  200 = .PRM file is to big ( > 8 KB )                                 *}
  32.     {*  201 = Wrong CTL file version, You need another OPUS_CTL              *}
  33.     {*  202 = To much data for the .PRM file ( > 8 KB )                      *}
  34.     {*  210 = .MSG file is to big ( > 8 KB )                                 *}
  35.     {*  211 = To many lines in message                                       *}
  36.     {*  212 = To many charecters to write message                            *}
  37.     {*  220 = Cannot find User record                                        *}
  38.     {*  221 = To Many Records In UserFile                                    *}
  39.     {*  222 = Not Room For Extra User Record in The Structure                *}
  40.     {*  230 = Cannot find Nodelist Record                                    *}
  41.     {*  231 = Cannot find Nodelist Index Record                              *}
  42.     {*  250 = Illegal Date / Time specified.                                 *}
  43.     {*************************************************************************}
  44.  
  45. FUNCTION IOResult: INTEGER;
  46.   {***************************************************************************}
  47.   {* Return First OpInt Or I/O Error that occured.. look at OpIntERROR and   *}
  48.   {* TPAS Manual for error description                                       *}
  49.   {***************************************************************************}
  50.  
  51. PROCEDURE Delay(MS: Word);
  52.   {***************************************************************************}
  53.   {* Delay for MS milliseconds                                               *}
  54.   {***************************************************************************}
  55.  
  56. PROCEDURE Sound(Hz: Word);
  57.   {***************************************************************************}
  58.   {* Enable the sound generator.                                             *}
  59.   {***************************************************************************}
  60.  
  61. PROCEDURE NoSound;
  62.   {***************************************************************************}
  63.   {* Disable the sound generator.                                            *}
  64.   {***************************************************************************}
  65.  
  66. FUNCTION KeyPressed: Boolean;
  67.   {***************************************************************************}
  68.   {* Return true if a key has been pressed                                   *}
  69.   {***************************************************************************}
  70.  
  71. FUNCTION ReadKey: Char;
  72.   {***************************************************************************}
  73.   {* Read a Character from standard input                                    *}
  74.   {***************************************************************************}
  75.  
  76. PROCEDURE GotoXY(x,y: Byte);
  77.   {***************************************************************************}
  78.   {* Move cursor to new location (The user must use ANSI).                   *}
  79.   {***************************************************************************}
  80.  
  81. FUNCTION UpperCase(S: String):String;
  82.   {***************************************************************************}
  83.   {* Converts Strings to uppercase...                                        *}
  84.   {***************************************************************************}
  85.  
  86. FUNCTION LowerCase(S: String):String;
  87.   {***************************************************************************}
  88.   {* Converts strings to lovercase...                                        *}
  89.   {***************************************************************************}
  90.  
  91. FUNCTION SmartCase(S: String):String;
  92.   {***************************************************************************}
  93.   {* Converts string to First letter in word to Uppercase, rest to lovercase *}
  94.   {***************************************************************************}
  95.  
  96. FUNCTION GetEnvStr(S:String):String;
  97.   {***************************************************************************}
  98.   {* Return the EnvironMent String for the the Variabel S                    *}
  99.   {*  S Must be in Uppercase.                                                *}
  100.   {***************************************************************************}
  101.  
  102. FUNCTION GMT_Difference:Integer;
  103.   {***************************************************************************}
  104.   {* Return an integer value of the difference from GMT (Uses TZ env var.)   *}
  105.   {***************************************************************************}
  106.  
  107. PROCEDURE GetDateTime(VAR DT:DateTime);
  108.   {***************************************************************************}
  109.   {* Return a DateTime structure containing the current Date and Time.       *}
  110.   {***************************************************************************}
  111.  
  112. FUNCTION DaysThisYear(DT: DateTime):Integer;
  113.   {***************************************************************************}
  114.   {* Give day number for the date specified in DT. (Note Year >= 1980)       *}
  115.   {***************************************************************************}
  116.  
  117. FUNCTION PackUnixDate(DT:DateTime):LongInt;
  118.   {***************************************************************************}
  119.   {* Return number of Seconds since 1/1-1970                                 *}
  120.   {***************************************************************************}
  121.  
  122. PROCEDURE UnpackUnixDate(Date:LongInt; Var DT:DateTime);
  123.   {***************************************************************************}
  124.   {* Convert number of Seconds since 1/1-1970 to DateTime type.              *}
  125.   {***************************************************************************}
  126.  
  127. FUNCTION PackDateString(DT:DateTime): String;
  128.   {***************************************************************************}
  129.   {* Return a string containing Time and Date from DT                        *}
  130.   {* The format of the Date/Time string will be:                             *}
  131.   {*   'dd-mon-yy hh:mm:ss'                                                  *}
  132.   {*      Ex. '24-May-88 12:22:21'                                           *}
  133.   {***************************************************************************}
  134.  
  135. PROCEDURE UnpackDateString(S:_String20; Var DT:DateTime);
  136.   {***************************************************************************}
  137.   {* This Procedure will return the contents of a Date/time string in DT.    *}
  138.   {* The format of the Date/Time string Must be:                             *}
  139.   {*   'dd-mon-yy hh:mm:ss'                                                  *}
  140.   {*      Ex. '24-May-88 12:22:21'                                           *}
  141.   {***************************************************************************}
  142.  
  143. FUNCTION PackDateStrLog(DT:DateTime): String;
  144.   {***************************************************************************}
  145.   {* Return a string containing Time and Date from DT  In LOG file Format    *}
  146.   {***************************************************************************}
  147.  
  148. PROCEDURE AddLog(name:STRING; Flag: _StrSys; Subject: STRING);
  149.  
  150.   {***************************************************************************}
  151.   { Add String in S to LogFile. With Date And Time Flag will contain prefix  *}
  152.   {***************************************************************************}
  153.  
  154. PROCEDURE SetAttrib(Var Attribute; Flag: Word; Status:Boolean);
  155.   {***************************************************************************}
  156.   {*  This procedure will change an attribute flag.                          *}
  157.   {*  WARNING: 'Attribute' MUST be of type 'Word' or of Type 'Integer'...    *}
  158.   {***************************************************************************}
  159.  
  160. PROCEDURE ReadPrm(name:String; VAR Prm:_Prm);
  161.   {***************************************************************************}
  162.   {* ReadPrm reads the PRM file 'name' to the Variable 'Prm'                 *}
  163.   {***************************************************************************}
  164.  
  165. PROCEDURE WritePrm(name:String; VAR Prm:_Prm);
  166.   {***************************************************************************}
  167.   {* WritePrm writes the PRM file 'name' with the contents of 'Prm'          *}
  168.   {***************************************************************************}
  169.  
  170. PROCEDURE ReadScheds(name:String; VAR Scheds:_Scheds);
  171.   {***************************************************************************}
  172.   {* ReadScheds reads the SCHEDULE file 'name' to the Vaiable 'Scheds'       *}
  173.   {***************************************************************************}
  174.  
  175. PROCEDURE WriteScheds(name:String; VAR Scheds:_Scheds);
  176.   {***************************************************************************}
  177.   {* WriteScheds Rewrites the SCHEDULE file 'name' with the Vaiable 'Scheds' *}
  178.   {***************************************************************************}
  179.  
  180. PROCEDURE ReadSys(name:String; VAR Sys:_Sys);
  181.   {***************************************************************************}
  182.   {* ReadSys reads the SYSTEM??.BBS file 'name' to the Vaiable 'Sys'         *}
  183.   {***************************************************************************}
  184.  
  185. PROCEDURE WriteSys(name:String; VAR Sys:_Sys);
  186.   {***************************************************************************}
  187.   {* WriteSys Rewrites the SYSTEM*.BBS file 'name' with the contents of 'Sys'*}
  188.   {***************************************************************************}
  189.  
  190. PROCEDURE ReadUser(name:String; VAR Usr:_Usr;Rec: WORD);
  191.   {***************************************************************************}
  192.   {* This procedure will read a user record from the file 'name' to the      *}
  193.   {* structure Usr, it will return the user record number 'rec'              *}
  194.   {***************************************************************************}
  195.  
  196. PROCEDURE WriteUser(name:String; VAR Usr:_Usr;Rec: WORD);
  197.   {***************************************************************************}
  198.   {* This procedure will write a user record to the file 'name'.             *}
  199.   {* the variable Usr will be written to the user record number 'rec'.       *}
  200.   {***************************************************************************}
  201.  
  202. FUNCTION NumberOfUsers(Name:String):Word;
  203.   {***************************************************************************}
  204.   {*  Will return the number of users in the DiskFile 'Name'                 *}
  205.   {***************************************************************************}
  206.  
  207. PROCEDURE InitUserPtr(VAR UsrPtr:_UsrPtr);
  208.   {***************************************************************************}
  209.   {* Initialise the UsrPointer.. Must be called if you create a new userfile *}
  210.   {* Using the followin User Management Procedures and functions.            *}
  211.   {***************************************************************************}
  212.  
  213. PROCEDURE ReadUserFast(VAR UsrPtr:_UsrPtr; VAR Usr:_Usr; Recs: INTEGER);
  214.   {***************************************************************************}
  215.   {* This procedure will read a user records from the menory pool of _UsrPtr *}
  216.   {***************************************************************************}
  217.  
  218. PROCEDURE WriteUserFast(VAR UsrPtr:_UsrPtr;VAR Usr:_Usr; Recs: INTEGER);
  219.   {***************************************************************************}
  220.   {* This procedure will write one of the user records into menory           *}
  221.   {***************************************************************************}
  222.  
  223. PROCEDURE ReleaseUserPtr(VAR UsrPtr:_UsrPtr);
  224.   {***************************************************************************}
  225.   {* Release the Heap space used by the UsrPointer variable.                 *}
  226.   {***************************************************************************}
  227.  
  228. PROCEDURE DelUserPtr(VAR UsrPtr:_UsrPtr; Rec:Integer);
  229.   {***************************************************************************}
  230.   {* Delete Single UserRecord From Memory and Release The Space Too          *}
  231.   {***************************************************************************}
  232.  
  233. PROCEDURE InsUserPtr(VAR UsrPtr:_UsrPtr; VAR Usr:_Usr; Rec:Integer);
  234.   {***************************************************************************}
  235.   {* Insert New UserRecord In Heap as Number Rec.                            *}
  236.   {***************************************************************************}
  237.  
  238. PROCEDURE ReadUserFile(name:String; VAR UsrPtr:_UsrPtr; VAR Recs: INTEGER);
  239.   {***************************************************************************}
  240.   {* This procedure will read all the user records from the file 'name' into *}
  241.   {* memory                                                                  *}
  242.   {***************************************************************************}
  243.  
  244. PROCEDURE WriteUserFile(name:String; VAR UsrPtr:_UsrPtr);
  245.   {***************************************************************************}
  246.   {* This procedure will write all users in the memory pool wich is used by  *}
  247.   {* UsrPtr.  It will be written to the file 'Name'.                         *}
  248.   {***************************************************************************}
  249.  
  250. PROCEDURE ReadNode(name:String; VAR Node:_Node;Rec: LongInt);
  251.   {***************************************************************************}
  252.   {* This procedure will read a Node record from the file 'name' to the      *}
  253.   {* structure Node, it will return the user record number 'rec'             *}
  254.   {***************************************************************************}
  255.  
  256. PROCEDURE WriteNode(name:String; VAR Node:_Node;Rec: LongInt);
  257.   {***************************************************************************}
  258.   {* This procedure will write a Node record to a version 5 nodelist file    *}
  259.   {***************************************************************************}
  260.  
  261. PROCEDURE ReadNewNode(name:String; VAR NewNode:_NewNode;Rec: LongInt);
  262.   {***************************************************************************}
  263.   {* This procedure will read a Node record from the file 'name' to the      *}
  264.   {* structure Node, it will return the user record number 'rec'             *}
  265.   {* For Use with nodelist version 6.                                        *}
  266.   {***************************************************************************}
  267.  
  268. PROCEDURE WriteNewNode(name:String; VAR NewNode:_NewNode;Rec: LongInt);
  269.   {***************************************************************************}
  270.   {* This procedure will write a Node record from the file 'name' from the   *}
  271.   {* structure Node, it will write the user record number 'rec'              *}
  272.   {* For Use with nodelist version 6.                                        *}
  273.   {***************************************************************************}
  274.  
  275. FUNCTION NumberOfNodes(Name:String):LongInt;
  276.   {***************************************************************************}
  277.   {*  Will return the number of users in the Nodelist.IDX file 'Name'        *}
  278.   {***************************************************************************}
  279.  
  280. FUNCTION FindNode(name:String;Net,Node: Integer):LongInt;
  281.   {***************************************************************************}
  282.   {* FIND Nodelist Entry number                                              *}
  283.   {*    name :      Name of Nodelist Index file                              *}
  284.   {*    Net,Node :  Net and Nodenumber                                       *}
  285.   {***************************************************************************}
  286.  
  287. PROCEDURE ReadNdi(name:String; VAR Ndi:_Ndi;Rec: LongInt);
  288.   {***************************************************************************}
  289.   {* This procedure will read a Ndi record from the file 'name' to the       *}
  290.   {* structure Ndi, it will return the user record number 'rec'              *}
  291.   {***************************************************************************}
  292.  
  293. PROCEDURE WriteNdi(name:String; VAR Ndi:_Ndi;Rec: LongInt);
  294.   {***************************************************************************}
  295.   {* This procedure will write a Node record to a nodeliste index file. The  *}
  296.   {* record number written is 'rec'                                          *}
  297.   {***************************************************************************}
  298.  
  299. FUNCTION MsgLength(VAR Msg:_Msg):LongInt;
  300.   {***************************************************************************}
  301.   {*  This function will return the number of charecters in the Message Msg  *}
  302.   {***************************************************************************}
  303.  
  304. PROCEDURE ReadMsg(name:String; VAR Msg:_Msg);
  305.   {***************************************************************************}
  306.   {* This procedure will read a message with file name 'name' and return     *}
  307.   {* the header and Text in the structure Msg                                *}
  308.   {***************************************************************************}
  309.  
  310. PROCEDURE WriteMsg(name:String; VAR Msg:_Msg);
  311.   {***************************************************************************}
  312.   {* This procedure will write a message to a file name 'name' from  the     *}
  313.   {* variable Msg.                                                           *}
  314.   {***************************************************************************}
  315.  
  316. PROCEDURE ReadMsgHead(name:String; VAR Msg:_Msg);
  317.   {***************************************************************************}
  318.   {* This procedure will read a message with file name 'name' and return     *}
  319.   {* the header in the structure Msg, The Msg body will not be read          *}
  320.   {***************************************************************************}
  321.  
  322. PROCEDURE WriteMsgHead(name:String; VAR Msg:_Msg);
  323.   {***************************************************************************}
  324.   {* This procedure will write a message in the file named 'name'.           *}
  325.   {* The Msg body will not be changed.                                       *}
  326.   {***************************************************************************}
  327.  
  328. PROCEDURE ReadMsgHeadNew(name:String; VAR MsgHead:_MsgHead);
  329.   {***************************************************************************}
  330.   {* This procedure will read a message with file name 'name' and return     *}
  331.   {* the header in the structure MsgHead, The Msg body will not be read.     *}
  332.   {***************************************************************************}
  333.  
  334. PROCEDURE WriteMsgHeadNew(name:String; VAR MsgHead:_MsgHead);
  335.   {***************************************************************************}
  336.   {* This procedure will write a message in the file named 'name'.           *}
  337.   {* The Msg body will not be changed.                                       *}
  338.   {***************************************************************************}
  339.  
  340. PROCEDURE ReadMsgRaw(name:String; VAR Msg:_MsgRaw);
  341.   {***************************************************************************}
  342.   {* This procedure will read a message with file name 'name' and return     *}
  343.   {* the header and Text in the structure Msg                                *}
  344.   {***************************************************************************}
  345.  
  346. PROCEDURE WriteMsgRaw(name:String; VAR Msg:_MsgRaw);
  347.  
  348.   {***************************************************************************}
  349.   {* This procedure will write a message to a file name 'name' from  the     *}
  350.   {* structure Msg.                                                          *}
  351.   {***************************************************************************}
  352.  
  353. FUNCTION FirstFreeMsg(Path:String):String;
  354.   {***************************************************************************}
  355.   {*  This function will return the first free message number in the area    *}
  356.   {* described by path.                                                      *}
  357.   {***************************************************************************}
  358.  
  359.  
  360.