-- MOSSIMFns.mesa
-- created by Suzuki: May 15, 1981  11:33 AM 
-- last edited by Suzuki: September 8, 1981  9:30 AM 

-- All the functions used to interface between JaM and MOSSIM are defined.

-- 1) The way parameters are passed to these functions are uniform:
--There are two global variables  targc & targv  exported by SimNsim.mesa
-- targc must be the number of arguments plus 1 and targv is an array of 
--STRING, which contains all the arguments. 
-- targv[0] contains a garbage.  targv[i] contains the i-th argument.  

-- 2) The error messages are passed to the global array JaMError, instead to
-- the display. Therefore, no error means JaMError.length=0.


DIRECTORY
  SimTsim USING [MaxTargv];

MOSSIMFns: DEFINITIONS =
  {

  targc: CARDINAL;
  targv: ARRAY [0..SimTsim.MaxTargv) OF STRING;

  UnderJaM: BOOLEAN;  -- TRUE if and only if it is running under JaM

  JaMError: STRING;

  readFileString: PROC;
  -- targc = 2
  -- invokes @ <filename>

  Debug: PROC;
  -- targc = 1
  -- invokes D

  readStateString: PROC;
  -- targc = 2
  -- invokes < <filename>

  writeStateString: PROC;
  -- targc = 2
  -- invokes > <filename>

  eTrans: PROC;
  -- 4<=targc<=10
  -- invokes e a1 a2 a3 ...

  dTrans: PROC;
  -- 4<=targc<=10
  -- invokes d a1 a2 a3 ...

  nodeInfoString: PROC;
  -- targc = 8
  -- invokes N a1 a2 a3 ...

  setInputH: PROC;
  -- 1 < targc
  -- invokes h a1 ...

  setInputL: PROC;
  -- 1 < targc
  -- invokes l a1 ...

  setInputX: PROC;
  -- 1 < targc
  -- invokes x a1 ...

  userNameString: PROC;
  -- 2 < targc
  -- invokes = node name1 ...

  setWatchString: PROC;
  -- 1 < targc
  -- invokes w name ...

  setBitsString: PROC;
  -- targc > 2
  -- invokes W vector name1 name2 ...

  vectorValue: PUBLIC PROC RETURNS [STRING];
  -- targc = 2
  -- Returns the vector value of name

  putVectorValue: PUBLIC PROC [LONG INTEGER];
  -- targc = 1

  getNodeValue: PROC RETURNS [INTEGER];
  -- targc = 2
  -- Obtains the value (0 = '0, 1 = '1, 2 = 'X, 3 = 'S, 4 = '-) of the node

  initializationResult: PUBLIC PROC RETURNS [CARDINAL];
  -- targc = 1
  -- invokes I

  cycleResult: PROC RETURNS [CARDINAL];
  -- targc = 2 OR 1
  -- invokes c <number>
  -- Returns the number of steps

  makeGatesResult: PROC RETURNS [CARDINAL];
  -- targc = 1
  -- invokes L
  -- Returns the total number of transistors eliminated

  step: PROC RETURNS [CARDINAL];
  -- targc = 1
  -- invokes s
  -- Returns the number of steps taken

  resetChangeCount: PROC;
  displayChangedNodes: PROC;

  traceNodes: PROC;
  unTraceNodes: PROC;

  question: PROC;
  exclamation: PROC;

  ToggleWarning: PROC;

  MOSSIMEnter: PROC;

  }.