;;; This is a quick and dirty patch to allow turning off tabs in 2d ;;; display. I do NOT claim it is clean or efficient. I also ;;; don't claim it has correct declarations for compilation etc. ;;; Remember, think quick and dirty. -- Stavros Macrakis, 26 Mar 2003 (defmvar $DISPLAY_NO_TABS nil "Suppresses the use of tabs in two-dimensional output.") (DEFUN TABLEN () (if $DISPLAY_NO_TABS 20000 8)) ;;; The following code is completely unmodified. It is only ;;; included in the patch because TABLEN is a macro in the original ;;; code, and so redefining it would not affect compiled code. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (DEFUN OUTPUT-LINEAR-ONE-LINE (I) (DECLARE (FIXNUM I)) (PROG (LINE (N 0)) (DECLARE (FIXNUM n)) (SETQ LINE (LINEARRAY I) LINE (NREVERSE (CDR LINE)) N (CAR LINE)) (SET-LINEARRAY I NIL) (TYOTBSP N) (sloop for v in (cdr line) do (tyo v)) ; (PRINC (MAKNAM (CDR LINE))) (MTERPRI))) (DEFUN TYOTBSP (N) (DECLARE (FIXNUM N)) (DO () ((< N (TABLEN))) (TYO #\TAB) (DECREMENT N (TABLEN))) (DO () ((< N 1)) (TYO #\space) (DECREMENT N))) (DEFUN DRAW-LINEAR (DMSTR OLDROW OLDCOL) "This puts the LINE lists into LINEARRAY ready to be drawn. Each LINE consists of first an initial number of columns to space (or tab over) and then the characters to be printed. oldrow and oldcol are the starting points for the the (dx,dy) offsets given in the dimension string DMSTR. It does not check that oldrow is big enough for possible negative y offsets in DMSTR, but BKPTDP is = the right global to use for oldrow (see Draw-2d)." (DO ((LINE)) ((NULL DMSTR)) (COND ((ATOM (CAR DMSTR)) (SETQ LINE (LINEARRAY OLDROW)) (COND ((NULL LINE) (SETQ LINE (LIST OLDCOL))) (T (PROG (n) #-cl (DECLARE (FIXNUM N)) (SETQ N (CAR LINE) LINE (CDR LINE)) (DO ((M (f+ (TABLEN) (f* (TABLEN) (// N (TABLEN)))) (f+ (TABLEN) M))) ((NOT (< M OLDCOL)) (SETQ N (MAX N (f- M (TABLEN))))) (DECLARE (FIXNUM M)) (SETQ LINE (CONS #\TAB LINE))) (DO () ((<=3D OLDCOL N)) (PUSH #\space LINE) (INCREMENT N))))) (DO () ((OR (NULL DMSTR) (NOT (ATOM (CAR DMSTR)))) (SET-LINEARRAY OLDROW (CONS OLDCOL LINE))) (INCREMENT OLDCOL) (PUSH (CAR DMSTR) LINE) (POP DMSTR))) ((INTEGERP (CAAR DMSTR)) ;; Why update OLDCOL and not OLDROW? Should either update both ;; (requiring multiple value return) or neither (analagous to = lambda ;; binding). (SETQ OLDCOL (DRAW-LINEAR (REVERSE (CDDAR DMSTR)) (f+ OLDROW (CADAR DMSTR)) (f+ OLDCOL (CAAR DMSTR)))) (POP DMSTR)) (T (SETQ OLDCOL (APPLY (CAAR DMSTR) T (CDAR DMSTR))) (POP DMSTR)))) ;; Be sure to return this. OLDCOL)