%option '-nons'
{updated for Pad stuff      by KJC 8/12/86 }
{updated for Padplace spec. by DJR 1/12/86}
{updated for glass layer by DJR 4/12/86}
{updated for annotation layer by DJR 19/12/86}
const

   pwell = 'PW';
   nwell = 'NW';
   diff = 'AA';
   poly = 'PY';
   ndiff = 'ND';
   pdiff = 'PD';
   nplus = 'NI';
   pplus = 'PI';
   contact = 'CC';
   metal1 = 'M1';
   via = 'VI';
   metal2 = 'M2';
   glass = 'GZ';

var

zzzz : boolean;

procedure firstcellnumber %alias 'ILAP_FIRST_CELL_NUMBER'(num : integer);extern;
procedure setlambda %alias 'ILAP_SET_LAMBDA' (lambda : integer); extern;
procedure getlambda %alias 'ILAP_GET_LAMBDA' (var lambda : integer); extern;
procedure seterrorstream %alias 'ILAP_SET_ERROR_STREAM' (st : integer); extern;
procedure setcifstream %alias 'ILAP_SET_ERROR_STREAM' (st : integer); extern;
procedure warning %alias 'ILAP_WARNING' (message : string[255]); extern;
procedure disaster %alias 'ILAP_DISASTER' (message : string[255]); extern;
procedure updatembb %alias 'ILAP_UPDATE_MBB' (xl, yb, xr, yt : integer); extern;
procedure fixmbb %alias 'ILAP_FIX_MBB' (xl, yb, xr, yt : integer); extern;
function  ilapwarnings %alias 'ILAP_WARNINGS' : integer; extern;

procedure pluson %alias 'ILAP_PLUS_ON'; extern;
procedure plusoff %alias 'ILAP_PLUS_OFF'; extern;
procedure mergeon %alias 'ILAP_MERGE_ON'; extern;
procedure mergeoff %alias 'ILAP_MERGE_OFF'; extern;

procedure initialise %alias 'ILAP_INIT_CMOS' (s : string[255]) ; extern;
procedure finish %alias 'ILAP_FINISH' ; extern;
procedure givestatistics %alias 'ILAP_GIVE_STATISTICS' ; extern;

procedure endsymbol %alias 'ILAP_END_SYMBOL' ; extern;
procedure symbol %alias 'ILAP_SYMBOL' (name : string[31]) ; extern;
procedure symbolspec %alias 'ILAP_SYMBOL_SPEC' 
  (name : string[31]; xl, yb, xr, yt : integer) ; extern;
procedure externalsymbol %alias 'ILAP_EXTERNAL_SYMBOL' 
  (name : string[31]; number : integer) ; extern;
procedure externalsymbolspec %alias 'ILAP_EXTERNAL_SYMBOL_SPEC' 
  (name : string[31]; number, xl, yb, xr, yt : integer) ; extern;

procedure box %alias 'ILAP_BOX' (xl, yb, xr, yt : integer) ; extern;
procedure polygon %alias 'ILAP_POLYGON' (x, y : integer) ; extern;
procedure line %alias 'ILAP_LINE' (x, y : integer) ; extern;
procedure wirex %alias 'ILAP_WIREX' (x, y, l : integer) ; extern;
procedure wirey %alias 'ILAP_WIREY' (x, y, l : integer) ; extern;
procedure vsswirex %alias 'ILAP_VSSWIREX' (x, y, l : integer) ; extern;
procedure vsswirey %alias 'ILAP_VSSWIREY' (x, y, l : integer) ; extern;
procedure vddwirex %alias 'ILAP_VDDWIREX' (x, y, l : integer) ; extern;
procedure vddwirey %alias 'ILAP_VDDWIREY' (x, y, l : integer) ; extern;

procedure NTPX %alias 'ILAP_NTPX'(name : string[31]; x, y, l : integer); extern;
procedure NTPY %alias 'ILAP_NTPY'(name : string[31]; x, y, l : integer); extern;
procedure PTPX %alias 'ILAP_PTPX'(name : string[31]; x, y, l : integer); extern;
procedure PTPY %alias 'ILAP_PTPY'(name : string[31]; x, y, l : integer); extern;
procedure NTDX %alias 'ILAP_NTDX'(name : string[31]; x, y, l : integer); extern;
procedure NTDY %alias 'ILAP_NTDY'(name : string[31]; x, y, l : integer); extern;
procedure PTDX %alias 'ILAP_PTDY'(name : string[31]; x, y, l : integer); extern;
procedure PTDY %alias 'ILAP_PTDY'(name : string[31]; x, y, l : integer); extern;

procedure ax %alias 'ILAP_AX' (x : integer) ; extern;
procedure ay %alias 'ILAP_AY' (y : integer) ; extern;
procedure axy %alias 'ILAP_AXY' (x, y : integer) ; extern;
procedure dx %alias 'ILAP_DX' (x : integer) ; extern;
procedure dy %alias 'ILAP_DY' (y : integer) ; extern;
procedure dxy %alias 'ILAP_DXY' (x, y : integer) ; extern;

procedure layer %alias 'ILAP_LAYER' (colour:string[3]) ; extern;
function clayer %alias 'ILAP_CLAYER' : string ; extern;
procedure width %alias 'ILAP_WIDTH' (size : integer) ; extern;
function cwidth %alias 'ILAP_CWIDTH' : integer ; extern;

procedure cifcomment %alias 'ILAP_CIF_COMMENT' (s : string[255]) ; extern;
procedure cifstatement  %alias 'ILAP_CIF_STATEMENT' (s : string[255]) ; extern;
procedure userextension %alias 'ILAP_USER_EXTENSION'
  (no : integer; s : string[255]) ; extern;
procedure nodelabel %alias 'ILAP_NODE_LABEL'
  (lab : string[31]; x, y : integer; layer : string[3]) ; extern;

procedure draw %alias 'ILAP_DRAW'
  (name : string[31]; x, y : integer) ; extern;
procedure drawmx %alias 'ILAP_DRAW_MX'
  (name : string[31]; x, y : integer) ; extern;
procedure drawmy %alias 'ILAP_DRAW_MY'     
  (name : string[31]; x, y : integer) ; extern;
procedure drawrot %alias 'ILAP_DRAW_ROT'    
  (name : string[31]; x, y, rot : integer) ; extern;
procedure drawmxrot %alias 'ILAP_DRAW_MX_ROT' 
  (name : string[31]; x, y, rot : integer) ; extern;
procedure drawmyrot %alias 'ILAP_DRAW_MY_ROT' 
  (name : string[31]; x, y, rot : integer) ; extern;

function SX %alias 'ILAP_SX' (name : string[31]) : integer ; extern;
function SY %alias 'ILAP_SY' (name : string[31]) : integer ; extern;
function LX %alias 'ILAP_LX' (name : string[31]) : integer ; extern;
function LY %alias 'ILAP_LY' (name : string[31]) : integer ; extern;
function Symbolexists %alias 'ILAP_SYMBOL_EXISTS'
  (name : string[31]) : boolean; extern;

procedure nsub %alias 'ILAP_NSUB'  ( x, y : integer) ; extern;
procedure psub %alias 'ILAP_ PSUB' ( x, y : integer) ; extern;
procedure nsubn %alias 'ILAP_NSUBN' ( x, y : integer) ; extern;
procedure nsubs %alias 'ILAP_NSUBS' ( x, y : integer) ; extern;
procedure nsube %alias 'ILAP_NSUBE' ( x, y : integer) ; extern;
procedure nsubw %alias 'ILAP_NSUBW' ( x, y : integer) ; extern;
procedure psubn %alias 'ILAP_PSUBN' ( x, y : integer) ; extern;
procedure psubs %alias 'ILAP_PSUBS' ( x, y : integer) ; extern;
procedure psube %alias 'ILAP_PSUBE' ( x, y : integer) ; extern;
procedure psubw %alias 'ILAP_PSUBW' ( x, y : integer) ; extern;
procedure ndm %alias 'ILAP_NDM' ( x, y : integer) ; extern;
procedure pdm %alias 'ILAP_PDM' ( x, y : integer) ; extern;
procedure pm %alias 'ILAP_PM' ( x, y : integer) ; extern;
procedure mm %alias 'ILAP_MM' ( x, y : integer) ; extern;

procedure tpla %alias 'ILAP_TPLA'
  (name : string[31]; filename : string[255]); extern;
procedure epla %alias 'ILAP_EPLA'
  (name : string[31]; filename : string[255]); extern;
procedure rom %alias 'ILAP_ROM'
  (name : string[31]; filename : string[255]); extern;
procedure tplap %alias 'ILAP_TPLAP'
  (name : string[31]; filename : string[255];
   var ins, feeds, outs : integer); extern;
procedure eplap %alias 'ILAP_EPLAP'
  (name : string[31]; filename : string[255];
   var ins, feeds, outs : integer); extern;
procedure romp %alias 'ILAP_ROMP'
  (name : string[31]; filename : string[255];
   var ins, outs : integer); extern;

procedure equate %alias 'ILAP_EQUATE' (parm : string[255]); extern;
procedure table %alias 'ILAP_TABLE' (parm : string[255]); extern;

procedure crest %alias 'ILAP_CREST'
  (name : string[31]; xsize, ysize : integer);  extern;
procedure text %alias 'ILAP_TEXT'
  (name : string[31]; text : string[255]; xsize, ysize : integer) ; extern;
procedure copyright %alias 'ILAP_COPYRIGHT'  
  (name : string[31]; xsize, ysize : integer) ; extern;
procedure setannotationlayer %alias 'ILAP_SET_ANNOTATION_LAYER'
  (layer : string[3]) ; extern;

{  ILAP New Universal Ports Stuff }
{  %Internal to Ilap code : }
Type Portform = Record
   name : string[31];
   xl, yb, xr, yt : integer;
   layer : string[3];
   kind : integer;
end;

Function Port(name: string[31]; xl, yb, xr, yt : integer;
              layer : string[3]; kind : integer) : portform; extern;
Procedure PresetPort(symname : string[31]; p : portform); extern;
Procedure SetPort(p : portform) ; extern;
Procedure Changeport(symname : string[31]; p : portform); extern;
Function GetPort(symname, portname : string[31]): portform;extern;
Procedure ResettoFirstPort(symname : string[31]; side : integer); extern;
Function GetNextPort(symname : string[31] ; side : Integer) : portform ; extern;
Function MakePortName(basic,ext:string[31];index:integer):string;extern;
Procedure BreakPortName( PortName : string[31]; Var basic, ext : String[31];
                         Var Index : Integer ); extern;
Const
   North = 1; East = 2; South = 3; West = 4; Allports = 5;

{ ROUTING declarations }

Procedure Rroute %alias 'ILAP_RROUTE' (name :string [31]);extern;
Procedure RrouteDir %alias 'ILAP_RROUTEDIR' (name :string[31] ;
                                           SideFrom,SideTo :integer);extern;
Procedure Riverroute %alias 'ILAP_RIVERROUTE' (name :string[31] ;
                          SideFrom, SideTo :integer;
                          lay  :string[4];
                          n,tsep,twid :integer);extern;
const
 optimumsepn   = 1; {if this sepn specified, route optimally}
    {for routing directions}
 NUL='';
Procedure Cornerroute %alias 'ILAP_CORNER_ROUTE' 
    (name     :string[31];
     from, too :integer;
     lay      :string[3];
     n        :integer;
     tsep,twid:integer); extern;

Procedure CROUTEdir %alias 'ILAP_CROUTEDIR' (name :string[31];
                                             from,too :integer); extern;

Procedure CROUTE %alias 'ILAP_CROUTE' (name :string[31]); extern;

Procedure Padplace %alias 'ILAP_PADPLACE'
  (chipname, corename :string[31]); extern;

{Port KINDS for padplace}
const
 VDDPORT=1;
 VSSPORT=2;
 INPORT=3;
 OUTPORT=4;
 CLOUTOUTPORT=5;
 CLOUTCLPORT=6;
 INOUTINPORT=7;
 INOUTOUTPORT=8;
 INOUTENPORT=9;
 VDDXPORT=10;
