Category : Modula II Source Code
Archive   : NETWORK.ZIP
Filename : NETWORK.DEF

 
Output of file : NETWORK.DEF contained in archive : NETWORK.ZIP
DEFINITION MODULE Network;


(* provides file support on a PC network.
can be used without a PC network if DOS 3.1 is used.

Commands here emulate/duplicate those in FileSystem.

This module is a replacement for FileSystem and cannot be
used in combination with it or DiskFiles.
*)


FROM SYSTEM IMPORT AX,BX,CX,DX,SETREG,CODE,SWI,WORD,BYTE,ADDRESS,DOSCALL;


EXPORT QUALIFIED

File,
Response,
Close, Lookup, Rename, Delete, WriteChar, ReadChar,
ReadNBytes, WriteNBytes, SetRead, SetWrite, SetModify,
Reset, SetPos, GetPos, Length;


TYPE

Response = (done,
notdone, notsupported, callerror,
unknownmedium, unknownfile, paramerror,
toomanyfiles, eom, userdeverror);


File = RECORD
name : ARRAY [0..64] OF CHAR;
handle : WORD;
pointHigh : WORD;
pointLow : WORD;
read : BOOLEAN;
write : BOOLEAN;
inuse : BOOLEAN;
eof : BOOLEAN;
res : Response;
END;


PROCEDURE Close ( f : File );

PROCEDURE Lookup (VAR f : File; fileName : ARRAY OF CHAR;
modeshar : ARRAY OF CHAR);

(*
Definitions for Access mode and Sharing based on IBM System 23
Datamaster commands which directly produced the Sopen structure
of Basic, Unix's mode structure, and Modula-2's FileSystem (i.e.
Modify).

Short Unix review for those who may need it or not be familiar with it
----------------------------------------------------------------------
Unix mode structure 3 digit number ABC

A = owner's access
B = group access
C = other access

Bit assignments (0-7) Resulting Combinations
0 (1) = Execute Access 0 = No Access
1 (2) = Write Access 1 = Execute Access
2 (4) = Read Access 2 = Write Access
3 = Write/Execute Access
4 = Read Access
5 = Read/Execute Access
6 = Read/Write Access
7 = Read/Write/Execute Access

Unix file access mode of 644 gives
Owner - Read/Write Access
Group - Read Access
Other - Read Access


-------------------------------------------------------------
Current Lookup modeshar definitions ***
-------------------------------------------------------------
FILE ACCESS (mode) Old Basic Sopen Unix A New Def.
Sequential
Read I I 4 R
Write O O 2 W
Append A A 2 A
Relative
Read R RI 4 R
Write R R 2 W
Read/Write R R 6 M (modify)

Since the open mode of the file does not define the type of data
(sequential or relative), no distinction is made between those
reading & writing modes.

SHARING MODE (shar) DOS Sopen Unix B New Def.
Read/Write allowed Deny None S 6 S
No read/write Compatibility N 0 C
No read/write Deny R/W exclus. 0 N
Read only allowed Deny Write I 4 I
Write only allowed Deny Read O 2 O

Lookup(ProcedurTable,"PROCEDURE.TBL","MN");
Opens the Procedure Table for Modify (Read/Write) with Noshare
*)


PROCEDURE Rename ( VAR f: File; newname : ARRAY OF CHAR );

PROCEDURE Delete ( name : ARRAY OF CHAR; VAR f : File );

PROCEDURE WriteChar( VAR f: File; ch : CHAR);

PROCEDURE ReadChar( VAR f: File; VAR ch : CHAR);

PROCEDURE ReadNBytes( VAR f: File; bufPtr : ADDRESS;
requestedBytes : CARDINAL;
VAR read : CARDINAL );

PROCEDURE WriteNBytes( VAR f: File; bufPtr : ADDRESS;
requestedBytes : CARDINAL;
VAR written : CARDINAL );

PROCEDURE SetRead ( VAR f: File );

PROCEDURE SetWrite ( VAR f: File );

PROCEDURE SetModify ( VAR f: File );

PROCEDURE SetOpen ( VAR f: File );

PROCEDURE Reset ( VAR f: File);

PROCEDURE SetPos( VAR f: File; high,low: CARDINAL);

PROCEDURE GetPos( VAR f: File; VAR high,low: CARDINAL);

PROCEDURE Length( VAR f: File; VAR high,low: CARDINAL);

END Network.


  3 Responses to “Category : Modula II Source Code
Archive   : NETWORK.ZIP
Filename : NETWORK.DEF

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/