/usr/lib/acl2-4.2/interface/infix/scribe-init.lisp is in acl2-infix-source 4.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | ; ACL2 Version 1.9
; Copyright (C) 1989-96 Computational Logic, Inc. (CLI). All rights reserved.
; Use of this software constitutes agreement with the terms of ACL2
; license agreement, found in the file LICENSE.
;; Init file for infix.lisp in Scribe mode.
;; Feb 20 1992, by MKSmith
;; In order to fix a bug in the AKCL interpreter's use of proclaim.
;; we depend on this file being compiled and loaded in an environment
;; in which infix.lisp has already been loaded.
;; #+akcl (load-base "akcl-patch.lisp")
(in-package "user")
(format *terminal-io* "Loading the ainfix scribe-init file.")
;; Mode should actually be set before this file is loaded.
(infix-settings :mode "scribe"
:extension "mss"
:op-location 'front
:comment-format 'smith
:format-!-in-comments nil
:eliminate-top-parens t
:eliminate-inner-parens nil
:no-index-calls nil )
;; Increase this number to more accurately allow for proper output width.
(defparameter *rightmost-char-number* 100)
(defparameter *default-chars-wide* 100)
(defparameter *latex-indent-number-limit* 100)
(defparameter nqread-normal-clause-enders
(append '(#\@) nqread-default-normal-clause-enders))
; THE SCRIBE PRELUDE.
(defparameter *standard-prelude*
"@make(clinote)
@device(postscript)
@style(leftmargin 1.5 inch,linewidth 5.5 inch, indent 0,
font clitimesroman, indexcase folded)
@enable(index)
@libraryfile(clisymbols)
@libraryfile(stable)
@comment{Kcrlf is used in @index[] to cause the form to ignore}
@comment{newlines after the indexing command. Not what we want in the}
@comment{forms below.}
@Form(Kcrlf={})
@Modify(format,above 1.2lines,below 1.2 lines)
@define(st, use t, size -2)
@Define(block,Break Off,Nofill,Spaces Kept,BlankLines kept,Justification off,afterentry {@$})
@define(nop)
@pageheading(immediate,center={})
@pagefooting(immediate,center={@value(page)})
")
(defparameter *standard-postlude*
"
")
(defparameter *example-prelude*
(concatenate 'string *standard-prelude*
"
@standardtable(name BaseTbl, Columns 2, columnwidth 2.5 inch, allcolumns=center,
float, boxed, flushtop,
above 1 line, below 1 line)
Here is a summary of the conventional syntax (~a) in terms of the official syntax
of the Acl2 logic.
@begin{enumerate}
Variables. !tx, !ty, !tz, etc. are printed in italics.
Function application. For any function symbol for which special
syntax is not given below, an application of the symbol is printed with
the usual notation; e.g., the term !v(fn x y z) is
printed as !t(fn x y z). Note that the function symbol is printed in
Roman. In the special case that !qc is a function symbol of no
arguments, i.e., it is a constant, the term !v(c) is printed merely as
!t(c), in small caps, with no trailing parentheses. Because variables are printed in
italics, there is no confusion between the printing of variables and
constants.
Other constants. !tt, !tf, and !tnil are printed in bold.
Quoted constants are printed in the ordinary syntax of the ACL2 logic,
in a `typewriter font.' For example,
@t{'(a b c)} is still printed just that way. @t{#b001} is printed
as !t#b001, @t{#o765} is printed as !t#o765, and @t{#xa9} is printed as
!t#xa9, representing binary, octal and hexadecimal, respectively.
"))
(defparameter *begin-example-table* "
@newpage()
@begin(BaseTbl)
@tableid(BaseTbl~d)
@tableHeading(Immediate, RowFormat BaseTblColumnHeadings,
Line {ACL2 Syntax@\\Conventional Syntax})~%"
"Needs an argument, integer, in order to give different tables different names.")
(defparameter *end-example-table* "@end(BaseTbl)
")
(defparameter *example-table-size* 32)
(defparameter *example-postlude* "")
;; BASIC BRACKETS AND THEIR QUOTED VERSION.
(defparameter *begin* "{")
(defparameter *end* "}")
(defparameter *lbrace* "@nop<{>")
(defparameter *rbrace* "@nop<}>")
;; NEWLINE PARAMETERS
(defparameter *newline-in-env* "")
(defparameter *newline-in-text* "")
(defparameter *force-newline-in-env* "")
(defparameter *force-newline-in-text* "@*")
;; ENVIRONMENT BEGIN-END PAIRS
(defparameter *begin-index* "@index{")
(defparameter *end-index* "@index{")
(defparameter *begin-text-env* "@begin{text,above 1 line,below 1 line}")
(defparameter *end-text-env* "@end{text}")
(defparameter *begin-verbatim-env* "@begin{verbatim}")
(defparameter *end-verbatim-env* "@end{verbatim}")
(defparameter *begin-format-env* "@begin{format}")
(defparameter *end-format-env* "@end{format}")
(defparameter *begin-emphasis-env* "@begin{format, FaceCode i}")
(defparameter *end-emphasis-env* "@end{format}")
(defparameter *begin-comment-env* "@begin{comment}")
(defparameter *end-comment-env* "@end{comment}")
(defparameter *begin-section-env* "@section{")
(defparameter *end-section-env* "}")
(defparameter *begin-subsection-env* "@subsection{")
(defparameter *end-subsection-env* "}")
(defparameter *begin-tt-env* "@t{")
(defparameter *end-tt-env* "}")
(defparameter *begin-string-env* "@st{")
(defparameter *end-string-env* "}")
(defparameter *begin-bold-env* "@b{")
(defparameter *end-bold-env* "}")
(defparameter *begin-italic-env* "@i{")
(defparameter *end-italic-env* "}")
(defparameter *begin-sc-env* "@c{")
(defparameter *end-sc-env* "}")
(defparameter *begin-enumerate-env* "@begin{enumerate}")
(defparameter *end-enumerate-env* "@end{enumerate}")
(defparameter *begin-item* "
@begin(multiple)
")
(defparameter *end-item* "
@end(multiple)
")
(defparameter *mv-bracket-left* "@langle")
(defparameter *mv-bracket-right* "@rangle")
(defparameter *forall* "@forall ")
(defparameter *exists* "@exists ")
;; TABBING ENVIRONMENT AND TAB OPERATIONS
(defparameter *begin-group-tabbing-env* "@begin{format,group}@tabclear{}")
(defparameter *begin-tabbing-env* "@begin{format}@tabclear{}")
(defparameter *end-tabbing-env* "@end{format}")
(defun new-tab-row (&optional followed-by-infix-print-term)
(declare (ignore followed-by-infix-print-term))
(pwrite-char #\Newline))
(defparameter *tab* "@\\")
(defparameter *flush* "@>")
(defparameter *column-separator* *tab*)
(defparameter *tab-list* nil)
(defparameter *set-margin* "@begin(block)")
(defparameter *set-tab* "@^")
(defparameter *pop-margin* "@end(block)")
(defparameter *default-op-tab-space* "@math{@quad}@ @ @ ")
(defparameter *indent-string* "@math{@quad}")
(defparameter *default-indent* 4)
(defun get-op-width-string (op)
(declare (ignore op))
nil)
(defparameter *noindent* "")
; (defparameter *testmargin* nil)
(defun begin-tabbing ()
; Tabbing environments can be nested in Scribe.
; Use this fact with set-margin.
(setq *tab-list* (cons '(begin-tabs) *tab-list*))
;; (if *testmargin* (format t "~%Begin tabbing : ~a~%" *tab-list*))
(princ *begin-tabbing-env*)
(setq *infix-loc* *left-margin*))
(defun begin-group-tabbing ()
; Tabbing environments can be nested in Scribe.
; Use this fact with set-margin.
(setq *tab-list* nil)
(princ *begin-group-tabbing-env*)
(setq *infix-loc* *left-margin*))
(defun end-tabbing ()
(sloop while (and *tab-list* (not (equal (caar *tab-list*) 'begin-tabs)))
do (setq *tab-list* (cdr *tab-list*)))
(if *tab-list* (setq *tab-list* (cdr *tab-list*)))
;; (if *testmargin* (format t "~%End tabbing : ~a~%" *tab-list*))
(princ *end-tabbing-env*))
(defun increase-margin ()
(pprin1i *default-op-tab-space*)
(set-margin))
(defun set-margin ()
; Generate instructions to set the current indentation.
; In latex we use tabs, which cause *tabto* to tab to this column in the future.
; `Punt' if we hit the limit, by throwing all the way out.
(cond (*do-not-use-tabs* nil)
;; Bump Latex limit way up for Scribe.
(t (cond ((= *tabs-in* *latex-indent-number-limit*)
(throw 'taboverflow t)))
(setq *tabs-in* (1+ *tabs-in*))
(pprinc *set-margin*)
(push (cons 'lm *infix-loc*) *tab-list*)
;; (if *testmargin* (format t "~%Set margin : ~a~%" *tab-list*))
)))
(defun get-margin ()
(get-margin2 *tab-list*))
(defun get-margin2 (tl)
(let ((setting (car tl)))
(cond ((null setting) *left-margin*)
((eq (car setting) 'lm) (cdr setting))
(t (get-margin2 (cdr tl))))))
(defun begin-flushright ()
(pprinc *flush*))
(defun end-flushright ()
(pprinc *tab*))
(defun begin-normal-text ()
(pprinc *begin-text-env*))
(defun end-normal-text ()
(pprinc *end-text-env*))
(defun flushright (form)
(begin-flushright)
(pprinc form)
(end-flushright))
(defun do-tab ()
; The *tab-list* is either NIL, ((LM loc) ...), or ((TAB loc) ...)
; Only tab if there is something to tab to.
(cond (*do-not-use-tabs* (pprinc " "))
((and *tab-list* (eq (caar *tab-list*) 'tab))
(pprinc *tab*))
(t (pprinc " "))))
(defun set-tab (&optional op)
; Generate instructions to set a tab at the current location.
; `Punt' if we hit the limit, by throwing all the way out.
(cond (*do-not-use-tabs* nil)
(t (cond ((= *tabs-in* *latex-indent-number-limit*) ;Let Latex-Limit hold for Scribe also.
(throw 'taboverflow t)))
(setq *tabs-in* (1+ *tabs-in*))
(cond ((and op (get-op-width-string op))
(pprinc (get-op-width-string op)))
(t (pprinc *default-op-tab-space*)))
(push (cons 'tab *infix-loc*) *tab-list*)
;; (if *testmargin* (format t "~%Setting tab : ~a~%" *tab-list*))
(pprinc *set-tab*))))
(defun pop-tab ()
;; We don't really remove tabs from the formatted env.
;; Just track them in Lisp.
;; Generate command to `tab to one tab less in'.
;; Do not pop tabs beyond left margin or past the beginning of a tabbing env.
(cond (*do-not-use-tabs* nil)
((and *tab-list* (eq (caar *tab-list*) 'tab))
(setq *tabs-in* (1- *tabs-in*))
(pop *tab-list*)
;; (if *testmargin* (format t "~%Popped tab : ~a~%" *tab-list*))
)
(t nil)))
(defun pop-margin ()
;; Generate command to `return to one margin less in'.
;; For bookkeepping reasons we pop tabs after the margin.
;; (if *testmargin* (format t "~%Popping margin ...~%"))
(cond (*do-not-use-tabs* nil)
((and *tab-list* (eq (caar *tab-list*) 'tab))
(pop-tab)
(pop-margin))
((and *tab-list* (eq (caar *tab-list*) 'lm))
(setq *tabs-in* (1- *tabs-in*))
(pop *tab-list*)
;; (if *testmargin* (format t "~%Popped margin : ~a~%" *tab-list*))
(pprinc *pop-margin*))
(t nil)))
;; (defun newline-to-current-margin ()
;; ;; Generates command for return to current indentation setting.
;; (cond (*do-not-use-tabs* (pprinci " "))
;; (t (pwrite-char #\Newline)
;; (setq *infix-loc* (get-margin)))))
(defun to-current-margin ()
;; Generates command for return to current indentation setting,
;; unless we are already there.
(cond (*do-not-use-tabs* (pprinci " "))
((eql *infix-loc* (get-margin)))
(t (newline))))
;; (defun force-newline ()
;; ;; Forces a newline in running text.
;; (pprinc "@*")
;; (pwrite-char #\Newline)
;; (cond (*do-not-use-tabs*
;; (setq *infix-loc* *left-margin*))
;; (t (setq *infix-loc* (get-margin)))))
;; (defun force-newline ()
;; ;; Forces a newline in running text OR in tabbing env.
;; (if (null *tab-list*)
;; (progn (pprinc "@*")
;; (pwrite-char #\Newline)
;; (cond (*do-not-use-tabs*
;; (setq *infix-loc* *left-margin*))
;; (t (setq *infix-loc* (get-margin)))))
;; (cond (*do-not-use-tabs* (pprinci " "))
;; (t (pwrite-char #\Newline)
;; (setq *infix-loc* (get-margin))))))
(defun set-left-margin ()
(cond ((< *infix-loc* *left-margin*)
(sloop for i from *infix-loc* to (- *left-margin* 1)
do (pwrite-char #\Space))
(pprinc "@$"))))
;; FONTS
(defparameter *function-font* "@r") ; Roman. sc = small caps
(defun roman-font (term)
(pprinc *function-font*)
(pprinc "{")
(print-atom term)
(pprinc "}"))
;; MATH ENV AND OPERATORS
(defparameter *neg-str* "@not")
(defparameter *math-format* "@math{~a}")
(defparameter *math-begin* "@math{")
(defparameter *math-end* "}")
;; These must be enclosed in a math env. Tried using a @quad, but it is too thick.
(defparameter *math-thick-space* "@ ")
(defparameter *math-space* "##") ; # is a thin space
(defparameter *math-thin-space* "#")
(defparameter *subscript* "@-")
(defparameter *begin-subscript* "@-{")
(defparameter *end-subscript* "}")
;; MISC.
(defparameter *newpage* "@newpage()")
(defparameter *comma-atsign* ",@@")
(defparameter *caret* "^")
(defparameter *dotted-pair-separator* " . ")
(defparameter *dotted-pair-separator-newline* ". ")
(defparameter *no-tab-event-trailer* "~%~%")
(defparameter *print-default-event-header* "~%@c{Event}: ")
(defparameter *print-default-lisp-header* "~%@c{Lisp}: ")
(defparameter *print-default-command-header* "~%")
(defparameter *no-tab-command-trailer* "~%~%")
;; OTHER FUNCTIONS
;; Should both be `(#\@ @\}) but we handle them individually in the appropriate
;; spots in the two following functions.
(defparameter doc-special-chars nil)
(defparameter doc-index-specials nil)
(defparameter doc-other-chars nil)
;; We didn't compile the following because the compiler declaration
;; in Sinfix, through a bug in AKCL, caused this routine to produce
;; spurious results.
;; The patch to akcl that is loaded in sinfix should fix this problem.
;; Other lisps shouldn't need it.
;; These use to be of the form (eval-when (load) (eval '<defn>))
(eval-when (load) (eval
'(defun handle-special-chars (char)
;; USED BY PRINT-ATOM. CHAR is local to print-atom.
;; We don't use the global, DOC-SPECIAL-CHARS, since there are
;; only two, @ and }, and we do something different in each case.
(cond ((char= char #\@) (pprinc "@@") (incf *infix-loc* 1))
((char= char #\}) (pprinc *rbrace*) (incf *infix-loc* 1))
;; Atoms printed in all lower case.
(t (pwrite-char (if (eq *print-case* :downcase)
(char-downcase char)
char)))))
))
(eval-when (load) (eval
'(defun handle-special-chars-in-string (char)
;; USED BY PRINT-ATOM. CHAR is local to print-atom.
(cond ((char= char #\@) (pprinc "@@") (incf *infix-loc* 1))
((char= char #\}) (pprinc *rbrace*) (incf *infix-loc* 1))
(t (pwrite-char char))))
))
;; PRINTING INDEX ENTRIES
;; We don't bother to count braces in Scribe, we just quote them.
(defun index (x &optional subkind)
(pprinc *begin-index*)
(let ((str (if (stringp x) x (symbol-name x)))
(num-chars 0)
;(inserted-excl nil)
)
(if subkind
(cond ((stringp subkind) (setq str (concatenate 'string str ", " subkind)))
((symbolp subkind) (setq str (concatenate 'string str ", " (string subkind))))
(t nil)))
(sloop for i below (length str)
for char = (char (the string str) (the fixnum i))
until (> num-chars *index-entry-max*)
;; Quote special Scribe characters as @ & }.
do (cond ((char= char #\@) (pprinc "@@") (incf num-chars 2))
((char= char #\}) (pprinc *rbrace*) (incf num-chars 2))
(t (pwrite-char (if (eq *print-case* :downcase)
(char-downcase char)
char))
(incf num-chars 1)))
finally (cond ((> num-chars *index-entry-max*)
(pformat *terminal-io*
"~% Warning: Index entry for ~a truncated to ~a characters. ~%"
x num-chars)
(pprinc "...")))
))
(pprinc *end*))
(defun skip-index-entries ()
;; We are looking at a backslash. In Tex mode we need to skip to the end
;; of the entry, because we may add !'s. In Scribe mode this is just NIL.
nil)
(defun adjust-tabbing-env ()
;; We are looking at a backslash. In Tex mode we may need to check for
;; some special cases.
;; In Scribe mode this is just NIL.
nil)
(defparameter acl2-char-subst-table
'((#\@ #\@ #\@)))
(defparameter acl2-markup-table
'(("-" . "@emdash{}")
("B" . "@b{~sa}")
("BF" . "~%@begin{format}")
("BID" . "") ;begin implementation dependent
("BQ" . "~%@begin{quotation}")
("BV" . "~%@begin{verbatim}")
("C" . "@t{~sa}") ;originally @code, but we don't want `' in info file
("EF" . "@end{format}~%")
("EID" . "") ;end implementation dependent
("EM" . "@i{~sa}") ;emphasis
("EQ" . "~%@end{quotation}~%") ;TexInfo needs leading line break to
;avoid problems with @refill
("EV" . "@end{verbatim}~%")
("I" . "@i{~sa}")
("ID" . "~sa") ;implementation dependent
("IL" . "~sa")
("ILC" . "@t{~sa}") ;originally @code, but we don't want `' in info file
("L" . "See ~sA")
("NL" . "@*~%")
("PAR" . "") ;paragraph mark, of no significance for scribe
("PL" . "see ~sA") ;used for parenthetical crossrefs
("SC" . "@c{~sa}") ;small caps
("ST" . "@b{~sa}") ;strong emphasis
("T" . "@t{~sa}")
("TERMINAL" . "") ; terminal only, ignore
))
|