mac-rom/Toolbox/ScriptMgr/RomanITL2.a

632 lines
27 KiB
Plaintext
Raw Normal View History

;
; File: RomanITL2.a
;
; Contains: Pack 6 sorting hooks, character type and conversion tables, and word break
; tables (all for US Roman).
;
; Written by: MED Mark Davis
; JDT Joe Ternasky
; ldc Lee Collins
; PKE Peter Edberg
; SMB Sue Bartalo
;
; Copyright: <09> 1986-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <15> 11/17/92 PKE Change includes so that we can give this file out to localizers.
; Move SetClass, DumpCharTable, setByte, and SetRow macros to new
; IntlResourcesPriv.a.
; <14> 6/17/92 HA #1020127,<PKE>: Changed "<22>" to be mapped to a postNum class
; instead of preNum, in class mapping table of FindWord (wrTable).
; So clicking on a run of numbers followed by <20> will select the
; whole as one word.
; <13> 4/14/92 JSM Get rid of all SysVers conditionals.
; <12> 3/3/92 PKE #1021909, CubeE: Fix error in word select tables for non-break
; space handling.
; <11> 1/10/91 PKE (csd) Adapt to change in ScriptEqu.a: change <20>ring<6E> to
; <09>ringMark<72>.
; <10> 12/10/90 PKE (VL) Change word break tables to fix old bug in which a
; non-breaking space glues whitespace to anything else. Now it
; only glues it to other whitespace.
; <9> 9/17/90 PKE Use formerly-reserved field in version 7 wordTable and wrapTable
; headers to store length of those tables; makes the tables ever
; so much nicer to DeRez. Touched up previous comment.
; <8> 9/17/90 SMB (PKE) Use formerly-reserved field in resource header for format
; code. A value >= 1 indicates that the length fields, etc. are
; present.
; <7> 5/29/90 DDG NEEDED FOR SIXPACK: Changed all the sixpack conditionals from
; six-point-oh-seven to six-point-oh-six.
; <5> 3/26/90 PKE Changed to also include 7.0 header extensions if
; romanDoSimpleScripts is true (which is now the case for 6.0.6).
; <4> 3/21/90 SMB Adding FindScriptTable to itl2 in a previously reserved space
; (by simply adding a comment!).
; <3> 3/2/90 PKE Changed word select definition in 7.0 to include letter-number
; as well as number-letter (already changed for 6.x).
; <2> 2/1/90 PKE NEEDED FOR 6.0.5: Change word select definition in 6.x to
; include letter-number as well as number-letter. Makes word
; select in TextEdit 3.0 act more like old TextEdit. This partly
; addresses BRC #58143. ALSO: Updated header to BBS format.
; <1> 12/18/89 CCH Adding for the first time into BBS. Changed include 'inc.sum.a'
; to load 'StandardEqu.d'. Updated file name references.
;
; (BBS versions above, EASE versions below)
; <2.3> 9/19/89 PKE Add length fields to header, fill in wordTableLen and
; wrapTableLen. Rearranged headers for 7.0 break tables to match
; new interfaces.
; <2.2> 9/5/89 PKE Now always use new-format FindWord tables for 7.0; other changes
; solved the problem that led to the silly forNFindWord
; conditional.
; <2.1> 9/4/89 PKE Add new-format FindWord tables for 7.0, but conditionalize them
; on forNFindWord, since will only be using them for testing at
; the moment.
; <2.0> 8/26/89 PKE Deleted load 'nEqu.d'. Changed references to newItl2Tables
; symbol to use SysVers instead, deleted newItl2Tables symbol.
; <1.9> 5/30/89 PKE Remove support in 6.0.4 for double-acute accent.
; <1.8> 4/12/89 PKE Added version number; fixed DumpCharTable macro for &index=0.
; <1.7> 3/29/89 PKE Add NoMarkList to SetClass & DumpCharTable macros; replace
; LowerNoMarkList table with NoMarkList table in itl2. LwrString
; can only use 4 out of the 5 possible conversions we might want,
; and the LowerNoMark conversion is the least useful.
; <1.6> 3/13/89 PKE Changed back to old order of offsets to tables (would have
; caused too many problems with existing prototypes).
; <1.5> 3/12/89 PKE Added LowerNoMarkList table; changed SetClass and DumpCharTable
; macros to accomodate this and to set UpperNoMarkList and
; LowerNoMarkList table values for all characters; supplied the
; additional data for the SetClass macro calls; fixed handling of
; <09> & <20> (when stripping diacritics, they now go to O & o). Changed
; order of offsets to CharType/Transliterate/FindWord tables.
; <1.4> 3/10/89 PKE Add <20>,<2C> to CharType/Transliterate tables
; <1.3> 3/5/89 PKE Conditionalized table changes that support character set
; extensions in Sys $604 and up; added German '<27>' support as part
; of these changes.
; <1.2> 2/21/89 PKE Extended to include CharType/Transliterate/FindWord tables from
; itlR. Fixed a problem introduced by use of new MPW equates: the
; itl2 offset equates defined in ScriptEqu.a replace the address
; offsets in this file, so change the offsets here to itl2XXXX.
; <1.1> 2/14/89 PKE Updated to use MPW 3.0 final ScriptEqu.a equate names
; <1.0> 11/16/88 CCH Added to EASE.
;
; (itlr history below, before it was merged in here)
; 10/18/88 ldc Moved word break and word wrap tables from RomanUtil.a
; 9/23/88 ldc changed lower casing rule for dotless i, added UpperNoMarkList
; for lower to upper casing without diacritics
; 7/12/88 ldc Added extensions of Macintosh character set
; 6/14/88 ldc Broke out from RomanUtil.a
;
; (old itl2 history below)
; 11/20/86 jdt Removed standard equates load. Renamed this file to prevent file
; name collisions.
; 9/18/86 JDT Roman package hooks are now also used by a switch-launched
; international system. And loving it.
; 8/28/86 JDT Mercilessly axed for the Roman script hook routines. The Roman
; package hooks do absolutely nothing. And they enjoy it.
; 8/27/86 MED Fixed extension bar.
; 8/24/86 MED Broke out from Intl, using $$Resource.
;
;___________________________________________________________________________________________________
; new includes <15>
include 'Script.a'
include 'IntlResourcesPriv.a'
; old includes:
;; load 'StandardEqu.d'
;; include 'ScriptPriv.a'
string asis
proc
HookDispatch
dc.w itl2InitHook - HookDispatch ; (0) initHook
dc.w itl2FetchHook - HookDispatch ; (2) fetchHook
dc.w itl2VernierHook - HookDispatch ; (4) vernierHook
dc.w itl2ProjectHook - HookDispatch ; (6) projectHook
dc.w -1 ; (8) flag for new tables
dc.w itl2Rsvd2Hook - HookDispatch ; (10) exitHook (in ScriptEqu.a)
; -----------------------------------------------------------------------------
; Additional offsets for CharType/Transliterate/FindWord tables
; -----------------------------------------------------------------------------
dc.w TypeList - HookDispatch ; (12)
dc.w ClassArray - HookDispatch ; (14)
dc.w UpperList - HookDispatch ; (16)
dc.w LowerList - HookDispatch ; (18)
dc.w UpperNoMarkList - HookDispatch ; (20)
dc.w WordTable - HookDispatch ; (22)
dc.w WrapTable - HookDispatch ; (24)
dc.w NoMarkList - HookDispatch ; (26) <change to NoMarkList <03/29/89 pke>
dc.w $200 ; (28) version number <04/12/89 pke>
dc.w 1 ; (30) format #: 1 => header extensions exist <8>
dc.w 0 ; (32) reserved for initHookLen
dc.w 0 ; (34) reserved for fetchHookLen
dc.w 0 ; (36) reserved for vernierHookLen
dc.w 0 ; (38) reserved for projectHookLen
dc.w 0 ; (40) reserved
dc.w 0 ; (42) reserved for exitHookLen
dc.w 0 ; (44) reserved for typeListLen
dc.w 0 ; (46) reserved for classArrayLen
dc.w 0 ; (48) reserved for upperListLen
dc.w 0 ; (50) reserved for lowerListLen
dc.w 0 ; (52) reserved for upperNoMarkListLen
dc.w WordTableEnd - WordTable ; (54) wordTableLen
dc.w WrapTableEnd - WrapTable ; (56) wrapTableLen
dc.w 0 ; (58) reserved for noMarkListLen
dc.w 0 ; (60) reserved for FindScriptTableOffset <4>
dc.w 0 ; (62) reserved for FindScriptTableLen <4>
; -----------------------------------------------------------------------------
; Routine: InitHook
; Input: x(a6) Local frame variables.
; Output: none.
; Warning: Follows Pascal register conventions.
;
; Initialize any special stuff for the international hooks.
; -----------------------------------------------------------------------------
itl2InitHook
rts ; return to the caller.
; -----------------------------------------------------------------------------
; Routine: FetchHook
; Input: a2.l String Data Structure.
; a3.l String pointer (one past fetched character).
; d5.b 1 if string is empty, otherwise 0.
; d4.w Top byte is fetched character.
; Output: d4.w Top byte set to character, bottom to extension.
; d5.B 1 if string is empty, otherwise 0.
; Warning: Follows Pascal register conventions.
;
; Adds an extension byte to the character if necessary. This is used for
; double byte characters or in preparation for projection of two characters
; into one.
; -----------------------------------------------------------------------------
itl2FetchHook
rts ; return to the caller.
; -----------------------------------------------------------------------------
; Routine: VernierHook
; Input: d4.b High byte of character.
; d5.b Low byte of character.
; Output: d4.b High byte of character.
; d5.b Low byte of character.
; cc NE if we should skip standard Vernier.
; Warning: Follows Pascal register conventions.
;
; Modifies the character in either d4 or d5 to establish the relationship
; between two characters that are weakly equal.
; -----------------------------------------------------------------------------
itl2VernierHook
move.l #0,d0 ; use standard Vernier.
rts ; return to the caller.
; -----------------------------------------------------------------------------
; Routine: ProjectHook
; Input: a2.l String data structure.
; d4.w Top byte set to character, bottom to extension.
; Output: d4.w Projected character.
; cc NE to skip normal Vernier.
; Warning: Follows Pascal register conventions.
;
; Combines a character and its extension into a single character.
; -----------------------------------------------------------------------------
itl2ProjectHook
move.l #0,d0 ; use standard Vernier.
rts ; return to the caller.
; -----------------------------------------------------------------------------
; Routine: Rsvd2Hook
; Input: none.
; Output: none.
; Warning: Follows Pascal register conventions.
;
; Mark has not decided what this hook does yet.
; -----------------------------------------------------------------------------
itl2Rsvd2Hook
rts ; return to the caller.
; SetClass & DumpCharTable macros moved to IntlResourcesPriv.a <15>
; ==========================================================================================
; The first element of each row is the type byte. Format is as follows:
;
; bits 0-3: char type; 0=punct, 1=ASCII, 7=European, 8=bidirect
; if bidirect script
; bits 4-5: sub-type (for punct); 0=normal, 1=number, 2=symbol, 3=blank
; bit 6 (mask $40): 1=> right-left character
; else
; bits 4-6: sub-type (for punct); 0=normal, 1=number, 2=symbol, 3=blank
; bit 7 (mask $80): 1 => uppercase
; type, case+strip delta, case delta, strip delta, list...
lastClass: set 0
SetClass $20,0,0,0,(0,255) ; default: punct,symbol
SetClass $30,0,0,0,$00,$09,$0D,$20 ; spaces: punct,blank
SetClass $00,0,0,0, '!', '"', '''', '(' ,')', ',', '-', '.', '/', ':', ';', '?', \
'[', ']', '{', '}', '<27>', '<27>', '<27>', '<27>', '<27>', '<27>', '<27>', '<27>' \
; punct,normal
SetClass $10,0,0,0,('0','9') ; punct,number
SetClass $81,'a','a','A',('A','Z') ; upper letter
SetClass $01,'A','A','a',('a','z') ; lower letter
SetClass $07,0,0,0,('<27>','<27>'),'<27>' ; default European
; removed diacritics from the case+strip delta in lower-case chars below <03/12/89 pke>
SetClass $87,'a','<27>','A','<27>'
SetClass $87,'a','<27>','A','<27>'
SetClass $87,'c','<27>','C','<27>'
SetClass $87,'e','<27>','E','<27>'
SetClass $87,'n','<27>','N','<27>'
SetClass $87,'o','<27>','O','<27>'
SetClass $87,'u','<27>','U','<27>'
SetClass $87,'<27>','<27>','<27>','<27>'
SetClass $87,'o','<27>','O','<27>' ; separated for special handling <03/12/89 pke>
SetClass $87,'<27>','<27>','<27>','<27>'
SetClass $87,'a','<27>','A','<27>'
SetClass $87,'a','<27>','A','<27>'
SetClass $87,'o','<27>','O','<27>'
SetClass $07,'A','<27>','a','<27>'
SetClass $07,'A','<27>','a','<27>'
SetClass $07,'C','<27>','c','<27>'
SetClass $07,'E','<27>','e','<27>'
SetClass $07,'N','<27>','n','<27>'
SetClass $07,'O','<27>','o','<27>'
SetClass $07,'U','<27>','u','<27>'
SetClass $07,'<27>','<27>','<27>','<27>'
SetClass $07,'O','<27>','o','<27>' ; separated for special handling <03/12/89 pke>
SetClass $07,'<27>','<27>','<27>','<27>'
SetClass $07,'A','<27>','a','<27>'
SetClass $07,'A','<27>','a','<27>'
SetClass $07,'O','<27>','o','<27>'
;<7/12/88ldc> extensions to Macintosh character set
SetClass $87,'y','<27>','Y',diaeresisUprY ; <20>
SetClass $87,'a','<27>','A',circumflexUprA ; <20>
SetClass $87,'e','<27>','E',circumflexUprE ; <20>
SetClass $87,'a','<27>','A',acuteUprA ; <20>
SetClass $87,'e','<27>','E',diaeresisUprE ; <20>
SetClass $87,'e','<27>','E',graveUprE ; <20>
SetClass $87,'i','<27>','I',acuteUprI ; <20>
SetClass $87,'i','<27>','I',circumflexUprI ; <20>
SetClass $87,'i','<27>','I',diaeresisUprI ; <20>
SetClass $87,'i','<27>','I',graveUprI ; <20>
SetClass $87,'o','<27>','O',acuteUprO ; <20>
SetClass $87,'o','<27>','O',circumflexUprO ; <20>
SetClass $87,'o','<27>','O',graveUprO ; <20>
SetClass $87,'u','<27>','U',acuteUprU ; <20>
SetClass $87,'u','<27>','U',circumflexUprU ; <20>
SetClass $87,'u','<27>','U',graveUprU ; <20>
;<7/12/88ldc> more extensions
SetClass $07,'Y',diaeresisUprY, 'y','<27>'
SetClass $07,'A',circumflexUprA, 'a','<27>'
SetClass $07,'E',circumflexUprE, 'e','<27>'
SetClass $07,'A',acuteUprA, 'a','<27>'
SetClass $07,'E',diaeresisUprE, 'e','<27>'
SetClass $07,'E',graveUprE, 'e','<27>'
SetClass $07,'I',acuteUprI, 'i','<27>'
SetClass $07,'I',circumflexUprI, 'i','<27>'
SetClass $07,'I',diaeresisUprI, 'i','<27>'
SetClass $07,'I',graveUprI, 'i','<27>'
SetClass $07,'O',acuteUprO, 'o','<27>'
SetClass $07,'O',circumflexUprO, 'o','<27>'
SetClass $07,'O',graveUprO, 'o','<27>'
SetClass $07,'U',acuteUprU, 'u','<27>'
SetClass $07,'U',circumflexUprU, 'u','<27>'
SetClass $07,'U',graveUprU, 'u','<27>'
SetClass $07,'I','I', 'i',dotlessLwrI
SetClass $07,'<27>','<27>','<27>','<27>' ; <03/05/89 pke>
; Note: the following are not specifically European, but they're not ASCII either.
; Sigh. Call them European for now.
SetClass $07,'<27>','<27>','<27>','<27>' ; <03/10/89 pke>
SetClass $07,'<27>','<27>','<27>','<27>' ; <03/10/89 pke>
ClassArray:
DumpCharTable 0
TypeList:
DumpCharTable 1
UpperList
DumpCharTable 2
LowerList
DumpCharTable 3
UpperNoMarkList
DumpCharTable 4
NoMarkList
DumpCharTable 5 ; make this 5 now, since there is no LowerNoMarkList <15>
; ****************************************************************************
; FINDWORD STUFF
; ****************************************************************************
; SetByte & SetRow macros moved to IntlResourcesPriv.a <15>
; -----------------------------------------------------------------------------
; There are two sets of tables here, one for word select and one for word wrap.
; FindWord needs a pointer to the appropriate table, or 0 or -1 to select the
; default select or wrap tables.
;
; Each set of tables begins with a 256-byte array which assigns a character
; type to each code in the Macintosh. This is followed by a table of tuples
; indicating which character combinations should not be split; this table
; begins with a length word.
; -----------------------------------------------------------------------------
; ****************************************************************************
; FINDWORD - WORD SELECT TABLE (new format)
; ****************************************************************************
;-----------------------------------------------------------------------------
; Class definitions.
;
; Values must be assigned sequentially, beginning at 0 (which must be the
; break class). NumClass must be set to the number of classes.
;-----------------------------------------------------------------------------
WordClass record 0
break ds.b 1 ; always breaks (must be present as first item)
nonbreak ds.b 1 ; non-breaking space.
letter ds.b 1 ; letters.
number ds.b 1 ; digits.
midLetter ds.b 1 ; a'a.
midLetNum ds.b 1 ; a'a 1'1.
preNum ds.b 1 ; $, etc.
postNum ds.b 1 ; %, etc.
midNum ds.b 1 ; 1,1.
preMidNum ds.b 1 ; .1234.
blank ds.b 1 ; spaces and tabs.
cr ds.b 1 ; add carriage return <7/31/87med>
;wild ds.b 1 ; anything goes.
NumClass set *
endr
;-----------------------------------------------------------------------------
; Main index (rearranged <1.8>)
;-----------------------------------------------------------------------------
align 2
WordTable
dc.b $80 ; Flags1 (must be negative to indicate new format)
dc.b 0 ; Flags2 (if non-zero, there may be 2-byte chars)
dc.w 0 ; Version
dc.w wdClassTable - WordTable
dc.w wdAuxCTable - WordTable
dc.w wdBackwdTable - WordTable
dc.w wdForwdTable - WordTable
dc.w 6 ; doBackupOffset (if offset < this, go forward from
; beginning instead of backing up)
dc.w WordTableEnd - WordTable ; length <1.8><9>
;-----------------------------------------------------------------------------
; Base class table
;
; The ClassTable is 256 bytes of character types, as defined above. It is
; indexed by the character's ascii code.
;-----------------------------------------------------------------------------
wdClassTable
With WordClass
dcb.b 256,break
setByte wdClassTable,nonBreak,$ca
setByte wdClassTable,letter,('A','Z'),('a','z'),('<27>','<27>') ; fixed <20> bug <6/6/88med>
setByte wdClassTable,letter,'<27>','<27>','<27>','<27>',('<27>','<27>'),'<27>'
setByte wdClassTable,letter,diaeresisUprY ; <7/18/88ldc>
setByte wdClassTable,letter,fiLigature,flLigature ; <7/18/88ldc>
setByte wdClassTable,letter,(circumflexUprA,circumflexUprO) ; <7/18/88ldc>
setByte wdClassTable,letter,(graveUprO,dotlessLwrI) ; <7/18/88ldc>
setByte wdClassTable,letter,'<27>' ; <03/05/89 pke>
setByte wdClassTable,letter,(circumflex, ringMark) ; <7/18/88ldc><11>
setByte wdClassTable,letter,(cedilla, hachek) ; <7/18/88ldc>
setByte wdClassTable,midLetter,'-'
setByte wdClassTable,midLetNum,$27,'<27>'
setByte wdClassTable,number,('0','9')
setByte wdClassTable,preNum,'$','<27>','<27>',intlCurrency ; <7/18/88ldc> <14>
setByte wdClassTable,postNum,'%','<27>', perThousand ; <7/18/88ldc> <14>
setByte wdClassTable,midNum,',',fraction ; <7/18/88ldc>
setByte wdClassTable,preMidNum,'.'
; setByte wdClassTable,blank,' ',$09,$0D
setByte wdClassTable,blank,$00,' ',$09 ; removed cr, added null <7/31/87med>
setByte wdClassTable,cr,$0d ; cr only on end of white-space <7/31/87med>
EndWith
;-----------------------------------------------------------------------------
; Auxiliary class tables index
;-----------------------------------------------------------------------------
align 2
wdAuxCTable
dc.w WordClass.break ; not used for roman
;-----------------------------------------------------------------------------
; Transition table index for backward processing
;-----------------------------------------------------------------------------
align 2
wdBackwdTable
NState set 12 ; Highest-numbered state <10>
NClass set WordClass.NumClass
dcb.w NState+1, 0 ; Add 1 for exit state (0)
;-----------------------------------------------------------------------------
; Transition table for backward processing
;
; NOTE: in following table, first row must be all non-zero values with '*'
;-----------------------------------------------------------------------------
; brk nBr let num mLe mLN prN poN mNu pMN blk cr
SetRow wdBackwdTable,1, *6, *9, *2, *3, *4, *5, *6, *7, *7, *5, *8, *8 ; <10>
SetRow wdBackwdTable,2, 0,*10, *2, *3, 4, 4, 0, 0, 0, 4, 0, 0 ; <10>
SetRow wdBackwdTable,3, 0,*10, *2, *3, 0, 7, *6, 0, 7, *7, 0, 0 ; <3><10><12> use *6 for prN
SetRow wdBackwdTable,4, 0,*10, *2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; <10>
SetRow wdBackwdTable,5, 0,*10, *2, *3, 0, 0, 0, 0, 0, 0, 0, 0 ; <10>
SetRow wdBackwdTable,6, 0,*10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; <10>
SetRow wdBackwdTable,7, 0,*10, 0, *3, 0, 0, 0, 0, 0, 0, 0, 0 ; <10>
SetRow wdBackwdTable,8, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, *8, *0 ; <10>
SetRow wdBackwdTable,9, *6, *9, *2, *3, *4, *5, *6, *7, *7, *5, *8, 0 ; <10>
SetRow wdBackwdTable,10, *6,*10, *2, *3, *4, *5, *6, *7, *7, *5, 0, 0 ; <10>
;-----------------------------------------------------------------------------
; Transition table index for forward processing
;-----------------------------------------------------------------------------
align 2
wdForwdTable
NState set 11 ; Highest-numbered state <10>
NClass set WordClass.NumClass
dcb.w NState+1, 0 ; Add 1 for exit state (0)
;-----------------------------------------------------------------------------
; Transition table for forward processing
;
; NOTE: in following table, first row must be all non-zero values with '*'
;-----------------------------------------------------------------------------
; brk nBr let num mLe mLN prN poN mNu pMN blk cr
SetRow wdForwdTable,1, *4, *1, *2, *3, *4, *4, *5, *4, *4, *5, *6,*10 ; <10>
SetRow wdForwdTable,2, *0, *8, *2, *3, *7, *7, *0, *0, *0, *7, *0, *0 ; <3>
SetRow wdForwdTable,3, *0, *8, *2, *3, *0, *9, *0, *4, *9, *9, *0, *0
SetRow wdForwdTable,4, *0, *8, *0, *0, *0, *0, *0, *0, *0, *0, *0, *0
SetRow wdForwdTable,5, *0, *8, *0, *3, *0, *0, *0, *0, *0, *0, *0, *0
SetRow wdForwdTable,6, *0,*11, *0, *0, *0, *0, *0, *0, *0, *0, *6,*10 ; <10>
SetRow wdForwdTable,7, 0, 0, *2, 0, 0, 0, 0, 0, 0, 0, 0, 0
SetRow wdForwdTable,8, *4, *8, *2, *3, *4, *4, *5, *4, *4, *5, *0, *0 ; <10>
SetRow wdForwdTable,9, 0, 0, 0, *3, 0, 0, 0, 0, 0, 0, 0, 0
SetRow wdForwdTable,10, *0, *0, *0, *0, *0, *0, *0, *0, *0, *0, *0, *0 ; <10>
SetRow wdForwdTable,11, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, *6,*10 ; <10>
;-----------------------------------------------------------------------------
WordTableEnd ; <2.3>
; ****************************************************************************
; FINDWORD - WORD WRAP TABLE (new format)
; ****************************************************************************
;-----------------------------------------------------------------------------
; Class definitions.
;
; Values must be assigned sequentially, beginning at 0 (which must be the
; break class). NumClass must be set to the number of classes.
;-----------------------------------------------------------------------------
WrapClass record 0
break ds.b 1 ; always breaks (must be present as first item)
nonBreak ds.b 1 ; non-breaking space.
blank ds.b 1 ; spaces and tabs.
cr ds.b 1 ; add carriage return <7/31/87med>
nonBlank ds.b 1 ; most everything else.
op ds.b 1 ; hyphen, plus, etc.
;wild ds.b 1 ; constant! anything goes.
NumClass set *
endr
;-----------------------------------------------------------------------------
; Main index (rearranged <1.8>)
;-----------------------------------------------------------------------------
align 2
WrapTable
dc.b $80 ; Flags1 (must be negative to indicate new format)
dc.b 0 ; Flags2 (if non-zero, there may be 2-byte chars)
dc.w 0 ; Version
dc.w wrClassTable - WrapTable
dc.w wrAuxCTable - WrapTable
dc.w wrBackwdTable - WrapTable
dc.w wrForwdTable - WrapTable
dc.w 6 ; doBackupOffset (if offset < this, go forward from
; beginning instead of backing up)
dc.w WrapTableEnd - WrapTable ; reserved <1.8><9>
;-----------------------------------------------------------------------------
; Base class table
;
; The ClassTable is 256 bytes of character types, as defined above. It is
; indexed by the character's ascii code.
;-----------------------------------------------------------------------------
wrClassTable
With WrapClass
dcb.b 256,nonBlank
setByte wrClassTable,nonBreak,$ca
; setByte wrClassTable,blank,' ',$09,$0D
setByte wrClassTable,blank,$00,' ',$09 ; removed cr, added null <7/31/87med>
setByte wrClassTable,cr,$0d ; cr only on end of white-space <7/31/87med>
setByte wrClassTable,op,'-','<27>','<27>','+','<27>','*','/','<27>'
setByte wrClassTable,op,'=','<27>','<27>','>','<','<27>','<27>'
setByte wrClassTable,op,$26,'|','^','\'
EndWith
;-----------------------------------------------------------------------------
; Auxiliary class tables index
;-----------------------------------------------------------------------------
align 2
wrAuxCTable
dc.w WrapClass.break ; not used for roman
;-----------------------------------------------------------------------------
; Transition table index for backward processing
;-----------------------------------------------------------------------------
align 2
wrBackwdTable
NState set 6 ; <10>
NClass set WrapClass.NumClass
dcb.w NState+1, 0 ; Add 1 for exit state (0)
;-----------------------------------------------------------------------------
; Transition table for backward processing
;
; NOTE: in following table, first row must be all non-zero values with '*'
;-----------------------------------------------------------------------------
; brk nBr bl cr nBl op
SetRow wrBackwdTable,1, *4, *5, *2, *2, *3, *3 ; <10>
SetRow wrBackwdTable,2, 0, 2, *2, *0, 0, 0 ; <10>
SetRow wrBackwdTable,3, 0, *6, 0, 0, *3, 0 ; <10>
SetRow wrBackwdTable,4, 0, *6, 0, 0, 0, 0 ; <10>
SetRow wrBackwdTable,5, *4, *5, *2, 0, *3, *3 ; <10>
SetRow wrBackwdTable,6, *4, *6, 0, 0, *3, *3 ; <10>
;-----------------------------------------------------------------------------
; Transition table index for forward processing
;-----------------------------------------------------------------------------
align 2
wrForwdTable
NState set 7 ; <10>
NClass set WrapClass.NumClass
dcb.w NState+1, 0 ; Add 1 for exit state (0)
;-----------------------------------------------------------------------------
; Transition table for forward processing
;
; NOTE: in following table, first row must be all non-zero values with '*'
;-----------------------------------------------------------------------------
; brk nBr bl cr nBl op
SetRow wrForwdTable,1, *4, *1, *2, *6, *3, *4 ; <10>
SetRow wrForwdTable,2, *0, *7, *2, *6, *0, *0 ; <10>
SetRow wrForwdTable,3, *0, *5, *0, *0, *3, *4
SetRow wrForwdTable,4, *0, *5, *0, *0, *0, *0
SetRow wrForwdTable,5, *4, *5, *0, *0, *3, *4
SetRow wrForwdTable,6, *0, *0, *0, *0, *0, *0 ; <10>
SetRow wrForwdTable,7, 0, 7, *2, *6, 0, 0 ; <10>
;-----------------------------------------------------------------------------
WrapTableEnd ; <2.3>
endproc
end