Course  
  Menu  
  Course  
 Description 
  Course  
  Outline  
 Assignments 
 & Doc Specs 
  Software  
  Summary  
  Class  
  Notes  
 Pseudocode 
  Modules  
  SIC/XE  
  Reference  
 Course  
 Supplement 
CNW Home
Macro Processor Pseudocode.

BEGIN
  initialize Scnt, Indx, and Level to 0
  WHILE Opcode <> "END"
    BEGIN
      Getline
      Processline
    END {While}
END {Main Program}

Getline:
BEGIN
  IF Level > 0
    Nextline <-- Mactab[Indx]
    substitute arguments from Argtab for positional notation
    increment Indx
  ELSE
    Nextline <-- Sourcecode[Scnt]
    increment Scnt
  ENDIF
END {Getline}

Processline:
BEGIN
  Breakup Nextline
  Xsearch Macnames for Opcode
  IF found
    Expand
  ELSE
    IF Opcode = "MACRO"
      Define
    ELSE
      append Nextline to expanded source file
    ENDIF
  ENDIF
END {Processline}

Expand:
BEGIN
  Level <-- Level + 1
  get the macro prototype statement from Mactab
    Note: Indx (retrieved under xsearch) points into Mactab
  set up Argtab from the prototype argument list
  append Nextline as a comment to expanded source file

  SaveIndx <-- Indx
  WHILE Indx <> end of Macro body
    BEGIN
      Getline
      Processline
    END {While}
  Indx <-- SaveIndx
  Level <-- Level - 1
END {Expand}

Define:
BEGIN
  Getline
  Breakup Nextline
  Insert Opcode,Indx into Macnames
    {components of a Macnames entry are macro-name, starting-index, ending-index (TBD)}
  add Nextline to Mactab (incrementing Indx)
  Getline
  Breakup Nextline
    WHILE Opcode <> "MEND"
      BEGIN
        IF Nextline is not a comment
          add Nextline to Mactab (incrementing Indx)
        ENDIF
        Getline
        Breakup Nextline
      END {While}
  update Macnames entry by inserting Indx {ending-index}
END {Define}