
(/VERSIONCHECK 2) 

(DEFUN |FTEM;fortranLiteralLine;SV;1| (|s| $)
  (SEQ (PRINTEXP |s| |$fortranOutputStream|)
       (EXIT (TERPRI |$fortranOutputStream|)))) 

(PUT '|FTEM;fortranLiteral;SV;2| '|SPADreplace|
     '(XLAM (|s|) (PRINTEXP |s| |$fortranOutputStream|))) 

(DEFUN |FTEM;fortranLiteral;SV;2| (|s| $) (PRINTEXP |s| |$fortranOutputStream|)) 

(PUT '|FTEM;fortranCarriageReturn;V;3| '|SPADreplace|
     '(XLAM NIL (TERPRI |$fortranOutputStream|))) 

(DEFUN |FTEM;fortranCarriageReturn;V;3| ($) (TERPRI |$fortranOutputStream|)) 

(DEFUN |FTEM;writePassiveLine!| (|line| $) (SPADCALL |line| (QREFELT $ 9))) 

(DEFUN |FTEM;processTemplate;3Fn;5| (|tp| |fn| $)
  (SEQ (SPADCALL |fn| (QREFELT $ 14)) (SPADCALL |tp| (QREFELT $ 15))
       (SPADCALL (QREFELT $ 16)) (EXIT |fn|))) 

(DEFUN |FTEM;getLine| (|fp| $)
  (PROG (|line|)
    (RETURN
     (SEQ
      (LETT |line| (SPADCALL (SPADCALL |fp| (QREFELT $ 18)) (QREFELT $ 20))
            . #1=(|FTEM;getLine|))
      (SEQ G190
           (COND
            ((NULL
              (COND ((SPADCALL |line| (QREFELT $ 22)) 'NIL)
                    ('T
                     (SPADCALL
                      (SPADCALL |line| (SPADCALL |line| (QREFELT $ 24))
                                (QREFELT $ 26))
                      (SPADCALL "_" (QREFELT $ 27)) (QREFELT $ 28)))))
             (GO G191)))
           (SEQ
            (SPADCALL |line| (SPADCALL |line| (QREFELT $ 24))
                      (SPADCALL " " (QREFELT $ 27)) (QREFELT $ 29))
            (EXIT
             (LETT |line|
                   (STRCONC |line|
                            (SPADCALL (SPADCALL |fp| (QREFELT $ 18))
                                      (QREFELT $ 20)))
                   . #1#)))
           NIL (GO G190) G191 (EXIT NIL))
      (EXIT |line|))))) 

(DEFUN |FTEM;processTemplate;2Fn;7| (|tp| $)
  (PROG (|active| |line| #1=#:G678 |endInput| |fp|)
    (RETURN
     (SEQ
      (LETT |fp| (SPADCALL |tp| "input" (QREFELT $ 30))
            . #2=(|FTEM;processTemplate;2Fn;7|))
      (LETT |active| 'T . #2#) (LETT |endInput| 'NIL . #2#)
      (SEQ G190
           (COND
            ((NULL
              (COND ((OR |endInput| (SPADCALL |fp| (QREFELT $ 31))) 'NIL)
                    ('T 'T)))
             (GO G191)))
           (SEQ
            (EXIT
             (COND
              (|active|
               (SEQ (LETT |line| (|FTEM;getLine| |fp| $) . #2#)
                    (EXIT
                     (COND
                      ((EQUAL |line| "endInput") (LETT |endInput| 'T . #2#))
                      ((EQUAL |line| "beginVerbatim")
                       (LETT |active| 'NIL . #2#))
                      ('T
                       (SEQ
                        (EXIT
                         (COND
                          ((NULL (SPADCALL |line| (QREFELT $ 22)))
                           (PROGN
                            (LETT #1# (SPADCALL |line| (QREFELT $ 33)) . #2#)
                            (GO #1#)))))
                        #1# (EXIT #1#)))))))
              ('T
               (SEQ (LETT |line| (SPADCALL |fp| (QREFELT $ 18)) . #2#)
                    (EXIT
                     (COND
                      ((EQUAL |line| "endVerbatim") (LETT |active| 'T . #2#))
                      ('T (|FTEM;writePassiveLine!| |line| $)))))))))
           NIL (GO G190) G191 (EXIT NIL))
      (SPADCALL |fp| (QREFELT $ 34))
      (COND
       ((NULL |active|)
        (|error|
         (SPADCALL
          (SPADCALL
           (LIST "Missing `endVerbatim' line in "
                 (SPADCALL |tp| (QREFELT $ 35)))
           (QREFELT $ 37))
          (QREFELT $ 39)))))
      (EXIT (SPADCALL (STRINGIMAGE |$fortranOutputFile|) (QREFELT $ 40))))))) 

(DEFUN |FortranTemplate| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G685)
       (RETURN
        (COND
         ((LETT #2# (HGET |$ConstructorCache| '|FortranTemplate|)
                . #3=(|FortranTemplate|))
          (|CDRwithIncrement| (CDAR #2#)))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (CDDAR
                   (HPUT |$ConstructorCache| '|FortranTemplate|
                         (LIST (CONS NIL (CONS 1 (|FortranTemplate;|))))))
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#) (HREM |$ConstructorCache| '|FortranTemplate|))))))))))) 

(DEFUN |FortranTemplate;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|FortranTemplate|) . #1=(|FortranTemplate|))
      (LETT $ (GETREFV 42) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|FortranTemplate| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 (|TextFile|))
      $)))) 

(MAKEPROP '|FortranTemplate| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|TextFile|) '|Rep| (|Void|) (|String|)
              |FTEM;fortranLiteralLine;SV;1| |FTEM;fortranLiteral;SV;2|
              |FTEM;fortranCarriageReturn;V;3| (|FileName|)
              (|FortranOutputStackPackage|) (0 . |pushFortranOutputStack|)
              |FTEM;processTemplate;2Fn;7| (5 . |popFortranOutputStack|)
              |FTEM;processTemplate;3Fn;5| (9 . |readLine!|)
              (|TemplateUtilities|) (14 . |stripCommentsAndBlanks|) (|Boolean|)
              (19 . |empty?|) (|Integer|) (24 . |maxIndex|) (|Character|)
              (29 . |elt|) (35 . |char|) (40 . =) (46 . |setelt|) (53 . |open|)
              (59 . |endOfFile?|) (|Any|) (64 . |interpretString|)
              (69 . |close!|) (74 . |coerce|) (|List| $) (79 . |concat|)
              (|OutputForm|) (84 . |coerce|) (89 . |coerce|) (|SingleInteger|))
           '#(~= 94 |write!| 100 |reopen!| 106 |read!| 112 |processTemplate|
              117 |open| 128 |name| 139 |latex| 144 |iomode| 149 |hash| 154
              |fortranLiteralLine| 159 |fortranLiteral| 164
              |fortranCarriageReturn| 169 |coerce| 173 |close!| 178 = 183)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0 0 0))
                 (CONS '#(NIL |SetCategory&| |BasicType&| NIL)
                       (CONS
                        '#((|FileCategory| 12 8) (|SetCategory|) (|BasicType|)
                           (|CoercibleTo| 38))
                        (|makeByteWordVec2| 41
                                            '(1 13 7 12 14 0 13 7 16 1 6 8 0 18
                                              1 19 8 8 20 1 8 21 0 22 1 8 23 0
                                              24 2 8 25 0 23 26 1 25 0 8 27 2
                                              25 21 0 0 28 3 8 25 0 23 25 29 2
                                              5 0 12 8 30 1 6 21 0 31 1 19 32 8
                                              33 1 0 0 0 34 1 12 8 0 35 1 8 0
                                              36 37 1 8 38 0 39 1 12 0 8 40 2 0
                                              21 0 0 1 2 0 8 0 8 1 2 0 0 0 8 1
                                              1 0 8 0 1 1 0 12 12 15 2 0 12 12
                                              12 17 1 0 0 12 1 2 0 0 12 8 1 1 0
                                              12 0 1 1 0 8 0 1 1 0 8 0 1 1 0 41
                                              0 1 1 0 7 8 9 1 0 7 8 10 0 0 7 11
                                              1 0 38 0 1 1 0 0 0 34 2 0 21 0 0
                                              1)))))
           '|lookupComplete|)) 

(MAKEPROP '|FortranTemplate| 'NILADIC T) 
