-- file: ParsePrivate.mesa
-- Pascal-to-Mesa translator output, translated at April 29, 1988 5:57:26 pm PDT


DIRECTORY
  PascalBasic,
  PascalNoviceFiles;

ParsePrivate: DEFINITIONS IMPORTS  =
BEGIN OPEN PascalBasic, PascalNoviceFiles;
 Maxnamesize  : PascalInteger =100;

      Keywordsize  : PascalInteger =15;


      --Module Type Constants

      Standard     : PascalInteger =1;

      Pad          : PascalInteger =2;

      General      : PascalInteger =3;

      Parent       : PascalInteger =4;

      Feedthrough  : PascalInteger =5;

      Endfile      : PascalInteger =6;


      -- Unspecified Position and width on terminal constants 

      Noposition  : PascalReal =-1.0;

      Nowidth     : PascalReal =-1.0;



      --IO Pin type constants

      I   : PascalInteger =1;

      O   : PascalInteger =2;

      B   : PascalInteger =3;

      Pi  : PascalInteger =4;

      Po  : PascalInteger =5;

      Pb  : PascalInteger =6;

      F   : PascalInteger =7;


      --Pin side constants
      Bottom  : PascalInteger =1;

      Right   : PascalInteger =2;

      Top     : PascalInteger =3;

      Left    : PascalInteger =4;

      Noside  : PascalInteger =5;


      --Layer type constants
      Pdiff   : PascalInteger =1;

      Ndiff   : PascalInteger =2;

      Poly    : PascalInteger =3;

      Metal1  : PascalInteger =4;

      Metal2  : PascalInteger =5;

      Nolayer  : PascalInteger =6;



      --Reflection Type Constants
      Rflnone  : PascalInteger =1;

      Rfly     : PascalInteger =2;


      --Rotation Type Constants-- 

      Rot0     : PascalInteger =1;

      Rot90    : PascalInteger =2;

      Rot180   : PascalInteger =3;

      Rot270   : PascalInteger =4;





-- Character strings that define the key words and comments 

-- Comment Delimiters 

      Startcomment  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['/, '*, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Endcomment    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['*, '/, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- End of entry delimeter 

      Lineterminator  : PascalChar =';;


-- Module Parameters 

      Modulekeyword        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['M, 'O, 'D, 'U, 'L, 'E, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Endmodulekeyword     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['E, 'N, 'D, 'M, 'O, 'D, 'U, 'L, 'E, ' , ' , ' , ' , ' , ' ];

      Typekeyword          : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['T, 'Y, 'P, 'E, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Widthkeyword         : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['W, 'I, 'D, 'T, 'H, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Heightkeyword        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['H, 'E, 'I, 'G, 'H, 'T, ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- IOList Delimiters 
      Iolistkeyword        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['I, 'O, 'L, 'I, 'S, 'T, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Endiolistkeyword     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['E, 'N, 'D, 'I, 'O, 'L, 'I, 'S, 'T, ' , ' , ' , ' , ' , ' ];


-- Network Delimiters   
      Networkkeyword       : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['N, 'E, 'T, 'W, 'O, 'R, 'K, ' , ' , ' , ' , ' , ' , ' , ' ];

      Endnetworkkeyword    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['E, 'N, 'D, 'N, 'E, 'T, 'W, 'O, 'R, 'K, ' , ' , ' , ' , ' ];


-- Placement Delimiters 
      Placementkeyword     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'L, 'A, 'C, 'E, 'M, 'E, 'N, 'T, ' , ' , ' , ' , ' , ' ];

      Endplacementkeyword  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['E, 'N, 'D, 'P, 'L, 'A, 'C, 'E, 'M, 'E, 'N, 'T, ' , ' , ' ];


-- Module Types 
      Standardkeyword      : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['S, 'T, 'A, 'N, 'D, 'A, 'R, 'D, ' , ' , ' , ' , ' , ' , ' ];

      Padkeyword           : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'A, 'D, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Generalkeyword       : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['G, 'E, 'N, 'E, 'R, 'A, 'L, ' , ' , ' , ' , ' , ' , ' , ' ];

      Parentkeyword        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'A, 'R, 'E, 'N, 'T, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Feedthroughkeyword   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['F, 'E, 'E, 'D, 'T, 'H, 'R, 'O, 'U, 'G, 'H, ' , ' , ' , ' ];


-- IOList Terminal Types 
      Inputterminal        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['I, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Outputterminal       : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['O, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Bidirectionterminal  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['B, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Padinputterminal     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'I, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Padoutputterminal    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'O, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Padbiterminal        : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'B, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Feedthroughterminal  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['F, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- Side Types 
      Bottomside  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['B, 'O, 'T, 'T, 'O, 'M, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Rightside   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'I, 'G, 'H, 'T, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Topside     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['T, 'O, 'P, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Leftside    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['L, 'E, 'F, 'T, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- Layer Types 
      Pdifflayer    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'D, 'I, 'F, 'F, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Ndifflayer    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['N, 'D, 'I, 'F, 'F, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Polylayer     : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['P, 'O, 'L, 'Y, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Metal1layer   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['M, 'E, 'T, 'A, 'L, '1, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Metal2layer   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['M, 'E, 'T, 'A, 'L, '2, ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- Reflections 
      Noreflection  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'F, 'L, 'N, 'O, 'N, 'E, ' , ' , ' , ' , ' , ' , ' , ' ];

      Yreflection   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'F, 'L, 'Y, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];


-- Rotations 
      Rot0string    : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'O, 'T, '0, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Rot90string   : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'O, 'T, '9, '0, ' , ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Rot180string  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'O, 'T, '1, '8, '0, ' , ' , ' , ' , ' , ' , ' , ' , ' ];

      Rot270string  : PACKED ARRAY PascalInteger[1..15] OF PascalChar =['R, 'O, 'T, '2, '7, '0, ' , ' , ' , ' , ' , ' , ' , ' , ' ];





--Types Definitions


  Nametype : TYPE =   PACKED ARRAY PascalInteger[1..Maxnamesize]  OF  PascalChar;


-- Keyword Type is a  smaller size due to the need in Pascal to pad blanks

      Keywordtype : TYPE =   PACKED ARRAY PascalInteger[1..Keywordsize]  OF  PascalChar;



     Moduletype : TYPE = PascalInteger[Standard .. Endfile];


     Number : TYPE = PascalReal;


     Terminaltype : TYPE = PascalInteger[I .. F];


     Sidetype : TYPE = PascalInteger[Bottom .. Noside];


     Layertype : TYPE = PascalInteger[Pdiff .. Nolayer];



Iolistpointer : TYPE = LONG POINTER TO Iolist;


Iolist : TYPE = RECORD [
    Signalname: Nametype, 
    Terminal: Terminaltype,
    Side:Sidetype, 
    Position: Number,
    Width: Number, 
    Layer: Layertype,
    Link: Iolistpointer
];


Signallistpointer : TYPE = LONG POINTER TO Signallist;


Signallist : TYPE = RECORD [
    Signalname: Nametype, 
    Link:Signallistpointer
];



Networklistpointer : TYPE = LONG POINTER TO Networklist;


Networklist : TYPE = RECORD [
    Instancename: Nametype, 
    Modulename: Nametype, 
    Signallisthead: Signallistpointer, 
    Link: Networklistpointer
];


     Reflectiontype : TYPE = PascalInteger[Rflnone .. Rfly];

     Rotationtype : TYPE = PascalInteger[Rot0 .. Rot270 ];



Placementlistpointer : TYPE = LONG POINTER TO Placementlist;


Placementlist : TYPE = RECORD [
    Instancename: Nametype, 
    Xlocation: Number, 
    Ylocation: Number, 
    Reflection: Reflectiontype, 
    Rotation: Rotationtype, 
    Link: Placementlistpointer
];



     Filenametype : TYPE =   PACKED ARRAY PascalInteger[1..100]  OF  PascalChar;

Inputfile:  Text;

Outputfile:  Text;
Name: LONG POINTER TO  Nametype;

Modtype:  Moduletype;

Width:  Number;

Height:  Number;

Iolisthead:  Iolistpointer;

Networklisthead:  Networklistpointer;

Placementlisthead:  Placementlistpointer;

Done:  PascalBoolean;

Modulenumber:  PascalInteger;

Linenumber:  PascalInteger;
Inputfilename: LONG POINTER TO  Filenametype;
Outputfilename: LONG POINTER TO  Filenametype;



 Getmodule: PROCEDURE[ Tinputfile : LONG POINTER TO Text, 
		     Tname : LONG POINTER TO Nametype,
		     Tmodtype : LONG POINTER TO Moduletype,
		     Twidth : LONG POINTER TO Number,
		     Theight : LONG POINTER TO Number, 
		     Tiolisthead : LONG POINTER TO Iolistpointer, 
		     Tnetworklisthead : LONG POINTER TO Networklistpointer, 
		     Tplacementlisthead : LONG POINTER TO Placementlistpointer,
		     Tlinenumber : LONG POINTER TO PascalInteger]
;


 Writemodule: PROCEDURE[ Woutputfile : LONG POINTER TO Text,
		      Wname : Nametype, 
		      Wmodtype : Moduletype, 
		      Wwidth : Number, 
		      Wheight : Number, 
		      Wiolisthead : Iolistpointer, 
		      Wnetworklisthead : Networklistpointer, 
		      Wplacementlisthead : Placementlistpointer]
;

END.