(FILECREATED " 4-Aug-86 16:21:14" {ERIS}<TEDIT>TEDITABBREV.;11 8489 changes to: (VARS TEDITABBREVCOMS) previous date: " 1-May-86 17:31:02" {ERIS}<TEDIT>TEDITABBREV.;10) (* Copyright (c) 1983, 1984, 1985, 1986 by John Sybalsky & Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT TEDITABBREVCOMS) (RPAQQ TEDITABBREVCOMS [(FNS \TEDIT.ABBREV.EXPAND \TEDIT.EXPAND.DATE \TEDIT.TRY.ABBREV) (GLOBALVARS TEDIT.ABBREVS) (VARS (TEDIT.ABBREVS (LIST [CONS "b" (MKSTRING (CHARACTER (CHARCODE 357,146] [CONS "n" (MKSTRING (CHARACTER (CHARCODE 357,44] [CONS "m" (MKSTRING (CHARACTER (CHARCODE 357,45] [CONS "T" (MKSTRING (CHARACTER (CHARCODE 357,57] [CONS "d" (MKSTRING (CHARACTER (CHARCODE 357,60] [CONS "D" (MKSTRING (CHARACTER (CHARCODE 357,61] [CONS "s" (MKSTRING (CHARACTER (CHARCODE 0,247] [CONS "'" (MKSTRING (CHARACTER (CHARCODE 0,271] [CONS "`" (MKSTRING (CHARACTER (CHARCODE 0,251] [CONS "%"" (MKSTRING (CHARACTER (CHARCODE 0,252] [CONS "~" (MKSTRING (CHARACTER (CHARCODE 0,272] [CONS "1/4" (MKSTRING (CHARACTER (CHARCODE 0,274] [CONS "1/2" (MKSTRING (CHARACTER (CHARCODE 0,275] [CONS "3/4" (MKSTRING (CHARACTER (CHARCODE 0,276] [CONS "1/3" (MKSTRING (CHARACTER (CHARCODE 357,275 ] [CONS "2/3" (MKSTRING (CHARACTER (CHARCODE 357,376 ] (CONS "c" (MKSTRING (CHARACTER 211))) [CONS "c/o" (MKSTRING (CHARACTER (CHARCODE 357,100 ] [CONS "%%" (MKSTRING (CHARACTER (CHARCODE 357,100] (QUOTE ("DATE" . \TEDIT.EXPAND.DATE)) (QUOTE (">>DATE<<" . \TEDIT.EXPAND.DATE]) (DEFINEQ (\TEDIT.ABBREV.EXPAND [LAMBDA (STREAM) (* jds "27-Aug-85 15:09") (* Expand an abbvreviation) (PROG ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of STREAM)) SEL CH# (CH NIL) EXPANSION) (SETQ SEL (fetch SEL of TEXTOBJ)) (SETQ CH# (SELECTQ (fetch POINT of SEL) (LEFT (SUB1 (fetch CH# of SEL))) (RIGHT (SUB1 (fetch CHLIM of SEL))) 0)) [COND ((ZEROP (fetch DCH of SEL)) (* Point Selection, so use the character to the left) (COND ((ZEROP CH#) (* If we're off the front of the document, don't bother trying.) (RETURN))) (\SETUPGETCH CH# TEXTOBJ) [SETQ CH (MKSTRING (CHARACTER (\BIN STREAM] (TEDIT.SETSEL STREAM CH# 1 (QUOTE RIGHT))) (T (* We have a selection that isn't just a caret. Use it.) (SETQ CH (TEDIT.SEL.AS.STRING STREAM] (SETQ EXPANSION (\TEDIT.TRY.ABBREV CH STREAM)) (* Find the abbreviation's expansion --first try it as-is, then try the upper-case version to be safe.) (COND (EXPANSION (* It exists, so insert it where the abbrev used to be) (replace \INSERTPCVALID of TEXTOBJ with NIL) (* Force it to abandon caching) (TEDIT.DELETE TEXTOBJ SEL) (* First, delete the thing being expanded.) (TEDIT.INSERT STREAM EXPANSION SEL]) (\TEDIT.EXPAND.DATE [LAMBDA (STREAM CH) (* jds "13-Aug-85 09:15") (* Provide the date as the expansion for an abbreviation) (PROG* ((DATE (\UNPACKDATE)) (YEAR (pop DATE)) (MONTH (pop DATE)) (DAY (pop DATE))) (RETURN (CONCAT (CAR (NTH (QUOTE (January February March April May June July August September October November December)) (ADD1 MONTH))) " " DAY ", " YEAR]) (\TEDIT.TRY.ABBREV [LAMBDA (ABBREV STREAM) (* jds "11-Jul-85 12:46") (* Try expanding ABBREV as an abbreviation. Return the expansion; NIL = no such abbreviation.) (PROG (SEL CH# (CH NIL) EXPANSION) (SETQ EXPANSION (OR (SASSOC ABBREV TEDIT.ABBREVS) (SASSOC (U-CASE ABBREV) TEDIT.ABBREVS))) (* Find the abbreviation's expansion --first try it as-is, then try the upper-case version to be safe.) (RETURN (COND (EXPANSION (* There's an expansion. Turn it into an insertable string.) (COND ((OR (STRINGP (CDR EXPANSION)) (NUMBERP (CDR EXPANSION))) (* The abbreviation expands to a string or a number (charcode). Insert it.) (CDR EXPANSION)) ((AND (LITATOM (CDR EXPANSION)) (GETD (CDR EXPANSION))) (* It's a function to be called.) (APPLY* (CDR EXPANSION) STREAM CH)) (T (* Anything else is a form to EVAL.) (EVAL (CDR EXPANSION]) ) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS TEDIT.ABBREVS) ) (RPAQ TEDIT.ABBREVS (LIST [CONS "b" (MKSTRING (CHARACTER (CHARCODE 357,146] [CONS "n" (MKSTRING (CHARACTER (CHARCODE 357,44] [CONS "m" (MKSTRING (CHARACTER (CHARCODE 357,45] [CONS "T" (MKSTRING (CHARACTER (CHARCODE 357,57] [CONS "d" (MKSTRING (CHARACTER (CHARCODE 357,60] [CONS "D" (MKSTRING (CHARACTER (CHARCODE 357,61] [CONS "s" (MKSTRING (CHARACTER (CHARCODE 0,247] [CONS "'" (MKSTRING (CHARACTER (CHARCODE 0,271] [CONS "`" (MKSTRING (CHARACTER (CHARCODE 0,251] [CONS "%"" (MKSTRING (CHARACTER (CHARCODE 0,252] [CONS "~" (MKSTRING (CHARACTER (CHARCODE 0,272] [CONS "1/4" (MKSTRING (CHARACTER (CHARCODE 0,274] [CONS "1/2" (MKSTRING (CHARACTER (CHARCODE 0,275] [CONS "3/4" (MKSTRING (CHARACTER (CHARCODE 0,276] [CONS "1/3" (MKSTRING (CHARACTER (CHARCODE 357,275] [CONS "2/3" (MKSTRING (CHARACTER (CHARCODE 357,376] (CONS "c" (MKSTRING (CHARACTER 211))) [CONS "c/o" (MKSTRING (CHARACTER (CHARCODE 357,100] [CONS "%%" (MKSTRING (CHARACTER (CHARCODE 357,100] (QUOTE ("DATE" . \TEDIT.EXPAND.DATE)) (QUOTE (">>DATE<<" . \TEDIT.EXPAND.DATE)))) (PUTPROPS TEDITABBREV COPYRIGHT ("John Sybalsky & Xerox Corporation" 1983 1984 1985 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (2831 6748 (\TEDIT.ABBREV.EXPAND 2841 . 4712) (\TEDIT.EXPAND.DATE 4714 . 5310) ( \TEDIT.TRY.ABBREV 5312 . 6746))))) STOP