(FILECREATED "25-Sep-86 22:10:43" {ERIS}<TEDIT>TEDITDECLS.;1 87913  

      changes to:  (VARS TEDITDECLSCOMS))


(* "
Copyright (c) 1986 by Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT TEDITDECLSCOMS)

(RPAQQ TEDITDECLSCOMS ((* ;;; 
             "This file is the collected record declarations and compile-time necessities for TEDIT."
                          )
                       (* ;; "FROM TEDIT")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\SCRATCHLEN 64)))
                       (* ;; "FROM TEXTOFD")
                       (RECORDS EDITMARK)
                       (RECORDS PIECE TEXTOBJ TEXTIMAGEDATA TEXTSTREAM)
                       (MACROS TEXTPROP)
                       (COMS (* Private data structures and constants FROM TEXTOFD)
                             (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\PCTBFreePieces 0)
                                                                    (\PCTBLastPieceOffset 1)
                                                                    (\FirstPieceOffset 2)
                                                                    (\SecondPieceOffset 4)
                                                                    (\EltsPerPiece 2))
                                    (MACROS \EDITELT \GETCH \GETCHB \EDITSETA \WORDSETA)
                                    (GLOBALVARS \TEXTIMAGEOPS \TEXTOFD \TEXTFDEV)))
                       (* ;;; "FROM TEDITPAGE")
                       (RECORDS PAGEFORMATTINGSTATE PAGEREGION)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITPAPERSIZE))
                       (* ;; "FROM TEDITFIND")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\AlphaNumericFlag 256)
                                                              (\AlphaFlag 512)
                                                              (\OneCharPattern 1024)
                                                              (\AnyStringPattern 1025)
                                                              (\OneAlphaPattern 1026)
                                                              (\AnyAlphaPattern 1027)
                                                              (\OneNonAlphaPattern 1028)
                                                              (\AnyNonAlphaPattern 1029)
                                                              (\LeftBracketPattern 1030)
                                                              (\RightBracketPattern 1031)
                                                              (\SpecialPattern 1024)))
                       (* ;; " FROM TEDITLOOKS")
                       (RECORDS CHARLOOKS FMTSPEC PENDINGTAB)
                       (DECLARE: EVAL@COMPILE DONTCOPY (MACROS \SMALLPIN \SMALLPOUT ONOFF))
                       (* ;; "FROM TEDITMENU")
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS MBUTTON))
                       (INITRECORDS MBUTTON)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS NWAYBUTTON))
                       (INITRECORDS NWAYBUTTON)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS MARGINBAR))
                       (INITRECORDS MARGINBAR)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TAB))
                       (RECORDS MB.3STATE MB.BUTTON MB.INSERT MB.MARGINBAR MB.NWAY MB.TEXT MB.TOGGLE)
                       (* ;; "FROM TEDITHISTORY")
                       (RECORDS TEDITHISTORYEVENT)
                       (* ;; "FROM TEDITSCREEN")
                       (RECORDS THISLINE LINEDESCRIPTOR LINECACHE)
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (LMInvisibleRun 401)
                                                              (LMLooksChange 400)))
                       (* ;; "FROM TEDITFILE")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\PieceDescriptorLOOKS 0)
                                                              (\PieceDescriptorOBJECT 1)
                                                              (\PieceDescriptorPARA 2)
                                                              (\PieceDescriptorPAGEFRAME 3)
                                                              (\PieceDescriptorCHARLOOKSLIST 4)
                                                              (\PieceDescriptorPARALOOKSLIST 5)
                                                              (\PieceDescriptorSAFEOBJECT 6)))
                       (* ;; "FROM TEDITCOMMAND")
                       (DECLARE: EVAL@COMPILE DONTCOPY (MACROS \INSERT\TTY\BUFFER \TEDIT.MOUSESTATE 
                                                              \TEDIT.CHECK))
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITTERMCODE))
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (NONE.TTC 0)
                                                              (CHARDELETE.TTC 1)
                                                              (WORDDELETE.TTC 2)
                                                              (DELETE.TTC 3)
                                                              (FUNCTIONCALL.TTC 4)
                                                              (REDO.TTC 5)
                                                              (UNDO.TTC 6)
                                                              (CMD.TTC 7)
                                                              (NEXT.TTC 8)
                                                              (EXPAND.TTC 9)
                                                              (PUNCT.TTC 20)
                                                              (TEXT.TTC 21)
                                                              (WHITESPACE.TTC 22)))
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (MSPACE 153)
                                                              (NSPACE 152)
                                                              (THINSPACE 159)
                                                              (FIGSPACE 154)))
                       (* ;; "FROM TEDITWINDOW")
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITCARET))
                       (INITRECORDS TEDITCARET)
                       (* ;; "FROM TEDITSELECTION")
                       (RECORDS SELECTION)
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (COPYSELSHADE 30583)
                                                              (COPYLOOKSSELSHADE 30583)
                                                              (EDITMOVESHADE -1)
                                                              (EDITGRAY 32800)))
                       (* ;;; "THE END")
                       (VARS TEDITDECLSCOMS)))



(* ;;; "This file is the collected record declarations and compile-time necessities for TEDIT."
)




(* ;; "FROM TEDIT")

(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ \SCRATCHLEN 64)

(CONSTANTS (\SCRATCHLEN 64))
)
)



(* ;; "FROM TEXTOFD")

[DECLARE: EVAL@COMPILE 

(RECORD EDITMARK (PC PCOFF . PCNO))
]
[DECLARE: EVAL@COMPILE 

(DATATYPE PIECE (                                            (* The piece describes either a string 
                                                             or part of a file. , or a generalized 
                                                             OBJECT.)
                 PSTR                                        (* The string where this piece's text 
                                                             resides, or NIL)
                 PFILE                                       (* The file which contains this 
                                                             piece's text, or NIL)
                 PFPOS                                       (* The FILEPTR of the start of the 
                                                             piece in the file)
                 PLEN                                        (* Length of the piece, in characters.)
                 NEXTPIECE                                   (* -> Next piece in this textobj.)
                 (PREVPIECE FULLXPOINTER)                    (* -> Prior piece in this text object.)
                 PLOOKS                                      (* Formatting info and formatting 
                                                             events in this piece)
                 POBJ                                        (* The OBJECT this piece describes)
                 (PPARALAST FLAG)                            (* This piece contains a paragraph 
                                                             break)
                 PPARALOOKS                                  (* Paragraph looks for this piece)
                 (PNEW FLAG)                                 (* This text is new here;
                                                             used by the tentative edit system, and 
                                                             anyone else interested.)
                 (PFATP FLAG)                                (* T if the characters in this piece 
                                                             are FAT -- i.e., are 16 bits each.)
                 )
                PSTR ← NIL PFILE ← NIL PFPOS ← 0 PLEN ← 0 PPARALOOKS ← TEDIT.DEFAULT.FMTSPEC)

(DATATYPE TEXTOBJ 
          (
          
          (* * This is where TEdit stores its state information, and internal data about 
          the text being edited.)

           PCTB                                              (* The piece table)
           TEXTLEN                                           (* # of chars in the text)
           \INSERTPC                                         (* Piece to hold type-in)
           \INSERTPCNO                                       (* Piece # of the input piece)
           \INSERTNEXTCH                                     (* CH# of next char which is typed 
                                                             into that piece.)
           \INSERTLEFT                                       (* Space left in the type-in piece)
           \INSERTLEN                                        (* # of characters already in the 
                                                             piece.)
           \INSERTSTRING                                     (* The string which the piece 
                                                             describes.)
           \INSERTFIRSTCH                                    (* CH# of first char in the piece.)
           (\INSERTPCVALID FLAG)                             (* T if it's OK to use the cached 
                                                             piece. Set to NIL by people who 
                                                             require that the next 
                                                             insertion/deletion use a different 
                                                             piece.)
           \WINDOW                                           (* The window<s> where this textobj is 
                                                             displayed)
           MOUSEREGION                                       (* Section of the window the mouse is 
                                                             in.)
           LINES                                             (* -> to top of chain of line 
                                                             descriptors for displayed text)
           DS                                                (* Display stream where this textobj 
                                                             is displayed)
           SEL                                               (* The current selection within the 
                                                             text)
           SCRATCHSEL                                        (* Scratch space for the selection 
                                                             code)
           MOVESEL                                           (* Source for the next MOVE of text)
           SHIFTEDSEL                                        (* Source for the next COPY)
           DELETESEL                                         (* Text to be deleted imminently)
           WRIGHT                                            (* Right edge of the window
                                                             (or subregion) where this is displayed)
           WTOP                                              (* Top of the window/region)
           WBOTTOM                                           (* Bottom of the window/region)
           WLEFT                                             (* Left edge of the window/region)
           TXTFILE                                           (* The original text file we're 
                                                             editing)
           (\XDIRTY FLAG)                                    (* T => changed since last saved.)
           (STREAMHINT FULLXPOINTER)                         (* -> the TEXTOFD stream which gives 
                                                             access to this textobj)
           EDITFINISHEDFLG                                   (* T => The guy has asked the editor 
                                                             to go way)
           CARET                                             (* Describes the flashing caret for 
                                                             the editing window)
           CARETLOOKS                                        (* Font to be used for inserted text.)
           WINDOWTITLE                                       (* Original title for this window, of 
                                                             there was one.)
           THISLINE                                          (* Cache of line-related info, to 
                                                             speed up selection &c)
           (MENUFLG FLAG)                                    (* T if this TEXTOBJ is a tedit-style 
                                                             menu)
           FMTSPEC                                           (* Default Formatting Spec to be used 
                                                             when formatting paragraphs)
           (FORMATTEDP FLAG)                                 (* Flag for paragraph formatting.
                                                             T if this document is to contain 
                                                             paragraph formatting information.)
           (TXTREADONLY FLAG)                                (* This is only available for shift 
                                                             selection.)
           TXTTERMSA                                         (* Special instructions for displaying 
                                                             characters on the screen)
           EDITOPACTIVE                                      (* T if there is an editing operation 
                                                             in progress. Used to interlock the 
                                                             TEdit menu)
           DEFAULTCHARLOOKS                                  (* The default character looks --
                                                             if any -- to be applied to characters 
                                                             coming into the file from outside.)
           TXTRTBL                                           (* The READTABLE to be used by the 
                                                             command loop for command dispatch)
           TXTWTBL                                           (* The READTABLE to be used to decide 
                                                             on word breaks)
           EDITPROPS                                         (* The PROPS that were passed into 
                                                             this edit session)
           (BLUEPENDINGDELETE FLAG)                          (* T if the next insertion in this 
                                                             document is to be preceded by a 
                                                             deletion of the then-current selection)
           TXTHISTORY                                        (* The history list for this edit 
                                                             session.)
           (SELWINDOW FULLXPOINTER)                          (* The window in which the last "real" 
                                                             selection got made for this edit;
                                                             used to control caret placement)
           PROMPTWINDOW                                      (* A window to be used for unscheduled 
                                                             interactions; normally a small window 
                                                             above the edit window)
           DISPLAYCACHE                                      (* The bitmap to be used when building 
                                                             the image of a line for display)
           DISPLAYCACHEDS                                    (* The DISPLAYSTREAM that is used to 
                                                             build line images)
           DISPLAYHCPYDS                                     (* The DISPLAYSTREAM used to build 
                                                             line images of lines that are 
                                                             displayed in "hardcopy" simulation 
                                                             mode)
           TXTPAGEFRAMES                                     (* A tree of page frames, specifying 
                                                             how the document is to be laid out.)
           (TXTNEEDSUPDATE FLAG)                             (* T => Screen invalid, need to run 
                                                             updater)
           TXTCHARLOOKSLIST                                  (* List of all the CHARLOOKSs in the 
                                                             document, so they can be kept unique)
           TXTPARALOOKSLIST                                  (* List of all the FMTSPECs in the 
                                                             document, so they can be kept unique)
           (TXTDON'TUPDATE FLAG)                             (* T if we're)
           )
          [ACCESSFNS TEXTOBJ ((\DIRTY (ffetch (TEXTOBJ \XDIRTY) of DATUM)
                                     (PROGN (IF (NEQ (FETCH (TEXTOBJ \XDIRTY) OF DATUM)
                                                     NEWVALUE)
                                                THEN         (* update the title to reflect the 
                                                             change)
                                                     (\TEDIT.WINDOW.TITLE DATUM
                                                            (\TEDIT.ORIGINAL.WINDOW.TITLE
                                                             (ffetch (TEXTOBJ TXTFILE) of DATUM)
                                                             NEWVALUE)))
                                            (freplace \XDIRTY OF DATUM WITH NEWVALUE]
          SEL ← (create SELECTION)
          SCRATCHSEL ← (create SELECTION)
          MOVESEL ← (create SELECTION
                           HOW ← EDITMOVESHADE
                           HOWHEIGHT ← 32767
                           HASCARET ← NIL)
          SHIFTEDSEL ← (create SELECTION
                              HOW ← COPYSELSHADE
                              HASCARET ← NIL)
          DELETESEL ← (create SELECTION
                             HOW ← BLACKSHADE
                             HOWHEIGHT ← 32767
                             HASCARET ← NIL)
          \INSERTNEXTCH ← -1 \INSERTPC ← NIL \INSERTLEFT ← 0 \INSERTLEN ← 0 \INSERTSTRING ← NIL 
          \INSERTFIRSTCH ← 1000000 TEXTLEN ← 0 WRIGHT ← 0 WTOP ← 0 WLEFT ← 0 WBOTTOM ← 0 TXTFILE ← 
          NIL \XDIRTY ← NIL MOUSEREGION ← (QUOTE TEXT)
          THISLINE ← (create THISLINE)
          MENUFLG ← NIL FMTSPEC ← TEDIT.DEFAULT.FMTSPEC FORMATTEDP ← NIL)

(DATATYPE TEXTIMAGEDATA (TICURPARALOOKS                      (* The current paragraph looks)
                               TICURIMAGESTREAM              (* The image stream for this hardcopy 
                                                             transduction)
                               TILOOKSUPDATEFN               (* The function to call to update 
                                                             looks for this stream)
                               TIPCOFFSET                    (* The offset into the current piece, 
                                                             as of the last page cross.)
                               ))

(ACCESSFNS TEXTSTREAM ((REALFILE (fetch F1 of DATUM)
                              (REPLACE F1 OF DATUM WITH NEWVALUE))
                                                             (* The real, underlying file behind 
                                                             the current piece)
                       (CHARSLEFT (fetch F2 of DATUM)
                              (REPLACE F2 OF DATUM WITH NEWVALUE))
                                                             (* The # of characters that will be 
                                                             left in the current piece the next 
                                                             time its file crosses a page boundary)
                       (TEXTOBJ (fetch F3 of DATUM)
                              (REPLACE F3 OF DATUM WITH NEWVALUE))
                                                             (* The TEXTOBJ that is editing this 
                                                             text)
                       (PIECE (fetch F5 of DATUM)
                              (REPLACE F5 OF DATUM WITH NEWVALUE))
                                                             (* The PIECE we're currently fetching 
                                                             chars from/putting chars into)
                       (PCNO (fetch FW8 of DATUM)
                             (REPLACE FW8 OF DATUM WITH NEWVALUE))
                                                             (* The position of that piece in the 
                                                             piece table)
                       (PCSTARTPG (fetch FW6 of DATUM)
                              (REPLACE FW6 OF DATUM WITH NEWVALUE))
                                                             (* The underlying file page# that this 
                                                             piece starts on)
                       (PCSTARTCH (fetch FW7 of DATUM)
                              (REPLACE FW7 OF DATUM WITH NEWVALUE))
                                                             (* The char within page of the 
                                                             underlying file that this piece starts 
                                                             on -- for backbin & co)
                       (PCOFFSET (fetch TIPCOFFSET of (fetch IMAGEDATA of DATUM))
                              (REPLACE TIPCOFFSET OF (fetch IMAGEDATA of DATUM) with NEWVALUE))
                                                             (* The offset into the current piece, 
                                                             as of the last page cross.)
                       (CURRENTLOOKS (fetch F10 of DATUM)
                              (replace F10 of DATUM with NEWVALUE))
                                                             (* The CHARLOOKS that are currently 
                                                             applicable to characters being taken 
                                                             from the stream.)
                       (CURRENTPARALOOKS (fetch TICURPARALOOKS of (fetch IMAGEDATA of DATUM))
                              (REPLACE TICURPARALOOKS OF (fetch IMAGEDATA of DATUM) with NEWVALUE))
                                                             (* The FMTSPEC that is currently 
                                                             applicable to characters being taken 
                                                             from the stream.)
                       (CURRENTIMAGESTREAM (fetch TICURIMAGESTREAM of (fetch IMAGEDATA of DATUM))
                              (REPLACE TICURIMAGESTREAM OF (fetch IMAGEDATA of DATUM) with NEWVALUE)
                                                             (* The image stream that this text is 
                                                             being put onto; used for scaling 
                                                             decisions)
                              )
                       (LOOKSUPDATEFN (fetch TILOOKSUPDATEFN of (fetch IMAGEDATA of DATUM))
                              (REPLACE TILOOKSUPDATEFN OF (fetch IMAGEDATA of DATUM) with NEWVALUE))
                                                             (* Function to be called each time 
                                                             character looks change.)
                       (FATSTREAMP (fetch F4 of DATUM)
                              (REPLACE F4 OF DATUM WITH NEWVALUE))
                                                             (* T if the current piece is 16 bit 
                                                             characters.)
                       )
                      (CREATE (create STREAM using \TEXTOFD IMAGEDATA ← (create TEXTIMAGEDATA))))
]
(/DECLAREDATATYPE (QUOTE PIECE)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER FULLXPOINTER POINTER POINTER FLAG POINTER FLAG 
                     FLAG))
       [QUOTE ((PIECE 0 POINTER)
               (PIECE 2 POINTER)
               (PIECE 4 POINTER)
               (PIECE 6 POINTER)
               (PIECE 8 POINTER)
               (PIECE 10 FULLXPOINTER)
               (PIECE 12 POINTER)
               (PIECE 14 POINTER)
               (PIECE 14 (FLAGBITS . 0))
               (PIECE 16 POINTER)
               (PIECE 16 (FLAGBITS . 0))
               (PIECE 16 (FLAGBITS . 16]
       (QUOTE 18))
(/DECLAREDATATYPE (QUOTE TEXTOBJ)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER FLAG POINTER 
                     POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER POINTER POINTER FLAG FULLXPOINTER POINTER POINTER POINTER POINTER 
                     POINTER FLAG POINTER FLAG FLAG POINTER POINTER POINTER POINTER POINTER POINTER 
                     FLAG POINTER FULLXPOINTER POINTER POINTER POINTER POINTER POINTER FLAG POINTER 
                     POINTER FLAG))
       [QUOTE ((TEXTOBJ 0 POINTER)
               (TEXTOBJ 2 POINTER)
               (TEXTOBJ 4 POINTER)
               (TEXTOBJ 6 POINTER)
               (TEXTOBJ 8 POINTER)
               (TEXTOBJ 10 POINTER)
               (TEXTOBJ 12 POINTER)
               (TEXTOBJ 14 POINTER)
               (TEXTOBJ 16 POINTER)
               (TEXTOBJ 16 (FLAGBITS . 0))
               (TEXTOBJ 18 POINTER)
               (TEXTOBJ 20 POINTER)
               (TEXTOBJ 22 POINTER)
               (TEXTOBJ 24 POINTER)
               (TEXTOBJ 26 POINTER)
               (TEXTOBJ 28 POINTER)
               (TEXTOBJ 30 POINTER)
               (TEXTOBJ 32 POINTER)
               (TEXTOBJ 34 POINTER)
               (TEXTOBJ 36 POINTER)
               (TEXTOBJ 38 POINTER)
               (TEXTOBJ 40 POINTER)
               (TEXTOBJ 42 POINTER)
               (TEXTOBJ 44 POINTER)
               (TEXTOBJ 44 (FLAGBITS . 0))
               (TEXTOBJ 46 FULLXPOINTER)
               (TEXTOBJ 48 POINTER)
               (TEXTOBJ 50 POINTER)
               (TEXTOBJ 52 POINTER)
               (TEXTOBJ 54 POINTER)
               (TEXTOBJ 56 POINTER)
               (TEXTOBJ 56 (FLAGBITS . 0))
               (TEXTOBJ 58 POINTER)
               (TEXTOBJ 58 (FLAGBITS . 0))
               (TEXTOBJ 58 (FLAGBITS . 16))
               (TEXTOBJ 60 POINTER)
               (TEXTOBJ 62 POINTER)
               (TEXTOBJ 64 POINTER)
               (TEXTOBJ 66 POINTER)
               (TEXTOBJ 68 POINTER)
               (TEXTOBJ 70 POINTER)
               (TEXTOBJ 70 (FLAGBITS . 0))
               (TEXTOBJ 72 POINTER)
               (TEXTOBJ 74 FULLXPOINTER)
               (TEXTOBJ 76 POINTER)
               (TEXTOBJ 78 POINTER)
               (TEXTOBJ 80 POINTER)
               (TEXTOBJ 82 POINTER)
               (TEXTOBJ 84 POINTER)
               (TEXTOBJ 84 (FLAGBITS . 0))
               (TEXTOBJ 86 POINTER)
               (TEXTOBJ 88 POINTER)
               (TEXTOBJ 88 (FLAGBITS . 0]
       (QUOTE 90))
(/DECLAREDATATYPE (QUOTE TEXTIMAGEDATA)
       (QUOTE (POINTER POINTER POINTER POINTER))
       (QUOTE ((TEXTIMAGEDATA 0 POINTER)
               (TEXTIMAGEDATA 2 POINTER)
               (TEXTIMAGEDATA 4 POINTER)
               (TEXTIMAGEDATA 6 POINTER)))
       (QUOTE 8))
(DECLARE: EVAL@COMPILE 

(PUTPROPS TEXTPROP MACRO (ARGS (CTEXTPROP ARGS)))
)



(* Private data structures and constants FROM TEXTOFD)

(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ \PCTBFreePieces 0)

(RPAQQ \PCTBLastPieceOffset 1)

(RPAQQ \FirstPieceOffset 2)

(RPAQQ \SecondPieceOffset 4)

(RPAQQ \EltsPerPiece 2)

(CONSTANTS (\PCTBFreePieces 0)
       (\PCTBLastPieceOffset 1)
       (\FirstPieceOffset 2)
       (\SecondPieceOffset 4)
       (\EltsPerPiece 2))
)

(DECLARE: EVAL@COMPILE 

(PUTPROPS \EDITELT DMACRO (OPENLAMBDA (ARR NO)
                                 (* This is equivalent to ELT, but bypasses the checking, since we 
                                    "know" that ARR is an array. Hence, much faster.)
                                 (GETBASEPTR (\ADDBASE2 (fetch (ARRAYP BASE)
                                                               of ARR)
                                                    NO)
                                        0)))
[PUTPROPS \GETCH MACRO ((TEXTOBJ)
                        (* jds "23-FEB-82 08:56")
                        (* Get the next available character from the text being edited.)
                        (\BIN (fetch STREAMHINT of TEXTOBJ]
[PUTPROPS \GETCHB MACRO ((TEXTOBJ)
                         (* Get the next prior character in the text being edited.)
                         (\BACKBIN (fetch STREAMHINT of TEXTOBJ]
(PUTPROPS \EDITSETA DMACRO (OPENLAMBDA (ARR N VAL)
                                  (* Equivalent to SETA (for pointer-type arrays)
                                     , but bypasses the bounds and type checking. Hence MUCH faster.)
                                  (\RPLPTR (\ADDBASE2 (fetch (ARRAYP BASE)
                                                             of ARR)
                                                  N)
                                         0 VAL)))
(PUTPROPS \WORDSETA DMACRO (OPENLAMBDA (A J V)
                                  [CHECK (AND (ARRAYP A)
                                              (ZEROP (fetch (ARRAYP ORIG)
                                                            of A))
                                              (EQ \ST.POS16 (fetch (ARRAYP TYP)
                                                                   of A]
                                  (CHECK (IGREATERP (fetch (ARRAYP LENGTH)
                                                           of A)
                                                J))
                                  (\PUTBASE (fetch (ARRAYP BASE)
                                                   of A)
                                         (IPLUS (fetch (ARRAYP OFFST)
                                                       of A)
                                                J)
                                         V)))
)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS \TEXTIMAGEOPS \TEXTOFD \TEXTFDEV)
)
)



(* ;;; "FROM TEDITPAGE")

[DECLARE: EVAL@COMPILE 

(RECORD PAGEFORMATTINGSTATE (                                (* Contains the state for a TEdit 
                                                             page-formatting job.)
                             PAGE#                           (* The current page number.
                                                             Counted from 1)
                             FIRSTPAGE
          
          (* T if the current page is the "first page" %.
          Is set initially, and can be set again by the user at will.
          Gets reset after each page image is printed.)

                             MINPAGE#                        (* The page # of the first page to be 
                                                             printed, or NIL)
                             MAXPAGE#                        (* The page # of the last page to be 
                                                             printed, or NIL)
                             STATE                           (* One of FORMATTING or SEARCHING.)
                             REQUIREDREGIONTYPE              (* If STATE is SEARCHING, the kind of 
                                                             box we're looking for.)
                             MAINSTREAM                      (* The principal textobj/stream source)
                             CHNO                            (* Our position in that stream)
                             PRESSREGION                     (* The press code's REGION info.)
                             PAGEHEADINGS                    (* The list of current values to be 
                                                             printed, indexed by heading type)
                             PAGE#GENERATOR                  (* List of page numbers;
                                                             later, maybe, a function to generate 
                                                             page numbers. Used to fill in 
                                                             PAGE#TEXT, below)
                             PAGE#TEXT                       (* If special page numbers are in use, 
                                                             this is the place to take them from.
                                                             PAGE# is still used for recto/verso 
                                                             decisions &c)
                             PAGEISRECTO                     (* T if this is a recto page, NIL if 
                                                             it's a VERSO page.)
                             PAGEFOOTNOTELINES               (* A list of extant footnote lines 
                                                             that should appear at the next 
                                                             opportunity)
                             PAGEFLOATINGTOPLINES            (* A list of lines that should float 
                                                             to the top of the next available place)
                             PAGECOUNT                       (* The number of pages we've formatted 
                                                             so far.)
                             PAGELINECACHE                   (* A cache for pre-created 
                                                             LINEDESCRIPTOR/THISLINE sets, to avoid 
                                                             the overhead of re-allocating them all 
                                                             the time)
                             )
                            PAGECOUNT ← 0)

(DATATYPE PAGEREGION (REGIONFILLMETHOD                       (* What kind of a region this is --
                                                             TEXT, FOLIO, PAGEHEADING, etc.)
                            REGIONSPEC                       (* The page-relative region this 
                                                             occupies)
                            REGIONLOCALINFO                  (* A PLIST for local information)
                            (REGIONPARENT FULLXPOINTER)      (* The parent node for this box, for 
                                                             sub-boxes)
                            REGIONSUBBOXES                   (* The sub-regions of this region)
                            REGIONTYPE                       (* A user-settable region type)
                            ))
]
(/DECLAREDATATYPE (QUOTE PAGEREGION)
       (QUOTE (POINTER POINTER POINTER FULLXPOINTER POINTER POINTER))
       (QUOTE ((PAGEREGION 0 POINTER)
               (PAGEREGION 2 POINTER)
               (PAGEREGION 4 POINTER)
               (PAGEREGION 6 FULLXPOINTER)
               (PAGEREGION 8 POINTER)
               (PAGEREGION 10 POINTER)))
       (QUOTE 12))
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD TEDITPAPERSIZE (TPSNAME TPSWIDTH TPSHEIGHT TPSLANDSCAPE?))
]
)



(* ;; "FROM TEDITFIND")

(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ \AlphaNumericFlag 256)

(RPAQQ \AlphaFlag 512)

(RPAQQ \OneCharPattern 1024)

(RPAQQ \AnyStringPattern 1025)

(RPAQQ \OneAlphaPattern 1026)

(RPAQQ \AnyAlphaPattern 1027)

(RPAQQ \OneNonAlphaPattern 1028)

(RPAQQ \AnyNonAlphaPattern 1029)

(RPAQQ \LeftBracketPattern 1030)

(RPAQQ \RightBracketPattern 1031)

(RPAQQ \SpecialPattern 1024)

(CONSTANTS (\AlphaNumericFlag 256)
       (\AlphaFlag 512)
       (\OneCharPattern 1024)
       (\AnyStringPattern 1025)
       (\OneAlphaPattern 1026)
       (\AnyAlphaPattern 1027)
       (\OneNonAlphaPattern 1028)
       (\AnyNonAlphaPattern 1029)
       (\LeftBracketPattern 1030)
       (\RightBracketPattern 1031)
       (\SpecialPattern 1024))
)
)



(* ;; " FROM TEDITLOOKS")

[DECLARE: EVAL@COMPILE 

(DATATYPE CHARLOOKS (CLFONT                                  (* The font descriptor for these 
                                                             characters)
                           CLNAME
          
          (* Name of the font (e.g., HELVETICA) THIS FIELD IS A HINT, OR FOR USE IN 
          CHARLOOKS-BUILDING CODE. USE FONTPROP TO GET THE RIGHT VALUE FROM CLFONT.)

                           CLSIZE                            (* Font size, in points)
                           (CLITAL FLAG)                     (* T if the characters are italic, 
                                                             else NIL)
                           (CLBOLD FLAG)                     (* T if the characters are bold, else 
                                                             NIL)
                           (CLULINE FLAG)                    (* T if the characters are to be 
                                                             underscored, else NIL)
                           (CLOLINE FLAG)                    (* T if the characters are to be 
                                                             overscored, else NIL)
                           (CLSTRIKE FLAG)                   (* T if the characters are to be 
                                                             struck thru, else nil.)
                           CLOFFSET                          (* A superscripting offset in points
                                                             (?) else NIL (SUBSCRIPTING IF 
                                                             NEGATIVE.))
                           (CLSMALLCAP FLAG)                 (* T if small caps, else NIL)
                           (CLINVERTED FLAG)                 (* T if the characters are to be shown 
                                                             white-on-black)
                           (CLPROTECTED FLAG)                (* T if chars can't be selected, else 
                                                             NIL)
                           (CLINVISIBLE FLAG)                (* T if TEDIT is to ignore these 
                                                             chars; else NIL)
                           (CLSELHERE FLAG)                  (* T if TEDIT can put selection after 
                                                             this char (for menu blanks) else NIL;
                                                             anything typed after this char will 
                                                             NOT BE PROTECTED.)
                           (CLCANCOPY FLAG)                  (* T if this text can be selected for 
                                                             copying, even tho protected
                                                             (it will become unprotected after the 
                                                             copy; for Dribble/TTY interface))
                           CLSTYLE                           (* The style to be used in marking 
                                                             these characters; overridden by the 
                                                             other fields)
                           CLUSERINFO                        (* Any information that an outsider 
                                                             wants to include)
                           CLLEADER                          (* For creating dotted and other kinds 
                                                             of leader)
                           CLRULES                           (* For arbitrarily-places horizontal 
                                                             rules. List of pairs, of
                                                             (widthinpts . offsetfrombaselineinpts)
                                                             %. Should be taken account of in 
                                                             ascent/descent calcs.)
                           (CLMARK FLAG)                     (* Used for a mark-&-sweep of looks at 
                                                             PUT time -- T means this set of looks 
                                                             really IS in use in the document)
                           )
                    CLOFFSET ← 0)

(DATATYPE FMTSPEC (1STLEFTMAR                                (* Left margin of the first line of 
                                                             the paragraph)
                         LEFTMAR                             (* Left margin of the rest of the 
                                                             lines in the paragraph)
                         RIGHTMAR                            (* Right margin for the paragraph)
                         LEADBEFORE                          (* Leading above the paragraph's first 
                                                             line, in points)
                         LEADAFTER                           (* Leading below the paragraph's 
                                                             bottom line, in points.
                                                             NOT IMPLEMENTED.)
                         LINELEAD                            (* Leading between lines, in points.
                                                             Actually, this space is added BELOW 
                                                             each line in the para.)
                         FMTBASETOBASE                       (* The baseline-to-baseline spacing 
                                                             between lines in this paragraph.
                                                             THIS OVERRIDES THE LINE LEADING)
                         TABSPEC                             (* The list of tabs for this 
                                                             paragraph, including CAR for a default 
                                                             tab width)
                         QUAD                                (* How the para is formatted: one of 
                                                             LEFT, RIGHT, CENTERED, JUSTIFIED)
                         FMTSTYLE                            (* The STYLE that controls this 
                                                             paragraph's appearance)
                         FMTCHARSTYLES                       (* The characterstyles that control 
                                                             the appearance of characters in this 
                                                             para (maybe? may be part of the 
                                                             fmtstyle.))
                         FMTUSERINFO                         (* Space for a PLIST of user info)
                         FMTSPECIALX                         (* A special horizontal location on 
                                                             the printed page for this para.)
                         FMTSPECIALY                         (* A special vertical location on the 
                                                             page for this para)
                         (FMTHEADINGKEEP FLAG)               (* This para should be kept with the 
                                                             top line or so of the next para.
                                                             NOT USED YET.)
                         FMTPARATYPE                         (* What kind of para this is: TEXT, 
                                                             PAGEHEADING, whatever)
                         FMTPARASUBTYPE                      (* Sub type of the type, e.g., what 
                                                             KIND of page heading this is.)
                         FMTNEWPAGEBEFORE
          
          (* Start a new box (if T) or back up the page formatting tree to make a new box 
          of the type named in the value -- by going the least distance back up the tree, 
          then back down until you find that kind of box.)

                         FMTNEWPAGEAFTER                     (* Similarly)
                         FMTKEEP                             (* For information about how this 
                                                             paragraph is to be kept with other 
                                                             paragraphs.)
                         FMTCOLUMN                           (* For setting up side-by-side 
                                                             paragraphs easily ala BravoX)
                         FMTVERTRULES                        (* For Keeping track of vertical rules 
                                                             in force)
                         (FMTMARK FLAG)
          
          (* Used to keep track of which PARALOOKSs are really being used --
          a mark & collect is done just before a PUT, so that only "real" PARALOOKSs make 
          it into the file)

                         (FMTHARDCOPY FLAG)                  (* T if this paragraph is to be 
                                                             displayed in hardcopy-format.)
          
          (* Used for a mark&sweep of para looks at PUT time --
          T means this looks really IS in use in the document, so it makes sense to save 
          it on the file.)

                         )
                  TABSPEC ← (CONS NIL NIL))

(DATATYPE PENDINGTAB (                                       (* The data structure for a pending 
                                                             tab, within the line formatter)
                      PTNEWTX
          
          (* An updated TX, being passed back to the line formatter.
          This results from the resolution of an old RIGHT, CENTERED, or DECIMAL tab, 
          which changed the width of a prior tab.)

                      PTOLDTAB                               (* The pending tab)
                      PTTYPE                                 (* Its tab type)
                      PTTABX                                 (* Its nominal X position)
                      (PTWBASE FULLXPOINTER)                 (* The WBASE for its width, for 
                                                             updating when we've figured out how 
                                                             wide the tab really is)
                      PTOLDTX                                (* The TX as of when the tab was 
                                                             encountered.)
                      ))
]
(/DECLAREDATATYPE (QUOTE CHARLOOKS)
       (QUOTE (POINTER POINTER POINTER FLAG FLAG FLAG FLAG FLAG POINTER FLAG FLAG FLAG FLAG FLAG FLAG 
                     POINTER POINTER POINTER POINTER FLAG))
       [QUOTE ((CHARLOOKS 0 POINTER)
               (CHARLOOKS 2 POINTER)
               (CHARLOOKS 4 POINTER)
               (CHARLOOKS 4 (FLAGBITS . 0))
               (CHARLOOKS 4 (FLAGBITS . 16))
               (CHARLOOKS 4 (FLAGBITS . 32))
               (CHARLOOKS 4 (FLAGBITS . 48))
               (CHARLOOKS 4 (FLAGBITS . 64))
               (CHARLOOKS 6 POINTER)
               (CHARLOOKS 6 (FLAGBITS . 0))
               (CHARLOOKS 6 (FLAGBITS . 16))
               (CHARLOOKS 6 (FLAGBITS . 32))
               (CHARLOOKS 6 (FLAGBITS . 48))
               (CHARLOOKS 6 (FLAGBITS . 64))
               (CHARLOOKS 6 (FLAGBITS . 80))
               (CHARLOOKS 8 POINTER)
               (CHARLOOKS 10 POINTER)
               (CHARLOOKS 12 POINTER)
               (CHARLOOKS 14 POINTER)
               (CHARLOOKS 14 (FLAGBITS . 0]
       (QUOTE 16))
(/DECLAREDATATYPE (QUOTE FMTSPEC)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER POINTER POINTER POINTER FLAG POINTER POINTER POINTER POINTER POINTER 
                     POINTER POINTER FLAG FLAG))
       [QUOTE ((FMTSPEC 0 POINTER)
               (FMTSPEC 2 POINTER)
               (FMTSPEC 4 POINTER)
               (FMTSPEC 6 POINTER)
               (FMTSPEC 8 POINTER)
               (FMTSPEC 10 POINTER)
               (FMTSPEC 12 POINTER)
               (FMTSPEC 14 POINTER)
               (FMTSPEC 16 POINTER)
               (FMTSPEC 18 POINTER)
               (FMTSPEC 20 POINTER)
               (FMTSPEC 22 POINTER)
               (FMTSPEC 24 POINTER)
               (FMTSPEC 26 POINTER)
               (FMTSPEC 26 (FLAGBITS . 0))
               (FMTSPEC 28 POINTER)
               (FMTSPEC 30 POINTER)
               (FMTSPEC 32 POINTER)
               (FMTSPEC 34 POINTER)
               (FMTSPEC 36 POINTER)
               (FMTSPEC 38 POINTER)
               (FMTSPEC 40 POINTER)
               (FMTSPEC 40 (FLAGBITS . 0))
               (FMTSPEC 40 (FLAGBITS . 16]
       (QUOTE 42))
(/DECLAREDATATYPE (QUOTE PENDINGTAB)
       (QUOTE (POINTER POINTER POINTER POINTER FULLXPOINTER POINTER))
       (QUOTE ((PENDINGTAB 0 POINTER)
               (PENDINGTAB 2 POINTER)
               (PENDINGTAB 4 POINTER)
               (PENDINGTAB 6 POINTER)
               (PENDINGTAB 8 FULLXPOINTER)
               (PENDINGTAB 10 POINTER)))
       (QUOTE 12))
(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(PUTPROPS \SMALLPIN MACRO (OPENLAMBDA (STREAM)
                                 (SIGNED (create WORD HIBYTE ← (\BIN STREAM)
                                                LOBYTE ← (\BIN STREAM))
                                        BITSPERWORD)))
[PUTPROPS \SMALLPOUT MACRO (OPENLAMBDA (STREAM W)
                                  (\BOUT STREAM (LOGAND 255 (LRSH W 8)))
                                  (\BOUT STREAM (LOGAND W 255]
[PUTPROPS ONOFF MACRO (OPENLAMBDA (VAL)
                             (COND (VAL (QUOTE ON))
                                   (T (QUOTE OFF]
)
)



(* ;; "FROM TEDITMENU")

(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD MBUTTON NIL [TYPE? (AND (IMAGEOBJP DATUM)
                                (OR (EQ (IMAGEOBJPROP DATUM (QUOTE DISPLAYFN))
                                        (QUOTE MB.DISPLAY))
                                    (EQ (IMAGEOBJPROP DATUM (QUOTE DISPLAYFN))
                                        (QUOTE MB.THREESTATE.DISPLAY))
                                    (EQ (IMAGEOBJPROP DATUM (QUOTE DISPLAYFN))
                                        (QUOTE \TEXTMENU.TOGGLE.DISPLAY])
]
)
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD NWAYBUTTON NIL [TYPE? (AND (IMAGEOBJP DATUM)
                                   (EQ (IMAGEOBJPROP DATUM (QUOTE DISPLAYFN))
                                       (QUOTE MB.NB.DISPLAYFN])
]
)
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD MARGINBAR (MARL1 MARLN MARR MARTABS MARUNIT MARTABTYPE)
                  [TYPE? (AND (IMAGEOBJP DATUM)
                              (EQ (IMAGEOBJPROP DATUM (QUOTE DISPLAYFN))
                                  (QUOTE MB.MARGINBAR.DISPLAYFN])
]
)
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD TAB (TABX . TABKIND))
]
)
[DECLARE: EVAL@COMPILE 

(TYPERECORD MB.3STATE (MBLABEL MBFONT MBCHANGESTATEFN MBINITSTATE)
                      MBFONT ← (FONTCREATE (QUOTE HELVETICA)
                                      8
                                      (QUOTE BOLD)))

(TYPERECORD MB.BUTTON (MBLABEL MBBUTTONEVENTFN MBFONT)
                      MBBUTTONEVENTFN ← (QUOTE MB.DEFAULTBUTTON.FN)
                      MBFONT ← (FONTCREATE (QUOTE HELVETICA)
                                      8
                                      (QUOTE BOLD)))

(TYPERECORD MB.INSERT (MBINITENTRY))

(TYPERECORD MB.MARGINBAR (ignoredfield))

(TYPERECORD MB.NWAY (MBBUTTONS MBFONT MBCHANGESTATEFN MBINITSTATE MBMAXITEMSPERLINE)
                    MBFONT ← (FONTCREATE (QUOTE HELVETICA)
                                    8
                                    (QUOTE BOLD)))

(TYPERECORD MB.TEXT (MBSTRING MBFONT))

(TYPERECORD MB.TOGGLE (MBTEXT MBFONT MBCHANGESTATEFN MBINITSTATE)
                      MBFONT ← (FONTCREATE (QUOTE HELVETICA)
                                      8
                                      (QUOTE BOLD)))
]



(* ;; "FROM TEDITHISTORY")

[DECLARE: EVAL@COMPILE 

(RECORD TEDITHISTORYEVENT (THACTION                          (* A LITATOM, specifying what the 
                                                             event was)
                                 THPOINT                     (* Was the selection to the left or 
                                                             right?)
                                 THLEN                       (* The # of chars involved)
                                 THCH#                       (* The starting ch#)
                                 THFIRSTPIECE                (* First piece involved)
                                 THOLDINFO                   (* Old info, for undo)
                                 THAUXINFO                   (* Auxiliary info about the event, 
                                                             primarily for redo)
                                 THTEXTOBJ                   (* Place to remember a second textobj, 
                                                             for those like MOVE who need to 
                                                             remember both a source and a 
                                                             destination.)
                                 )
                          THPOINT ← (QUOTE LEFT))
]



(* ;; "FROM TEDITSCREEN")

[DECLARE: EVAL@COMPILE 

(DATATYPE THISLINE (                                         (* Cache for line-related character 
                                                             location info, for selection code to 
                                                             use)
                    (DESC FULLXPOINTER)                      (* Line descriptor for the line this 
                                                             describes now)
                    LEN                                      (* Length of the line in characters)
                    CHARS
          
          (* Array of character codes (or objects) on the line
          (charcode of 400 => dummy entry for looks change--go get next entry in LOOKS))

                    WIDTHS                                   (* Array of each character's width in 
                                                             points)
                    LOOKS                                    (* Array of any looks changes within 
                                                             the line. LOOKS (0) = starting 
                                                             character looks for the line)
                    TLSPACEFACTOR                            (* The SPACEFACTOR to be used in 
                                                             printing this line)
                    )
                   LEN ← 0 CHARS ← (ARRAY 256 (QUOTE POINTER)
                                          0 0)
                   WIDTHS ← (ARRAY 256 (QUOTE SMALLP)
                                   0 0)
                   LOOKS ← (ARRAY 256 (QUOTE POINTER)
                                  NIL 0))

(DATATYPE LINEDESCRIPTOR 
          (YBOT                                              (* Y value for the bottom of the line
                                                             (below the descent))
                YBASE                                        (* Yvalue for the base line the 
                                                             characters sit on)
                LEFTMARGIN                                   (* Left margin, in screen points)
                RIGHTMARGIN                                  (* Right margin, in screen points)
                LXLIM                                        (* X value of right edge of rightmost 
                                                             character on the line
                                                             (may exceed right margin, if char is a 
                                                             space.))
                SPACELEFT                                    (* Space left on the line, ignoring 
                                                             trailing blanks & CRs.)
                LHEIGHT                                      (* Total height of hte line, 
                                                             Ascent+Descent.)
                ASCENT                                       (* Ascent of the line above YBASE)
                DESCENT                                      (* How far line descends below YBASE)
                LTRUEDESCENT                                 (* The TRUE DESCENT for this line, 
                                                             unadjusted for line leading.)
                LTRUEASCENT                                  (* The TRUE ASCENT for this line, 
                                                             unadjusted for pre-paragraph leading.)
                CHAR1                                        (* CH# of the first character on the 
                                                             line.)
                CHARLIM                                      (* CH# of the last character on the 
                                                             line)
                CHARTOP                                      (* CH# of the character which forced 
                                                             the line break (may exceed CHARLIM))
                NEXTLINE                                     (* Next line chain pointer)
                (PREVLINE FULLXPOINTER)                      (* Previous line chain pointer)
                LMARK
          
          (* One of SOLID, GREY, NIL. Tells what kind of special-line marker should be 
          put in the left margin for this paragraph.
          (For hardcopy, can also be an indicator for special processing?))

                LTEXTOBJ                                     (* A cached TEXTOBJ that this line 
                                                             took its text from. Used in hardcopy 
                                                             to disambiguate when chno's should be 
                                                             updated...)
                CACHE                                        (* A cached THISLINE, for keeping 
                                                             hardcopy info around while we crunch 
                                                             with the line descriptors to make 
                                                             things fit.)
                LDOBJ                                        (* The object which lies behind this 
                                                             line of text, for updating, etc.)
                LFMTSPEC                                     (* The format spec for this line's 
                                                             paragraph (eventually))
                (DIRTY FLAG)                                 (* T if this line has changed since it 
                                                             was last formatted.)
                (CR\END FLAG)                                (* T if this line ends with a CR.)
                (DELETED FLAG)                               (* T if this line has been completely 
                                                             deleted since it was last formatted or 
                                                             displayed. (Used by deletion routines 
                                                             to detect garbage lines))
                (LHASPROT FLAG)                              (* This line contains protected text.)
                (LHASTABS FLAG)
          
          (* If this line has a tab in it, this is the line-relative ch# of the final 
          tab. This is to let us punt properly with tabs in a line.)

                (1STLN FLAG)                                 (* This line is the first line in a 
                                                             paragraph)
                (LSTLN FLAG)                                 (* This is the last line in a 
                                                             paragraph)
                )
          CHARLIM ← 1000000 NEXTLINE ← NIL PREVLINE ← NIL DIRTY ← NIL YBOT ← 0 YBASE ← 0 LEFTMARGIN ← 
          0 DELETED ← NIL)

(DATATYPE LINECACHE (LCBITMAP                                (* The bitmap that will be used by 
                                                             this instance of the cache)
                           (LCNEXTCACHE FULLXPOINTER)        (* The next cache in the chain, for 
                                                             screen updates.)
                           ))
]
(/DECLAREDATATYPE (QUOTE THISLINE)
       (QUOTE (FULLXPOINTER POINTER POINTER POINTER POINTER POINTER))
       (QUOTE ((THISLINE 0 FULLXPOINTER)
               (THISLINE 2 POINTER)
               (THISLINE 4 POINTER)
               (THISLINE 6 POINTER)
               (THISLINE 8 POINTER)
               (THISLINE 10 POINTER)))
       (QUOTE 12))
(/DECLAREDATATYPE (QUOTE LINEDESCRIPTOR)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER POINTER POINTER POINTER POINTER FULLXPOINTER POINTER POINTER POINTER 
                     POINTER POINTER FLAG FLAG FLAG FLAG FLAG FLAG FLAG))
       [QUOTE ((LINEDESCRIPTOR 0 POINTER)
               (LINEDESCRIPTOR 2 POINTER)
               (LINEDESCRIPTOR 4 POINTER)
               (LINEDESCRIPTOR 6 POINTER)
               (LINEDESCRIPTOR 8 POINTER)
               (LINEDESCRIPTOR 10 POINTER)
               (LINEDESCRIPTOR 12 POINTER)
               (LINEDESCRIPTOR 14 POINTER)
               (LINEDESCRIPTOR 16 POINTER)
               (LINEDESCRIPTOR 18 POINTER)
               (LINEDESCRIPTOR 20 POINTER)
               (LINEDESCRIPTOR 22 POINTER)
               (LINEDESCRIPTOR 24 POINTER)
               (LINEDESCRIPTOR 26 POINTER)
               (LINEDESCRIPTOR 28 POINTER)
               (LINEDESCRIPTOR 30 FULLXPOINTER)
               (LINEDESCRIPTOR 32 POINTER)
               (LINEDESCRIPTOR 34 POINTER)
               (LINEDESCRIPTOR 36 POINTER)
               (LINEDESCRIPTOR 38 POINTER)
               (LINEDESCRIPTOR 40 POINTER)
               (LINEDESCRIPTOR 40 (FLAGBITS . 0))
               (LINEDESCRIPTOR 40 (FLAGBITS . 16))
               (LINEDESCRIPTOR 40 (FLAGBITS . 32))
               (LINEDESCRIPTOR 40 (FLAGBITS . 48))
               (LINEDESCRIPTOR 40 (FLAGBITS . 64))
               (LINEDESCRIPTOR 40 (FLAGBITS . 80))
               (LINEDESCRIPTOR 40 (FLAGBITS . 96]
       (QUOTE 42))
(/DECLAREDATATYPE (QUOTE LINECACHE)
       (QUOTE (POINTER FULLXPOINTER))
       (QUOTE ((LINECACHE 0 POINTER)
               (LINECACHE 2 FULLXPOINTER)))
       (QUOTE 4))
(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ LMInvisibleRun 401)

(RPAQQ LMLooksChange 400)

(CONSTANTS (LMInvisibleRun 401)
       (LMLooksChange 400))
)
)



(* ;; "FROM TEDITFILE")

(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ \PieceDescriptorLOOKS 0)

(RPAQQ \PieceDescriptorOBJECT 1)

(RPAQQ \PieceDescriptorPARA 2)

(RPAQQ \PieceDescriptorPAGEFRAME 3)

(RPAQQ \PieceDescriptorCHARLOOKSLIST 4)

(RPAQQ \PieceDescriptorPARALOOKSLIST 5)

(RPAQQ \PieceDescriptorSAFEOBJECT 6)

(CONSTANTS (\PieceDescriptorLOOKS 0)
       (\PieceDescriptorOBJECT 1)
       (\PieceDescriptorPARA 2)
       (\PieceDescriptorPAGEFRAME 3)
       (\PieceDescriptorCHARLOOKSLIST 4)
       (\PieceDescriptorPARALOOKSLIST 5)
       (\PieceDescriptorSAFEOBJECT 6))
)
)



(* ;; "FROM TEDITCOMMAND")

(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(PUTPROPS \INSERT\TTY\BUFFER MACRO (NIL (\TEDIT.INSERT.TTY.BUFFER ISCRSTRING IPASSSTRING TEXTOBJ SEL)
                                        ))
[PUTPROPS \TEDIT.MOUSESTATE MACRO (BUTTON (* Test to see if only the specified mouse button is down. 
                                             DOES NOT call GETMOUSESTATE, so the mouse-button info is 
                                             the same as the last time it WAS called.)
                                         (SELECTQ (CAR BUTTON)
                                                (LEFT (QUOTE (IEQP LASTMOUSEBUTTONS 4)))
                                                (MIDDLE (QUOTE (IEQP LASTMOUSEBUTTONS 1)))
                                                (RIGHT (QUOTE (IEQP LASTMOUSEBUTTONS 2)))
                                                (SHOULDNT]
[PUTPROPS \TEDIT.CHECK MACRO (ARGS (COND [(AND (BOUNDP (QUOTE CHECK))
                                               CHECK)
                                          (CONS (QUOTE PROGN)
                                                (for I in ARGS as J on ARGS when (NOT (STRINGP I))
                                                     collect
                                                     (LIST (QUOTE OR)
                                                           I
                                                           (LIST (QUOTE HELP)
                                                                 
                                            "TEdit consistency-check failure [RETURN to continue]:  "
                                                                 (COND ((STRINGP (CADR J)))
                                                                       (T (KWOTE I]
                                         (T (CONS COMMENTFLG ARGS]
)
)
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(ACCESSFNS TEDITTERMCODE ((TTCLASS (LOGAND DATUM 224))
                          (TTDECODE (LOGAND DATUM 31))))
]
)
(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ NONE.TTC 0)

(RPAQQ CHARDELETE.TTC 1)

(RPAQQ WORDDELETE.TTC 2)

(RPAQQ DELETE.TTC 3)

(RPAQQ FUNCTIONCALL.TTC 4)

(RPAQQ REDO.TTC 5)

(RPAQQ UNDO.TTC 6)

(RPAQQ CMD.TTC 7)

(RPAQQ NEXT.TTC 8)

(RPAQQ EXPAND.TTC 9)

(RPAQQ PUNCT.TTC 20)

(RPAQQ TEXT.TTC 21)

(RPAQQ WHITESPACE.TTC 22)

(CONSTANTS (NONE.TTC 0)
       (CHARDELETE.TTC 1)
       (WORDDELETE.TTC 2)
       (DELETE.TTC 3)
       (FUNCTIONCALL.TTC 4)
       (REDO.TTC 5)
       (UNDO.TTC 6)
       (CMD.TTC 7)
       (NEXT.TTC 8)
       (EXPAND.TTC 9)
       (PUNCT.TTC 20)
       (TEXT.TTC 21)
       (WHITESPACE.TTC 22))
)
)
(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ MSPACE 153)

(RPAQQ NSPACE 152)

(RPAQQ THINSPACE 159)

(RPAQQ FIGSPACE 154)

(CONSTANTS (MSPACE 153)
       (NSPACE 152)
       (THINSPACE 159)
       (FIGSPACE 154))
)
)



(* ;; "FROM TEDITWINDOW")

(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(DATATYPE TEDITCARET (TCNOWTIME                              (* Used to hold the current time, when 
                                                             checking to see if a transition is due)
                            TCTHENTIME                       (* Time when the next transition is to 
                                                             take place)
                            TCFORCEDDOWN                     (* TCFORCEDOWN = T means
                                                             (Make the caret visible at the next 
                                                             call to \EDIT.FLIPCARET.))
                            TCUP                             (* TCUP = T => The caret is NOT 
                                                             VISIBLE. Used to track the current 
                                                             state of the caret)
                            TCCARETDS                        (* The display stream that the caret 
                                                             appears in)
                            TCCURSORBM                       (* The CURSOR representing the caret)
                            TCCARETRATE                      (* # of MSEC between caret up/down 
                                                             transitions)
                            TCFORCEUP                        (* T => The caret is not allowed to 
                                                             become visible. Used to keep the caret 
                                                             up during screen updates)
                            TCCARETX                         (* X position in the window that the 
                                                             caret appears at)
                            TCCARETY                         (* Y position in the window where the 
                                                             caret appears)
                            TCCARET                          (* A lisp CARET to be flashed
                                                             (eventually))
                            )
                     TCNOWTIME ← (CREATECELL \FIXP)
                     TCTHENTIME ← (CREATECELL \FIXP)
                     TCCURSORBM ← BXCARET TCCARETRATE ← \CARETRATE TCUP ← T TCCARET ← (\CARET.CREATE
                                                                                       BXCARET))
]
(/DECLAREDATATYPE (QUOTE TEDITCARET)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER))
       (QUOTE ((TEDITCARET 0 POINTER)
               (TEDITCARET 2 POINTER)
               (TEDITCARET 4 POINTER)
               (TEDITCARET 6 POINTER)
               (TEDITCARET 8 POINTER)
               (TEDITCARET 10 POINTER)
               (TEDITCARET 12 POINTER)
               (TEDITCARET 14 POINTER)
               (TEDITCARET 16 POINTER)
               (TEDITCARET 18 POINTER)
               (TEDITCARET 20 POINTER)))
       (QUOTE 22))
)
(/DECLAREDATATYPE (QUOTE TEDITCARET)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER))
       (QUOTE ((TEDITCARET 0 POINTER)
               (TEDITCARET 2 POINTER)
               (TEDITCARET 4 POINTER)
               (TEDITCARET 6 POINTER)
               (TEDITCARET 8 POINTER)
               (TEDITCARET 10 POINTER)
               (TEDITCARET 12 POINTER)
               (TEDITCARET 14 POINTER)
               (TEDITCARET 16 POINTER)
               (TEDITCARET 18 POINTER)
               (TEDITCARET 20 POINTER)))
       (QUOTE 22))



(* ;; "FROM TEDITSELECTION")

[DECLARE: EVAL@COMPILE 

(DATATYPE SELECTION 
          (Y0                                                (* Y value of topmost line of 
                                                             selection)
              X0                                             (* X value of left edge of selection)
              DX                                             (* Width of the selection, if it's on 
                                                             one line.)
              CH#                                            (* CH# of the first selected character)
              XLIM                                           (* X value of right edge of last 
                                                             selected character)
              CHLIM                                          (* CH# of the last character in the 
                                                             selection)
              DCH                                            (* # of characters selected
                                                             (can be zero, for point selection.))
              L1                                             (* -> line descriptor for the line 
                                                             where the first selected character is)
              LN                                             (* -> line descriptor for the line 
                                                             which contains the end of the 
                                                             selection)
              YLIM                                           (* Y value of the bottom of the line 
                                                             that ends the selection)
              POINT                                          (* Which end should the caret appear 
                                                             at? (LEFT or RIGHT))
              (SET FLAG)                                     (* T if this selection is real;
                                                             NIL if not)
              (\TEXTOBJ FULLXPOINTER)                        (* TEXTOBJ that describes the selected 
                                                             text)
              SELKIND                                        (* What kind of selection? CHAR or 
                                                             WORD or LINE or PARA)
              HOW                                            (* SHADE used to highlight this 
                                                             selection)
              HOWHEIGHT                                      (* Height of the highlight
                                                             (1 usually, full line for delete 
                                                             selection...))
              (HASCARET FLAG)                                (* T if there should be a caret for 
                                                             this selection)
              SELOBJ                                         (* If this selection is inside an 
                                                             object, which object?)
              (ONFLG FLAG)                                   (* T if the selection is highlighted 
                                                             on the screen, else NIL)
              SELOBJINFO                                     (* A Place for the selected object to 
                                                             put info about selection inside 
                                                             itself.)
              )
          SET ← NIL HOW ← BLACKSHADE HOWHEIGHT ← 1 HASCARET ← T Y0 ← 0 X0 ← 0 POINT ← (QUOTE LEFT)
          L1 ← (LIST NIL)
          LN ← (LIST NIL))
]
(/DECLAREDATATYPE (QUOTE SELECTION)
       (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
                     POINTER FLAG FULLXPOINTER POINTER POINTER POINTER FLAG POINTER FLAG POINTER))
       (QUOTE ((SELECTION 0 POINTER)
               (SELECTION 2 POINTER)
               (SELECTION 4 POINTER)
               (SELECTION 6 POINTER)
               (SELECTION 8 POINTER)
               (SELECTION 10 POINTER)
               (SELECTION 12 POINTER)
               (SELECTION 14 POINTER)
               (SELECTION 16 POINTER)
               (SELECTION 18 POINTER)
               (SELECTION 20 POINTER)
               (SELECTION 20 (FLAGBITS . 0))
               (SELECTION 22 FULLXPOINTER)
               (SELECTION 24 POINTER)
               (SELECTION 26 POINTER)
               (SELECTION 28 POINTER)
               (SELECTION 28 (FLAGBITS . 0))
               (SELECTION 30 POINTER)
               (SELECTION 30 (FLAGBITS . 0))
               (SELECTION 32 POINTER)))
       (QUOTE 34))
(DECLARE: EVAL@COMPILE DONTCOPY 
(DECLARE: EVAL@COMPILE 

(RPAQQ COPYSELSHADE 30583)

(RPAQQ COPYLOOKSSELSHADE 30583)

(RPAQQ EDITMOVESHADE -1)

(RPAQQ EDITGRAY 32800)

(CONSTANTS (COPYSELSHADE 30583)
       (COPYLOOKSSELSHADE 30583)
       (EDITMOVESHADE -1)
       (EDITGRAY 32800))
)
)



(* ;;; "THE END")


(RPAQQ TEDITDECLSCOMS ((* ;;; 
             "This file is the collected record declarations and compile-time necessities for TEDIT."
                          )
                       (* ;; "FROM TEDIT")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\SCRATCHLEN 64)))
                       (* ;; "FROM TEXTOFD")
                       (RECORDS EDITMARK)
                       (RECORDS PIECE TEXTOBJ TEXTIMAGEDATA TEXTSTREAM)
                       (MACROS TEXTPROP)
                       (COMS (* Private data structures and constants FROM TEXTOFD)
                             (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\PCTBFreePieces 0)
                                                                    (\PCTBLastPieceOffset 1)
                                                                    (\FirstPieceOffset 2)
                                                                    (\SecondPieceOffset 4)
                                                                    (\EltsPerPiece 2))
                                    (MACROS \EDITELT \GETCH \GETCHB \EDITSETA \WORDSETA)
                                    (GLOBALVARS \TEXTIMAGEOPS \TEXTOFD \TEXTFDEV)))
                       (* ;;; "FROM TEDITPAGE")
                       (RECORDS PAGEFORMATTINGSTATE PAGEREGION)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITPAPERSIZE))
                       (* ;; "FROM TEDITFIND")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\AlphaNumericFlag 256)
                                                              (\AlphaFlag 512)
                                                              (\OneCharPattern 1024)
                                                              (\AnyStringPattern 1025)
                                                              (\OneAlphaPattern 1026)
                                                              (\AnyAlphaPattern 1027)
                                                              (\OneNonAlphaPattern 1028)
                                                              (\AnyNonAlphaPattern 1029)
                                                              (\LeftBracketPattern 1030)
                                                              (\RightBracketPattern 1031)
                                                              (\SpecialPattern 1024)))
                       (* ;; " FROM TEDITLOOKS")
                       (RECORDS CHARLOOKS FMTSPEC PENDINGTAB)
                       (DECLARE: EVAL@COMPILE DONTCOPY (MACROS \SMALLPIN \SMALLPOUT ONOFF))
                       (* ;; "FROM TEDITMENU")
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS MBUTTON))
                       (INITRECORDS MBUTTON)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS NWAYBUTTON))
                       (INITRECORDS NWAYBUTTON)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS MARGINBAR))
                       (INITRECORDS MARGINBAR)
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TAB))
                       (RECORDS MB.3STATE MB.BUTTON MB.INSERT MB.MARGINBAR MB.NWAY MB.TEXT MB.TOGGLE)
                       (* ;; "FROM TEDITHISTORY")
                       (RECORDS TEDITHISTORYEVENT)
                       (* ;; "FROM TEDITSCREEN")
                       (RECORDS THISLINE LINEDESCRIPTOR LINECACHE)
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (LMInvisibleRun 401)
                                                              (LMLooksChange 400)))
                       (* ;; "FROM TEDITFILE")
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (\PieceDescriptorLOOKS 0)
                                                              (\PieceDescriptorOBJECT 1)
                                                              (\PieceDescriptorPARA 2)
                                                              (\PieceDescriptorPAGEFRAME 3)
                                                              (\PieceDescriptorCHARLOOKSLIST 4)
                                                              (\PieceDescriptorPARALOOKSLIST 5)
                                                              (\PieceDescriptorSAFEOBJECT 6)))
                       (* ;; "FROM TEDITCOMMAND")
                       (DECLARE: EVAL@COMPILE DONTCOPY (MACROS \INSERT\TTY\BUFFER \TEDIT.MOUSESTATE 
                                                              \TEDIT.CHECK))
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITTERMCODE))
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (NONE.TTC 0)
                                                              (CHARDELETE.TTC 1)
                                                              (WORDDELETE.TTC 2)
                                                              (DELETE.TTC 3)
                                                              (FUNCTIONCALL.TTC 4)
                                                              (REDO.TTC 5)
                                                              (UNDO.TTC 6)
                                                              (CMD.TTC 7)
                                                              (NEXT.TTC 8)
                                                              (EXPAND.TTC 9)
                                                              (PUNCT.TTC 20)
                                                              (TEXT.TTC 21)
                                                              (WHITESPACE.TTC 22)))
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (MSPACE 153)
                                                              (NSPACE 152)
                                                              (THINSPACE 159)
                                                              (FIGSPACE 154)))
                       (* ;; "FROM TEDITWINDOW")
                       (DECLARE: EVAL@COMPILE DONTCOPY (RECORDS TEDITCARET))
                       (INITRECORDS TEDITCARET)
                       (* ;; "FROM TEDITSELECTION")
                       (RECORDS SELECTION)
                       (DECLARE: EVAL@COMPILE DONTCOPY (CONSTANTS (COPYSELSHADE 30583)
                                                              (COPYLOOKSSELSHADE 30583)
                                                              (EDITMOVESHADE -1)
                                                              (EDITGRAY 32800)))
                       (* ;;; "THE END")
                       (VARS TEDITDECLSCOMS)))
(PUTPROPS TEDITDECLS COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL)))
STOP