extras.lsp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. % RLISP to LISP converter. A C Norman 2004
  2. %%
  3. %% Copyright (C) 2017, following the master REDUCE source files. *
  4. %% *
  5. %% Redistribution and use in source and binary forms, with or without *
  6. %% modification, are permitted provided that the following conditions are *
  7. %% met: *
  8. %% *
  9. %% * Redistributions of source code must retain the relevant *
  10. %% copyright notice, this list of conditions and the following *
  11. %% disclaimer. *
  12. %% * Redistributions in binary form must reproduce the above *
  13. %% copyright notice, this list of conditions and the following *
  14. %% disclaimer in the documentation and/or other materials provided *
  15. %% with the distribution. *
  16. %% *
  17. %% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
  18. %% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
  19. %% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
  20. %% FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
  21. %% COPYRIGHT OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
  22. %% INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
  23. %% BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
  24. %% OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
  25. %% ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
  26. %% TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
  27. %% THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  28. %% DAMAGE. *
  29. %%
  30. % $Id: $
  31. (dm df (u !&optional env) (prog (g w) (setq g (gensym)) (setq w (list (quote
  32. list) (quote (quote let!*)) (list (quote list) (list (quote list) (mkquote (
  33. caaddr u)) (list (quote mkquote) (list (quote cdr) g)))) (list (quote cons) (
  34. quote (quote progn)) (mkquote (cdddr u))))) (return (list (quote dm) (cadr u)
  35. (list g (quote !&optional) (gensym)) w))))
  36. (de oem!-supervisor nil (print (eval (read))))
  37. (de break!-loop (a) (prog (prompt ifile ofile u v) (setq ifile (rds
  38. !*debug!-io!*)) (setq ofile (wrs !*debug!-io!*)) (setq prompt (setpchar
  39. "Break loop (:X exits)> ")) top (setq u (read)) (cond ((equal u (quote !:x))
  40. (go exit)) (t (cond ((equal u (quote !:q)) (progn (enable!-backtrace nil) (
  41. princ "Backtrace now disabled") (terpri))) (t (cond ((equal u (quote !:v)) (
  42. progn (enable!-backtrace t) (princ "Backtrace now enabled") (terpri))) (t (
  43. progn (cond ((null u) (setq v nil)) (t (setq v (errorset u nil nil)))) (cond
  44. ((atom v) (progn (princ ":Q quietens backtrace") (terpri) (princ
  45. ":V enables backtrace") (terpri) (princ ":X exits from break loop") (
  46. terpri) (princ "else form for evaluation") (terpri))) (t (progn (prin "=> ")
  47. (prinl (car v)) (terpri))))))))))) (go top) exit (rds ifile) (wrs ofile) (
  48. setpchar prompt) (return nil)))
  49. (global (quote (s!:gensym!-serial)))
  50. (setq s!:gensym!-serial 0)
  51. (de s!:stamp (n) (cond ((lessp n 0) (append (s!:stamp (minus n)) (quote (!-))
  52. )) (t (cond ((equal n 0) nil) (t (cons (schar
  53. "0123456789abcdefghijklmnopqrstuvwxyz" (remainder n 36)) (s!:stamp (truncate
  54. n 36))))))))
  55. (de dated!-name (base) (intern (list2string (append (explodec base) (cons (
  56. quote !_) (append (reverse (s!:stamp (datestamp))) (cons (quote !_) (explodec
  57. (setq s!:gensym!-serial (plus s!:gensym!-serial 1))))))))))
  58. (de hashtagged!-name (base value) (intern (list2string (append (explodec base
  59. ) (cons (quote !_) (s!:stamp (md60 value)))))))
  60. (remflag (quote (sort sortip)) (quote lose))
  61. (de sort (l pred) (stable!-sortip (append l nil) pred))
  62. (de stable!-sort (l pred) (stable!-sortip (append l nil) pred))
  63. (de sortip (l pred) (stable!-sortip l pred))
  64. (de stable!-sortip (l pred) (prog (l1 l2 w) (cond ((null l) (return l))) (
  65. setq l1 l) (setq l2 (cdr l)) (cond ((null l2) (return l))) (setq l (cdr l2))
  66. (cond ((null l) (progn (cond ((apply2 pred (car l2) (car l1)) (progn (setq l
  67. (car l1)) (rplaca l1 (car l2)) (rplaca l2 l)))) (return l1)))) (setq l l1) (
  68. prog nil lab1000 (cond ((null (and l2 (not (apply2 pred (car l2) (car l)))))
  69. (return nil))) (progn (setq l l2) (setq l2 (cdr l2))) (go lab1000)) (cond ((
  70. null l2) (return l1))) (setq l2 l1) (setq l (cddr l2)) (prog nil lab1001 (
  71. cond ((null (and l (cdr l))) (return nil))) (progn (setq l2 (cdr l2)) (setq l
  72. (cddr l))) (go lab1001)) (setq l l2) (setq l2 (cdr l2)) (rplacd l nil) (setq
  73. l1 (stable!-sortip l1 pred)) (setq l2 (stable!-sortip l2 pred)) (setq l (
  74. setq w (list nil))) (prog nil lab1002 (cond ((null (and l1 l2)) (return nil))
  75. ) (progn (cond ((apply2 pred (car l2) (car l1)) (progn (rplacd w l2) (setq w
  76. l2) (setq l2 (cdr l2)))) (t (progn (rplacd w l1) (setq w l1) (setq l1 (cdr l1
  77. )))))) (go lab1002)) (cond (l1 (setq l2 l1))) (rplacd w l2) (return (cdr l)))
  78. )
  79. (fluid (quote (!*prinl!-visited!-nodes!* !*prinl!-index!* !*prinl!-fn!*
  80. !*print!-array!* !*print!-length!* !*print!-level!*)))
  81. (setq !*print!-length!* (setq !*print!-level!* nil))
  82. (setq !*prinl!-visited!-nodes!* (mkhash 10 0 1.5))
  83. (de s!:prinl0 (x !*prinl!-fn!*) (prog (!*prinl!-index!*) (setq
  84. !*prinl!-index!* 0) (unwind!-protect (progn (s!:prinl1 x 0) (s!:prinl2 x 0))
  85. (clrhash !*prinl!-visited!-nodes!*)) (return x)))
  86. (de s!:prinl1 (x depth) (prog (w length) (cond ((and (fixp !*print!-level!*)
  87. (greaterp depth !*print!-level!*)) (return nil))) (setq length 0) top (cond (
  88. (and (atom x) (not (simple!-vector!-p x)) (not (gensymp x))) (return nil)) (t
  89. (cond ((setq w (gethash x !*prinl!-visited!-nodes!*)) (progn (cond ((equal w
  90. 0) (progn (setq !*prinl!-index!* (plus !*prinl!-index!* 1)) (puthash x
  91. !*prinl!-visited!-nodes!* !*prinl!-index!*)))) (return nil))) (t (progn (
  92. puthash x !*prinl!-visited!-nodes!* 0) (cond ((simple!-vector!-p x) (progn (
  93. cond (!*print!-array!* (progn (setq length (upbv x)) (cond ((and (fixp
  94. !*print!-length!*) (lessp !*print!-length!* length)) (setq length
  95. !*print!-length!*))) (prog (i) (setq i 0) lab1003 (cond ((minusp (times 1 (
  96. difference length i))) (return nil))) (s!:prinl1 (getv x i) (plus depth 1)) (
  97. setq i (plus i 1)) (go lab1003))))))) (t (cond ((not (atom x)) (progn (
  98. s!:prinl1 (car x) (plus depth 1)) (cond ((and (fixp !*print!-length!*) (
  99. greaterp (setq length (plus length 1)) !*print!-length!*)) (return nil))) (
  100. setq x (cdr x)) (go top)))))))))))))
  101. (de s!:prinl2 (x depth) (cond ((and (fixp !*print!-level!*) (greaterp depth
  102. !*print!-level!*)) (princ "#")) (t (cond ((and (atom x) (not (
  103. simple!-vector!-p x)) (not (gensymp x))) (progn (funcall !*prinl!-fn!* x))) (
  104. t (prog (w length) (setq w (gethash x !*prinl!-visited!-nodes!*)) (cond ((not
  105. (zerop w)) (progn (cond ((lessp w 0) (progn (princ "#") (princ (minus w)) (
  106. princ "#") (return nil))) (t (progn (puthash x !*prinl!-visited!-nodes!* (
  107. minus w)) (princ "#") (princ w) (princ "="))))))) (cond ((simple!-vector!-p x
  108. ) (progn (princ "%(") (cond (!*print!-array!* (progn (setq length (upbv x)) (
  109. cond ((and (fixp !*print!-length!*) (lessp !*print!-length!* length)) (setq
  110. length !*print!-length!*))) (prog (i) (setq i 0) lab1004 (cond ((minusp (
  111. times 1 (difference length i))) (return nil))) (progn (s!:prinl2 (getv x i) (
  112. plus depth 1)) (cond ((not (equal i (upbv x))) (princ " ")))) (setq i (plus i
  113. 1)) (go lab1004)))) (t (princ "..."))) (princ ")") (return nil))) (t (cond (
  114. (atom x) (return (funcall !*prinl!-fn!* x)))))) (princ "(") (setq length 0)
  115. loop (s!:prinl2 (car x) (plus depth 1)) (setq x (cdr x)) (cond ((atom x) (
  116. progn (cond ((simple!-vector!-p x) (progn (princ " . %(") (cond (
  117. !*print!-array!* (progn (setq length (upbv x)) (cond ((and (fixp
  118. !*print!-length!*) (lessp !*print!-length!* length)) (setq length
  119. !*print!-length!*))) (prog (i) (setq i 0) lab1005 (cond ((minusp (times 1 (
  120. difference length i))) (return nil))) (progn (s!:prinl2 (getv x i) (plus
  121. depth 1)) (cond ((not (equal i (upbv x))) (princ " ")))) (setq i (plus i 1))
  122. (go lab1005)))) (t (princ "..."))) (princ ")"))) (t (cond (x (progn (princ
  123. " . ") (funcall !*prinl!-fn!* x)))))) (return (princ ")"))))) (cond ((and (
  124. fixp !*print!-length!*) (greaterp (setq length (plus length 1))
  125. !*print!-length!*)) (return (princ " ...)")))) (setq w (gethash x
  126. !*prinl!-visited!-nodes!*)) (cond ((not (equal w 0)) (cond ((lessp w 0) (
  127. progn (princ " . #") (princ (minus w)) (return (princ "#)")))) (t (progn (
  128. princ " . ") (s!:prinl2 x (plus depth 1)) (return (princ ")")))))) (t (princ
  129. " "))) (go loop)))))))
  130. (de printl (x) (progn (prinl x) (terpri) x))
  131. (de printcl (x) (progn (princl x) (terpri) x))
  132. (de princl (x) (s!:prinl0 x (function princ)))
  133. (de prinl (x) (s!:prinl0 x (function prin)))
  134. (de s!:format (dest fmt args) (prog (len c a res o) (cond ((not (null dest))
  135. (progn (cond ((equal dest (quote t)) (setq o (wrs nil))) (t (setq o (wrs dest
  136. ))))))) (setq len (upbv fmt)) (prog (i) (setq i 0) lab1012 (cond ((minusp (
  137. times 1 (difference len i))) (return nil))) (progn (setq c (schar fmt i)) (
  138. cond ((equal c (quote !~)) (progn (setq i (plus i 1)) (setq c (char!-downcase
  139. (schar fmt i))) (cond ((equal c (quote !%)) (cond ((null dest) (setq res (
  140. cons !$eol!$ res))) (t (terpri)))) (t (cond ((equal c (quote !~)) (cond ((
  141. null dest) (setq res (cons (quote !~) res))) (t (princ (quote !~))))) (t (
  142. progn (cond ((null args) (setq a nil)) (t (progn (setq a (car args)) (setq
  143. args (cdr args))))) (cond ((equal c (quote !a)) (cond ((null dest) (prog (
  144. var1007) (setq var1007 (explode2 a)) lab1006 (cond ((null var1007) (return
  145. nil))) (prog (k) (setq k (car var1007)) (setq res (cons k res))) (setq
  146. var1007 (cdr var1007)) (go lab1006))) (t (princ a)))) (t (cond ((equal c (
  147. quote !s)) (cond ((null dest) (prog (var1009) (setq var1009 (explode a))
  148. lab1008 (cond ((null var1009) (return nil))) (prog (k) (setq k (car var1009))
  149. (setq res (cons k res))) (setq var1009 (cdr var1009)) (go lab1008))) (t (
  150. prin a)))) (t (cond ((null dest) (prog (var1011) (setq var1011 (explode a))
  151. lab1010 (cond ((null var1011) (return nil))) (prog (k) (setq k (car var1011))
  152. (setq res (cons k res))) (setq var1011 (cdr var1011)) (go lab1010))) (t (
  153. prin (list (quote !?!?!?) c a))))))))))))))) (t (progn (cond ((null dest) (
  154. setq res (cons c res))) (t (princ c))))))) (setq i (plus i 1)) (go lab1012))
  155. (cond ((null dest) (return (list2string (reversip res)))) (t (progn (wrs o) (
  156. return nil))))))
  157. (dm format (u !&optional env) (list (quote s!:format) (cadr u) (caddr u) (
  158. cons (quote list) (cdddr u))))
  159. (fluid (quote (s!:bn s!:bufferi s!:buffero s!:indblanks s!:indentlevel
  160. s!:initialblanks s!:lmar s!:pendingrpars s!:rmar s!:rparcount s!:stack)))
  161. (global (quote (!*quotes !*pretty!-symmetric thin!*)))
  162. (setq !*pretty!-symmetric t)
  163. (setq !*quotes t)
  164. (setq thin!* 5)
  165. (remflag (quote (superprinm superprintm prettyprint tprettyprint)) (quote
  166. lose))
  167. (de prettyprint (x) (progn (superprinm x (posn)) (terpri) nil))
  168. (de tprettyprint (x) (progn (cond ((greaterp (posn) 6) (terpri))) (
  169. prettyprint x)))
  170. (de superprintm (x s!:lmar) (progn (superprinm x s!:lmar) (terpri) x))
  171. (de superprinm (x s!:lmar) (prog (s!:stack s!:bufferi s!:buffero s!:bn
  172. s!:initialblanks s!:rmar s!:pendingrpars s!:indentlevel s!:indblanks
  173. s!:rparcount w) (setq s!:bufferi (setq s!:buffero (list nil))) (setq
  174. s!:initialblanks 0) (setq s!:rparcount 0) (setq s!:indblanks 0) (setq s!:rmar
  175. (linelength nil)) (linelength 500) (cond ((lessp s!:rmar 25) (error 0 (list
  176. s!:rmar "Linelength too short for superprinting")))) (setq s!:bn 0) (setq
  177. s!:indentlevel 0) (cond ((geq (plus s!:lmar 20) s!:rmar) (setq s!:lmar (
  178. difference s!:rmar 21)))) (setq w (posn)) (cond ((greaterp w s!:lmar) (progn
  179. (terpri) (setq w 0)))) (cond ((lessp w s!:lmar) (setq s!:initialblanks (
  180. difference s!:lmar w)))) (s!:prindent x (plus s!:lmar 2)) (s!:overflow (quote
  181. none)) (linelength s!:rmar) (return x)))
  182. (flag (quote (superprinm superprintm prettyprint tprettyprint)) (quote lose))
  183. (dm s!:top (u !&optional v) (quote (car s!:stack)))
  184. (dm s!:depth (u !&optional v) (list (quote car) (cadr u)))
  185. (dm s!:indenting (u !&optional v) (list (quote cadr) (cadr u)))
  186. (dm s!:blankcount (u !&optional v) (list (quote caddr) (cadr u)))
  187. (dm s!:blanklist (u !&optional v) (list (quote cdddr) (cadr u)))
  188. (dm s!:setindenting (u !&optional v) (list (quote rplaca) (list (quote cdr) (
  189. cadr u)) (caddr u)))
  190. (dm s!:setblankcount (u !&optional v) (list (quote rplaca) (list (quote cddr)
  191. (cadr u)) (caddr u)))
  192. (dm s!:setblanklist (u !&optional v) (list (quote rplacd) (list (quote cddr)
  193. (cadr u)) (caddr u)))
  194. (dm s!:newframe (u !&optional v) (list (quote list) (cadr u) nil 0))
  195. (dm s!:blankp (u !&optional v) (list (quote numberp) (list (quote car) (cadr
  196. u))))
  197. (de s!:prindent (x n) (cond ((atom x) (cond ((simple!-vector!-p x) (
  198. s!:prvector x n)) (t (prog (var1014) (setq var1014 (cond (!*pretty!-symmetric
  199. (cond ((stringp x) (s!:explodes x)) (t (explode x)))) (t (explode2 x))))
  200. lab1013 (cond ((null var1014) (return nil))) (prog (c) (setq c (car var1014))
  201. (s!:putch c)) (setq var1014 (cdr var1014)) (go lab1013))))) (t (cond ((
  202. s!:quotep x) (progn (s!:putch (quote !')) (s!:prindent (cadr x) (plus n 1))))
  203. (t (prog (cx) (cond ((greaterp (times 4 n) (times 3 s!:rmar)) (progn (
  204. s!:overflow (quote all)) (setq n (truncate n 8)) (cond ((greaterp
  205. s!:initialblanks n) (progn (setq s!:lmar (plus (difference s!:lmar
  206. s!:initialblanks) n)) (setq s!:initialblanks n))))))) (setq s!:stack (cons (
  207. s!:newframe n) s!:stack)) (s!:putch (cons (quote lpar) (s!:top))) (setq cx (
  208. car x)) (s!:prindent cx (plus n 1)) (cond ((and (idp cx) (not (atom (cdr x)))
  209. ) (setq cx (get cx (quote s!:ppformat)))) (t (setq cx nil))) (cond ((and (
  210. equal cx 2) (atom (cddr x))) (setq cx nil))) (cond ((equal cx (quote prog)) (
  211. progn (s!:putch (quote ! )) (s!:prindent (car (setq x (cdr x))) (plus n 2))))
  212. ) (setq x (cdr x)) scan (cond ((atom x) (go outt))) (s!:finishpending) (cond
  213. ((equal cx (quote prog)) (progn (s!:putblank) (s!:overflow s!:bufferi) (cond
  214. ((atom (car x)) (progn (setq s!:lmar (setq s!:initialblanks (max (difference
  215. s!:lmar 6) 0))) (s!:prindent (car x) (difference n 2)) (setq x (cdr x)) (cond
  216. ((and (not (atom x)) (atom (car x))) (go scan))) (cond ((greaterp (plus
  217. s!:lmar s!:bn) n) (s!:putblank)) (t (prog (i) (setq i (plus s!:lmar s!:bn))
  218. lab1015 (cond ((minusp (times 1 (difference (difference n 1) i))) (return nil
  219. ))) (s!:putch (quote ! )) (setq i (plus i 1)) (go lab1015)))) (cond ((atom x)
  220. (go outt)))))))) (t (cond ((numberp cx) (progn (setq cx (difference cx 1)) (
  221. cond ((equal cx 0) (setq cx nil))) (s!:putch (quote ! )))) (t (s!:putblank)))
  222. )) (s!:prindent (car x) (plus n 2)) (setq x (cdr x)) (go scan) outt (cond ((
  223. not (null x)) (progn (s!:finishpending) (s!:putblank) (s!:putch (quote !.)) (
  224. s!:putch (quote ! )) (s!:prindent x (plus n 5))))) (s!:putch (cons (quote
  225. rpar) (difference n 2))) (cond ((and (equal (s!:indenting (s!:top)) (quote
  226. indent)) (not (null (s!:blanklist (s!:top))))) (s!:overflow (car (
  227. s!:blanklist (s!:top))))) (t (s!:endlist (s!:top)))) (setq s!:stack (cdr
  228. s!:stack))))))))
  229. (de s!:explodes (x) (explode x))
  230. (de s!:prvector (x n) (prog (bound) (setq bound (upbv x)) (setq s!:stack (
  231. cons (s!:newframe n) s!:stack)) (s!:putch (cons (quote lsquare) (s!:top))) (
  232. s!:prindent (getv x 0) (plus n 2)) (prog (i) (setq i 1) lab1016 (cond ((
  233. minusp (times 1 (difference bound i))) (return nil))) (progn (s!:putch (quote
  234. !,)) (s!:putblank) (s!:prindent (getv x i) (plus n 2))) (setq i (plus i 1))
  235. (go lab1016)) (s!:putch (cons (quote rsquare) (difference n 2))) (s!:endlist
  236. (s!:top)) (setq s!:stack (cdr s!:stack))))
  237. (de s!:putblank nil (prog nil (s!:putch (s!:top)) (s!:setblankcount (s!:top)
  238. (plus (s!:blankcount (s!:top)) 1)) (s!:setblanklist (s!:top) (cons s!:bufferi
  239. (s!:blanklist (s!:top)))) (setq s!:indblanks (plus s!:indblanks 1))))
  240. (de s!:endlist (l) (setq s!:pendingrpars (cons l s!:pendingrpars)))
  241. (de s!:finishpending nil (progn (prog (var1020) (setq var1020 s!:pendingrpars
  242. ) lab1019 (cond ((null var1020) (return nil))) (prog (stackframe) (setq
  243. stackframe (car var1020)) (progn (cond ((neq (s!:indenting stackframe) (quote
  244. indent)) (prog (var1018) (setq var1018 (s!:blanklist stackframe)) lab1017 (
  245. cond ((null var1018) (return nil))) (prog (b) (setq b (car var1018)) (progn (
  246. rplaca b (quote ! )) (setq s!:indblanks (difference s!:indblanks 1)))) (setq
  247. var1018 (cdr var1018)) (go lab1017)))) (s!:setblanklist stackframe t))) (setq
  248. var1020 (cdr var1020)) (go lab1019)) (setq s!:pendingrpars nil)))
  249. (de s!:quotep (x) (and !*quotes (not (atom x)) (equal (car x) (quote quote))
  250. (not (atom (cdr x))) (null (cddr x))))
  251. (put (quote prog) (quote s!:ppformat) (quote prog))
  252. (put (quote lambda) (quote s!:ppformat) 1)
  253. (put (quote lambdaq) (quote s!:ppformat) 1)
  254. (put (quote setq) (quote s!:ppformat) 1)
  255. (put (quote set) (quote s!:ppformat) 1)
  256. (put (quote while) (quote s!:ppformat) 1)
  257. (put (quote t) (quote s!:ppformat) 1)
  258. (put (quote de) (quote s!:ppformat) 2)
  259. (put (quote df) (quote s!:ppformat) 2)
  260. (put (quote dm) (quote s!:ppformat) 2)
  261. (put (quote defun) (quote s!:ppformat) 2)
  262. (put (quote defmacro) (quote s!:ppformat) 2)
  263. (put (quote foreach) (quote s!:ppformat) 4)
  264. (de s!:putch (c) (prog nil (cond ((atom c) (setq s!:rparcount 0)) (t (cond ((
  265. s!:blankp c) (progn (setq s!:rparcount 0) (go nocheck))) (t (cond ((equal (
  266. car c) (quote rpar)) (progn (setq s!:rparcount (plus s!:rparcount 1)) (cond (
  267. (greaterp s!:rparcount 4) (progn (s!:putch (quote ! )) (setq s!:rparcount 2))
  268. )))) (t (setq s!:rparcount 0))))))) (prog nil lab1021 (cond ((null (geq (plus
  269. s!:lmar s!:bn) s!:rmar)) (return nil))) (s!:overflow (quote more)) (go
  270. lab1021)) nocheck (setq s!:bufferi (cdr (rplacd s!:bufferi (list c)))) (setq
  271. s!:bn (plus s!:bn 1))))
  272. (de s!:overflow (flg) (prog (c blankstoskip) (cond ((and (equal s!:indblanks
  273. 0) (greaterp s!:initialblanks 2) (equal flg (quote more))) (progn (setq
  274. s!:initialblanks (difference s!:initialblanks 2)) (setq s!:lmar (difference
  275. s!:lmar 2)) (return (quote moved!-left))))) fblank (cond ((equal s!:bn 0) (
  276. progn (cond ((not (equal flg (quote more))) (return (quote empty)))) (cond ((
  277. atom (car s!:buffero)) (prin2 "%+"))) (terpri) (setq s!:lmar 0) (return (
  278. quote continued)))) (t (progn (spaces s!:initialblanks) (setq
  279. s!:initialblanks 0)))) (setq s!:buffero (cdr s!:buffero)) (setq s!:bn (
  280. difference s!:bn 1)) (setq s!:lmar (plus s!:lmar 1)) (setq c (car s!:buffero)
  281. ) (cond ((atom c) (progn (prin2 c) (go fblank))) (t (cond ((s!:blankp c) (
  282. cond ((not (atom blankstoskip)) (progn (prin2 (quote ! )) (setq s!:indblanks
  283. (difference s!:indblanks 1)) (cond ((eq c (car blankstoskip)) (progn (rplacd
  284. blankstoskip (difference (cdr blankstoskip) 1)) (cond ((equal (cdr
  285. blankstoskip) 0) (setq blankstoskip t)))))) (go fblank))) (t (go blankfound))
  286. )) (t (cond ((or (equal (car c) (quote lpar)) (equal (car c) (quote lsquare))
  287. ) (progn (prin2 (get (car c) (quote s!:ppchar))) (cond ((equal flg (quote
  288. none)) (go fblank))) (setq c (cdr c)) (cond ((not (null (s!:blanklist c))) (
  289. go fblank))) (cond ((greaterp (s!:depth c) s!:indentlevel) (progn (setq
  290. s!:indentlevel (s!:depth c)) (s!:setindenting c (quote indent))))) (go fblank
  291. ))) (t (cond ((or (equal (car c) (quote rpar)) (equal (car c) (quote rsquare)
  292. )) (progn (cond ((lessp (cdr c) s!:indentlevel) (setq s!:indentlevel (cdr c))
  293. )) (prin2 (get (car c) (quote s!:ppchar))) (go fblank))) (t (error 0 (list c
  294. "UNKNOWN TAG IN OVERFLOW")))))))))) blankfound (cond ((eqcar (s!:blanklist c)
  295. s!:buffero) (s!:setblanklist c nil))) (setq s!:indblanks (difference
  296. s!:indblanks 1)) (cond ((greaterp (s!:depth c) s!:indentlevel) (progn (cond (
  297. (equal flg (quote none)) (progn (prin2 (quote ! )) (go fblank)))) (cond (
  298. blankstoskip (setq blankstoskip nil)) (t (progn (setq s!:indentlevel (
  299. s!:depth c)) (s!:setindenting c (quote indent)))))))) (cond ((greaterp (
  300. s!:blankcount c) (difference thin!* 1)) (progn (setq blankstoskip (cons c (
  301. difference (s!:blankcount c) 2))) (s!:setindenting c (quote thin)) (
  302. s!:setblankcount c 1) (setq s!:indentlevel (difference (s!:depth c) 1)) (
  303. prin2 (quote ! )) (go fblank)))) (s!:setblankcount c (difference (
  304. s!:blankcount c) 1)) (terpri) (setq s!:lmar (setq s!:initialblanks (s!:depth
  305. c))) (cond ((eq s!:buffero flg) (return (quote to!-flg)))) (cond ((or
  306. blankstoskip (not (equal flg (quote more)))) (go fblank))) (return (quote
  307. more))))
  308. (put (quote lpar) (quote s!:ppchar) (quote !())
  309. (put (quote lsquare) (quote s!:ppchar) (quote ![))
  310. (put (quote rpar) (quote s!:ppchar) (quote !)))
  311. (put (quote rsquare) (quote s!:ppchar) (quote !]))
  312. (de fetch!-url (url !&optional dest) (prog (a b c d e w) (setq a (open!-url
  313. url)) (cond ((null a) (return nil))) (cond (dest (progn (setq d (open dest (
  314. quote output))) (cond ((null d) (progn (close a) (return (error 0
  315. "unable to open destination file"))))) (setq d (wrs d))))) (setq b (rds a)) (
  316. setq w (linelength 500)) (prog nil lab1022 (cond ((null (not (equal (setq c (
  317. readch)) !$eof!$))) (return nil))) (princ c) (go lab1022)) (linelength e) (
  318. rds b) (close a) (cond (dest (close (wrs d))))))
  319. (de bldmsg_temp_internal (fmt args) (prog (r a) (setq fmt (explodec fmt)) (
  320. prog nil lab1025 (cond ((null fmt) (return nil))) (progn (cond ((eqcar fmt (
  321. quote !%)) (progn (setq fmt (cdr fmt)) (setq a (car args)) (setq args (cdr
  322. args)) (cond ((or (eqcar fmt (quote !p)) (eqcar fmt (quote !P))) (setq a (
  323. explode a))) (t (setq a (explodec a)))) (prog (var1024) (setq var1024 a)
  324. lab1023 (cond ((null var1024) (return nil))) (prog (c) (setq c (car var1024))
  325. (setq r (cons c r))) (setq var1024 (cdr var1024)) (go lab1023)))) (t (setq r
  326. (cons (car fmt) r)))) (setq fmt (cdr fmt))) (go lab1025)) (return (
  327. list2string (reversip r)))))
  328. (dm bldmsg (u) (list (quote bldmsg_temp_internal) (cadr u) (cons (quote list)
  329. (cddr u))))
  330. (flag (quote (bldmsg)) (quote variadic))
  331. % end of file