home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tplan6.zip / LAN.DOC < prev    next >
Text File  |  1992-04-07  |  9KB  |  282 lines

  1. LAN5 Unit for Turbo Pascal 5.0 & 5.5 
  2.  
  3. Copyright 1989 Athens Software & Computer Info., Inc.  
  4.  
  5. The LAN50 & LAN55 units provide LAN-related functions and 
  6. procedures for Turbo Pascal 5.0 & 5.5.  
  7.  
  8. While the LAN5 source code is available for a $7 registration 
  9. fee, you are welcome to use LAN50.TPU or LAN55.TPU in your 
  10. applications at no charge.  To receive the latest source code on 
  11. diskette, send $7 to: 
  12.  
  13. Athens Software & 
  14. Computer Info., Inc.  
  15. Route 2, Box 3280 
  16. Nicholson, GA 30565 
  17. (706) 549-6912
  18.  
  19. Please specify LAN5.PAS and whether you want 5.25" or 3.5" 
  20. diskettes.  
  21.  
  22. If you got this program in compressed format, you should have 
  23. received five files: LAN5.DOC, LAN50.TPU, LAN55.TPU, LANSTAT.PAS, 
  24. and FISTIES.PAS.  LAN5.DOC is this text file.  LAN50.TPU is the 
  25. Turbo Pascal 5.0 Unit containing LAN procedures and functions.  
  26. LAN55.TPU is the Turbo Pascal 5.5 Unit containing LAN procedures 
  27. and functions.  LANSTAT.PAS is the source code for a network 
  28. status program with examples of how to use LAN5x.TPU.  
  29. FISTIES.PAS is the source for the rock/sissors/paper game using 
  30. LAN5x.  
  31.  
  32. The LAN procedures and functions provided are: 
  33.  
  34. PROCEDURES:                         FUNCTIONS:        
  35. -------------------                 ----------------  
  36. Lock                                LANinstalled      
  37. Unlock                              NetBIOSavailable  
  38. ShowRedirList                       Server            
  39. FreeRedirList                       Redirector        
  40. GetExtendedDosError                 Messenger         
  41. ShowVerboseError                    Receiver          
  42.                                     ShareInstalled    
  43.                                     Machine_name      
  44.                                     GetRedirList      
  45.                                     IsLocked          
  46.                                     CarryClear        
  47.  
  48.  
  49.  
  50.  
  51. The routines are described in detail on the following pages.
  52.  
  53. (**********************************************************)
  54.  
  55. Lock Procedure
  56.  
  57. Declaration: procedure lock(var f; recnum : longint);
  58.  
  59. Description: Performs a DOS LOCK on a record so that the record 
  60. can't be read without a sharing violation.  
  61.  
  62. Example: lock(DATAFILE,filepos(DATAFILE));
  63.  
  64. Notes: Sets ExtendedDOSError for use with ShowVerboseError or 
  65. your own error reporting procedure.  
  66.  
  67. (**********************************************************) 
  68.  
  69. UnLock Procedure
  70.  
  71. Declaration: 
  72.   procedure unlock(var f; recnum : longint);
  73.  
  74. Description: Performs a DOS UNLOCK on a record so that the record 
  75. can again be read without a sharing violation.  
  76.  
  77. Example: unlock(DATAFILE,filepos(DATAFILE)-1);
  78.  
  79. Note: Every Lock must be paired with an Unlock and every Unlock 
  80. with a Lock.  Sets ExtendedDOSError for use with ShowVerboseError 
  81. or your own error reporting procedure.  
  82.  
  83. (**********************************************************)
  84.  
  85. ShowRedirList Procedure
  86.  
  87. Declaration: procedure ShowRedirList;
  88.  
  89. Description: Lists local and network names for each device 
  90. (printers & drives) connected to the network.  For printers, the 
  91. "printer setup string" is shown.  
  92.  
  93. Example: 
  94.   if GetRedirList>0 then
  95.     begin
  96.       FreeRedirList; {paired with GetRedirList call above}
  97.       writeln('The Redirection List is as follows:');
  98.       ShowRedirList;
  99.     end
  100.   else writeln('No devices are redirected.');
  101.  
  102. Note: ShowDirList does a GetRedirList before and a FreeDirList 
  103. after the redirection list is displayed.  
  104.  
  105. (**********************************************************)
  106.  
  107. FreeRedirList Procedure
  108.  
  109. Declaration: procedure FreeRedirList;
  110.  
  111. Description: The Redirection List is kept on the heap in a 176-
  112. byte record structure.  GetRedirList allocates and initializes 
  113. this record;  FreeRedirList deallocates this structure.  
  114.  
  115. Note: Every GetRedirList must be paired with a FreeRedirList and 
  116. vis versa.  
  117.  
  118. (**********************************************************)
  119.  
  120. GetExtendedDosError Procedure
  121.  
  122. Declaration: procedure GetExtendedDosError(regs: registers);
  123.  
  124. Description: Uses DOS function 59h to set the real variable 
  125. ExtendedDosError.  I opted to map the three registers (ax, bx and 
  126. cx) into a single real variable to simplify interpretation.  For 
  127. example, if DOS's SHARE is not installed and you try to do a 
  128. "lock", ExtendedError will be returned as 17236993.0.  A 
  129. constant, ShareNotInstalled, is declared to be equal to this 
  130. number so a statement like "if ExtendedError=ShareNotInstalled 
  131. then writeln('DOS Share is not installed.');" can be expressed.  
  132.  
  133. Example: GetExtendedError(regs);
  134.  
  135. Notes: Most of the time you won't need this procedure since it is 
  136. used automatically by the LOCK and UNLOCK procedures (and 
  137. others).  ShowVerboseError tests and interprets the ExtendedError 
  138. variable.  
  139.  
  140. (**********************************************************)
  141.  
  142. ShowVerboseError Procedure
  143.  
  144. Declaration: 
  145.   procedure ShowVerboseError(ExtendedError: real);
  146.  
  147. Description: ShowVerboseError translates the ExtendedError 
  148. variable into English.  
  149.  
  150. (**********************************************************)
  151.  
  152. LANinstalled Function
  153.  
  154. Declaration: function LANinstalled : boolean;
  155.  
  156. Description: Returns true if a LAN is installed; otherwise returns false.
  157.  
  158. (**********************************************************)
  159.  
  160. NetBIOSavailable Function
  161.  
  162. Declaration: function NetBIOSavailable : boolean;
  163.  
  164. Description: Returns true if the NetBIOS functions are available; 
  165. otherwise returns false.  
  166.  
  167. (**********************************************************)
  168.  
  169. Server Function
  170.  
  171. Declaration: function Server : boolean;
  172.  
  173. Description: Returns true if this station is installed as a 
  174. server; otherwise returns false.  
  175.  
  176. (**********************************************************)
  177.  
  178. Redirector Function
  179.  
  180. Declaration: function Redirector : boolean;
  181.  
  182. Description: Returns true if this station is installed as a 
  183. redirector; otherwise returns false.  
  184.  
  185. (**********************************************************)
  186.  
  187. Messenger Function
  188.  
  189. Declaration: function Messenger : boolean;
  190.  
  191. Description: Returns true if this station is installed as a 
  192. messenger; otherwise returns false.  
  193.  
  194. (**********************************************************)
  195.  
  196. Receiver Function
  197.  
  198. Declaration: function Receiver : boolean;
  199.  
  200. Description: Returns true if this station is installed as a 
  201. receiver; otherwise returns false.  
  202.  
  203. (**********************************************************)
  204.  
  205. ShareInstalled Function
  206.  
  207. Declaration: function ShareInstalled : boolean;
  208.  
  209. Description: Returns true if SHARE is installed; otherwise 
  210. returns false.  
  211.  
  212. (**********************************************************) 
  213.  
  214. Machine_Name Function
  215.  
  216. Declaration: function Machine_Name:string;
  217.  
  218. Description: Returns the network name for this station.
  219.  
  220. (**********************************************************)
  221.  
  222. GetRedirList Function
  223.  
  224. Declaration: function GetRedirList : byte;
  225.  
  226. Description: Returns the number of items (printers and drives) in 
  227. the redirection list.  Also allocates a 176-byte record for each 
  228. item containing the local and network device names, their types 
  229. and status as shown: 
  230.  
  231.     RedirListPtr = ^RedirectionType;
  232.     RedirectionType = record
  233.                         AssignListIndex : word;
  234.                         Device_name : string[17];
  235.                         Logical_name: string[128];
  236.                         {type: printer,disk_drive,unknown}
  237.                         Device_type : string[10];
  238.                         {status: valid,invalid,unknown}
  239.                         Device_valid: string[7];
  240.                         prev, next  : RedirListPtr;
  241.                       end;
  242.  
  243. (**********************************************************)
  244.  
  245. IsLocked Function
  246.  
  247. Declaration: function IsLocked(var f; recnum:longint);
  248.  
  249. Description: Returns true if the record is able to be read by 
  250. this station; otherwise returns false.  
  251.  
  252. Notes: Sets ExtendedDosError.
  253.  
  254. (**********************************************************)
  255.  
  256. IsLockedUsingLock Function
  257.  
  258. Declaration: 
  259.   function IsLockedUsingLock(var f; recnum:longint);
  260.  
  261. Description: Returns true if the record is already locked.  Note 
  262. that it will temporarily lock a record if the record is not 
  263. already locked.  
  264.  
  265. Notes: Sets ExtendedDosError.
  266.  
  267. (**********************************************************)
  268.  
  269. CarryClear Function
  270.  
  271. Declaration: function CarryClear(regs:registers) : boolean;
  272.  
  273. Description: Used internally by many of the other functions to 
  274. determine whether an error has occurred or not.  Some of Turbo's 
  275. built-in routines change the carry flag so it was important to 
  276. have a separate function.  
  277.  
  278. (**********************************************************)
  279.  
  280.  
  281. Keep in touch for possible future upgrades.
  282.