DEFINE ((
(PP (E FILE GC LLEN)
	(SETQ GC (GCGAG T))
	(SETQ LLEN 79)
	(PP1 E 0)
	(TERPRI FILE)
	(GCGAG GC)
	NIL)
(PPF (FN FILE) (PP (OR (GETPROP FN 'EXPR) (GETPROP FN 'FEXPR)) FILE))
[PP1 (EXPR INDENT) (PROG (VERT)
	(COND ((ATOM EXPR) (RETURN (PRIN2 EXPR FILE)))
	      ((MEMBER (CAR EXPR) '(COND PROG LAMBDA SELECTQ)))
	      ((PPrint EXPR) (RETURN)))
	(PRIN1 '%( FILE)
	(SETQ LLEN (DIFFERENCE LLEN 1))
	(SETQ INDENT (PLUS INDENT 1))
	(PP1 (CAR EXPR) INDENT)
	(SELECTQ (CAR EXPR)
		((AND OR PROGN) (PPind (PLUS 1 (DIFFERENCE (POSITION FILE)
							   INDENT))))
		(COND (PPind 5) (SETQ VERT T))
		((PROG LAMBDA SELECTQ)
			(PRIN1 '%  FILE)
			(COND ((PPrint (CADR EXPR)) (SETQ EXPR (CDR EXPR))))
			(SETQ VERT T)
			(PPind 4))
		NIL)
	[MAPLIST (CDR EXPR) '(LAMBDA (X) (COND (VERT (TAB INDENT 0 FILE))
					       (T (PRIN1 '%  FILE)))
					 (PP1 (CAR X) INDENT]
	(COND ((CDR (LAST EXPR))
	       (PRIN1 '% %.%  FILE)
	       (PRIN2 (CDR (LAST EXPR)) FILE)))
	(PRIN1 '%) FILE)
	(SETQ LLEN (PLUS LLEN 1))
	(RETURN NIL]
[PPrint (EXPR) (PROG (J)
	(SETQ J (DIFFERENCE LLEN INDENT))
	(COND ((LEQP (SETQ J (PPlen EXPR)) 0) (RETURN NIL))
	      ((LESSP (PLUS J INDENT) (POSITION FILE))
	       (TAB INDENT 0 FILE)))
	(PRIN2 EXPR FILE)
	(RETURN T]
[PPlen (L)
  (COND ((LEQP J 0) 0)
	((ATOM L) (DIFFERENCE J (NCHARS L)))
	(T (PROG NIL
	   LOOP (SETQ J (DIFFERENCE (PPlen (CAR L)) 1))
		(SETQ L (CDR L))
		[COND ((OR (LEQP J 0) (NULL L)) (RETURN (DIFFERENCE J 1)))
		      ((ATOM L) (RETURN (DIFFERENCE J (PLUS -3 (NCHARS L]
		(GO LOOP]
[PPind (N) (COND ((GREATERP (SETQ INDENT (PLUS INDENT N)) (PLUS LLEN -30))
		  (SETQ INDENT 16]
))
