`Us0o5552982A
`
`P
`
`United States Patent
`
`[19]
`
`[11] Patent Number:
`
`5,552,982
`
`Jackson et al.
`[45] Date of Patent:
`Sep. 3, 1996
`
`[54] METHOD AND SYSTEM FOR PROCESSING
`FIELDS IN A DOCUMENT PROCESSOR
`
`£75]
`
`Inventors: Peter C. Jackson, Seattle; William H.
`Gates, III, Redmond; Bryan
`Loofbourrow, Seattle, all of Wash.
`
`[73] Assignee: Microsoft Corporation, Redmond,
`Wash.
`
`[21] App}. No.: 205,141
`
`[22] Filed:
`
`Feb. 23, 1994
`
`“Numeric Processor and Text Manipulator for the ‘Master
`Contro‘ Data Base Management System", Energy Research
`& Den‘t Admin. Feb. 1976.
`
`“Using Microsoft Word" Version 3 ©1983, 1985, 1986. pp.
`259-273.
`
`“Switch" definition. Microsofl‘ Pre.s.s—Compttfer Dictionary,
`second edition, copyright 1994, p. 373.
`
`“Switch" and Switch Code definitions, Dictionary of Com-
`puters, Information Processing, and Telecommunications,
`second edition. copyright 1984, pp. 617-618.
`
`Related U.S. Application Data
`
`Primary Examiner—Rohert A. Weinhardt
`Attorney, Agent, or F:'rm-Seed and Berry LLP
`
`[63] Continuation of Ser. No. 694,001, Apr. 30. I991, abandoned,
`which is a continuation of Scr. No. 607,372, Oct. 31. I990,
`abandoned.
`
`
`
`Int. Cl.°
`[51]
`[52] U.S. Cl.
`
`G06F 17122
`364f419.1; 364;‘4l9.1’.-';
`3953145
`364!419.19, 419.14,
`[58] Field of Search
`364J419.l7, 419.1; 3951146, 600, 147,
`148, 145
`
`[56]
`
`References Cited
`
`U.S. PATENT DOCUMENTS
`
`4,965,763 l0!l990 Zamora .............................. 364.-9119.19
`. . . . .. 3951147
`5,025,396
`611991 Parks ct al.
`. . . . . . .
`
`.................... .. 3951046
`5,143,366
`9.3992 Buchanan et a1.
`
`OTHER PUBLICATIONS
`
`"Using Microsoft Word", Word Processing Program Version
`3.0 ©Microsoft Corporation '86. pp. 259-273.
`"Parallel Computations on Strings & Arrays", Crochemore
`et al @1990 Springer—Verlag, Germany.
`
`[57]
`
`ABSTRACT
`
`A method and system for providing calculated fields in a
`document processing environment. A calculated field com-
`prises a beginning field character. a field code, and an ending
`field character. The field oodc specifies a behavior of the
`calculated field. A user may insert a calculated field into a
`document. After insertion, the result of the calculated field
`can be determined based on the behavior specified by the
`field code. The result of the calculated field is then stored
`within the document and preferably within the calculated
`field. ‘The document can be displayed in either field code or
`results mode. In field code mode, when the document is
`displayed. the calculated field is displayed (i.e., beginning
`field character, field code. and ending field character}. In
`results mode, when the document is displayed, the result is
`displayed, rather than the calculated field.
`
`27 Claims, 15 Drawing Sheets
`
`Microsultwutd IHMLIILDDIZ
`
` |=I Elle
`
`Edit
`
`\_t‘iew
`_InIerl
`10-4
`{data dmtdoe no} {date}
`
`Formal Qlililies Llano flindow
`
`
`
`
`/(’108
`{reffiIstmme}{reflas1na‘me}
`{ref address}
`{ref eiiy}.{ref state} [ref zip} 106
`Dear liflille <> "" "(reflil }‘ "{reffitstnnm.e}'|{teflastname}:
`
`Our record iruiieate fnalyou sawthe movie Kfitffon several weeks ago altha [ref screen} in {ref
`scraancily}. Ware dotngihe followup study about the rum and would appreciate your cooparagon)
`infilling outthe enclosed form.
`102
`The questionnaire will take some fans to complete, butwa really do want you in,p1.n—so as an
`incentive for answering the questions and utailinglhe form back, we're prepared to offer you
`sontetlting in return. Upon receipt of you queslionnair e, we will sent you two eotnplitnentary
`liekets to ?Z-rnejltys riftibrrragg ll1eIong-awaited British epic starring Hunter Davis.
`
`1 Q2
`
`I look forward to hearing from you.
`
`MS 1014
`
`MS 1014
`
`1
`
`
`
`U.S. Patent
`
`Sep.3,1996
`
`Sheet 1 of 15
`
`5,552,982
`
`Figure 1A
`
`.
`
`Microeon Word - FRMLTRDOC
`
`=|
`
`Format Qtilitics
`
`flacro flindeuf
`
`
`
`file Edit Eiew lnsefl
`104
`{data datadoe oc} {date}
`108
`
`
`
`
`
`{ref firstname} {ref lastname}
`{ref address}
`{ref city},{ref state} {ref zip] 106
`
`Dear {if title C) "" "{ref tit e}' "{reffirstname}'}{re€lastname}:
`
`Our record indicate that you saw the movie FFZ'r:.rfz7n several weeks ago at the {ref screen} in {ref
`screentity}. We're doing the followup study about the mm and would appreciate your cooperation
`
`infflling outthe enclosed form.
`
`qag
`
`The questionnaire wfll take some time to complete, but we reaiiy do want you input-so as an
`incentive for answeringthe questions and mating the form back, we're prepared to offer you
`something in r ettrm. Upon receipt of you questionnaire, we will sent you two complimentary
`tickets to 7?1reeIJd}r.rpf€1?r:regg
`the long-awaited British epic starring Hunter Davis.
`
`102
`
`I look forward to hearing from you.
`
`Sincerely,
`
`2
`
`
`
`U.S. Patent
`
`Sep.3,1996
`
`Sheet 2 of 15
`
`5,552,982
`
`Figure 1B
`
`-
`
`Microsoft Word - FFIMl.TFl.DOC
`
`insert
`
`Formal;
`
`Lltilitics Ljacro
`
`flindow "
`
`a Elle Edit Eleni
`f1o4
`January 19, 1939
`
`/'1U8
`Katherine Howe
`4l22 E. Winslow
`Seattle,WA 53123
`
`Dear Katherine Howe:
`
`Our record indicate that you saw the movie F4‘-"f:zrra17 several weeks ago at the Cinema}: Theater in
`Bellevue. We're doingthe fellowup study about the film and would appreciate your cooperationg
`infilling outthe enciosed form.
`1 U2
`
`The questionnaire will take some time to complete, hutwe really do want you input—-so as an
`incentive for answering the questions and mailing the form back, we're prepared to offer you
`something in return. Upon receipt of you questionnaire, we will sent you two complimentary
`tickets to Fbreeflgiyr al'£Ib:.rr¢g'e.
`the long-awaited British epic starring Hunter Davis.
`
`102
`
`I look forward to he aring from you.
`
`3
`
`
`
`U.S. Patent
`
`Sep.3,199fi
`
`Sheet 3 of 15
`
`5,552,982
`
`FCaIcF:elds
`
`the user
`
`does not interrupt
`and the current field
`
`is in the
`
`tango?
`
`Call
`
`FCaIcfie|d|fId
`
`203 Update ffietum
`
`210
`
`Position at
`
`end of field
`
`212
`
`Select next
`
`field
`
`4
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`&meet 4 of 15
`
`5,552,982
`
`FCa|cF|e|d|f|d
`
` Call
`FCalcFi6|d|l|d
`
`
`
`Position at
`and of
`nastad field -
`
`
`
`
`
`Position at
`beginning
`at result
`
`Insert separator
`if not
`alread axistin 9
`
`5
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 5 of 15
`
`5,552,982
`
`Cal[CaicFunc
`
` Initialize
`
`field fetch
`block
`
`
`412
`
`
`
`Call
`
`
`
`field specific
`function
`
`
` Call
`
`FetchFromField
`
`
`
`fcrNon'nal or
`fcrhlurneric or
`fcroatefime
`
`
`
`
`
` Call
`DcpAppiv-
`Sysswitches
`41 6
`
`H
`
`
`6
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 6 of 15
`
`5,552,982
`
`Document
`
`CP
`
`34
`
`48
`
`58 60
`
`73
`
`78
`
`. . .{ref firsinarne|Kafl1erine}
`
`{ref Iastnama|Hcwe}. .
`
`.
`
`dnftt
`
`EFLT structures
`
`FcrCaIcFrtBkmkRef
`
`I
`
`array of general field types
`
`array of structutes describing specific field instances
`
`array of indicas into document
`
`Figure 5
`
`7
`
`
`
`U
`
`f.HBtaP
`
`69H
`
`EEl.07mhS
`
`255,5
`
`m
`
`3,Q95%....‘
`
`ams._...§:9_..._&&n
`
`J~_u$3ooEW.33S.0»E:9.5..
`
`¢._<
`
`22:
`
`$5a¢£o._.3n
`
`.93:23.
`
`oammmo»:8
`
`8
`
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 3 of 15
`
`5,552,982
`
`ChFetc_hSwitc.h
`
`increrne nl
`
`awitchcountar
`
` 702
`
`Is
`
`
`
`awitchcounter
`
`«a number of
`
`switches
`
`
`
`
`
`Is rgcp
`[switchcounter]
`
`FQGP
`[switchcounter]
`
`
`
`
`
` 714
`
`Return switch
`
`char !,*.#.@
`
`Figure 7
`
`9
`
`
`
`m9.=u..m
`
`am_oE.on§&<&o
`
` US.Patent
`
`Sep.3,1996
`
`«E
`
`Eaton.
`
`10
`
`Sheet9of15
`
`
`
`E.2u:E.eueo
`
`in
`
`
`
`
`aim.to:.32:2fin.u=_fiEa_.3238
`
`
`conic:%..a=oL__.a:mE6.209922walnut
`
`GB00
`
`5,552,982
`
`Tu.m“._:omE.£
`
`.5
`
`10
`
`
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 10 of 15
`
`5,552,982
`
`DcpA.ppIyPictureSw
`
`902
`
`Call
`FetchFrornFreld
`
`' 904
`
`906
`
`
`
`Insert error
`
`N
`
`Return
`
`Y
`
`
`
`Get numeric
`795"“
`
`
`
`912
`
`
`
`
`Is
`new msugt
`numeric?
`
`914
`
`917
`
`Parse
`result
`
`Format
`resuft
`
`-u
`
`11
`
`11
`
`
`
`U.S. Patent
`
`Sep.3,1996
`
`Sheet 11 of 15
`
`5,552,982
`
`ForrnatLlna
`
`1002
`
`Fetch
`characters
`
`1008
`
`Save cp
`& character
`
` 591 character
`proparty bold
`to ON
`
`1012
`
`
`
`
` Create a
`charachier for
`
`skipped text
`
`' Tma
`
`1024
`
`‘Handle any
`hidden text
`
`1026
`
`Handle any
`normal lax!
`
`1028
`
`
`
`End
`0! line
`
`Y
`
`1 01 9
`
`Incren1ent
`cpNexl
`
`Figure 1 0
`
`12
`
`12
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 12 of 15
`
`5,552,982
`
`FfcForrnalFieldPdcp
`
`1 102
`
`Set ffcfiaturn
`
`to default
`
`
`
`
`1 1 04
`
`Get field
`
`composite
`
`descriptor
`
`1108
`
`Call
`
`FItParsaDocCp
`
`
`
`
`FshowRasuIt-
`PflcdFvc
`
` Call
`DcpSkipFiald-
`
`Ch Pficd
`
`
`
`
`
`1 1 1 6
`
`Y
`
`ffcfiaturn
`
`1 1 1 4
`
`
`
`‘ = ffcshow
`
`Figure 1 1
`
`13
`
`13
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 13 of 15
`
`5,552,982
`
`FShowFiesurtPflcdFvc
`
`
`
`f = window
`
`Showfiesult
`
`state
`
`1206
`
`
`
`fF:arceFie|d
`IS on or
`Page View
`
`
`N
`
`
`update
`fa t
`9 "m
`
`is on‘?
`
`
`
`Figure 1 2
`
`14
`
`14
`
`
`
`f.HmP3U
`
`Sep. 3, 1996
`
`Sheet 14 of 15
`
`289.,255,5
`
`uo_E;ou.oE%_ma...n
`
`__..ofin._2_o
`
`§.amao..m_
`
`
`
`muna.5m.~..s
`
`§BmaEm.
`
`59.2unot
`
`E52.0
`
`15
`
`15
`
`
`
`
`U.S. Patent
`
`Sep. 3, 1996
`
`Sheet 15 of 15
`
`5,552,982
`
`FttParseDocCp
`
`
`
`Call
`FatchFromFie|d
`
`
`
`Look up keyword
`in keyword
`in table
`
`
`
`Showfiasult
`field?
`
`
`
`Toggle
`flcd.fDi'ffer
`bit
`
`Figure 14
`
`16
`
`
`
`Is
`
`this the
`window with
`the focus?
`
`16
`
`
`
`1
`MIE'I'HOD AND SYSTEM FOR PROCESSING
`FIELDS IN A DOCUMENT PROCESSOR
`
`CROSS—REFERENCE 'IlO RELATED
`APPLICATION
`
`This application is a continuation of U.S. patent applica-
`tion Ser. No. 013694.001, filed Apr. 30, 1991, now aban-
`doncd.
`
`FIELD OF THE INVENTION
`
`This invention relates to the field of document processors,
`and more particularly, to a method and system for allocating
`and displaying fields in a document processor.
`
`BACKGROUND OF THE INVENTION
`
`Document processors are a class of computer application
`programs which provide the ability to manipulate, display.
`and print text and graphics in a variety of formats. One
`example of a popular document processor program is the
`Microsoft Word document processor
`available
`front
`Microsoft Corporation. Typically, in most document proces-
`sors, text may be produced in a variety of fonts, sizes, styles,
`and paragraph formats. While a number of computer pro-
`grams provide similar capabilities, document processors
`provide flexibility and capabilities not found in other pro-
`grams.
`
`For example, in computer spreadsheet application pro-
`grams, text information or numerical data is identified with
`a particular cell which is positioned according to x—y coor-
`dinates in the spreadsheet. In this type of system, specific
`formatting irtforrnation is associated with individual cells.
`Thus, the data or text within the cells is easily associated
`with formatting information based on its relative position in
`the spreadsheet application.
`In contrast,
`in a document
`processor, text or graphic information may be placed in a
`document in a position which is dependent primarily on its
`position within a text string wherein its actual position
`within a document changes as text or graphic objects are
`added or deleted from the text string.
`Since character positions are variable within a document
`processed by a document processor, it is extremely difiicult
`to provide fields within such a document. Fields are similar
`to the formula in cells provided in a spreadsheet application
`program wherein the contents of a field may be dependent on
`the mathematical relationship between a plurality of other
`values.
`
`SUMMARY AND OBJECTS OF THE
`INVENTION
`
`In surntnary, the present invention contemplates a method
`and system for providing fields in a document processing
`environment wherein fields may be included within a stream
`of text. Fields are processed by a single generic field
`handling mechanism which invokes field-specific functions.
`Fields are delineated with unique beginning and ending field
`characters, which enclose a field keyword as well as field
`arguments. The keyword of a field determines the type of the
`field. When a field is encountered in a document,
`the
`keyword and arguments are parsed and field-specific func~
`tions are invoked through a look-up table that is indexed by
`the keyword. Field results are generated based on field
`arguments. The present invention provides a means whereby
`fields may be displayed in a result mode or field code mode.
`In addition, arguments of one field may be generated from
`the result of another field.
`
`5,552,982
`
`2
`
`Accordingly, it is an object of the present invention to
`provide an improved method and system for processing
`documents providing a single mechanism for handling all
`types of fields.
`It is another object of the present invention to provide an
`improved method and system for generating field results and
`inserting field results in fields.
`It is another object of the present invention to provide a
`document processor system wherein a variety of field types
`may be added to the system or the functioning of existing
`field modified without altering the basic mechanism for
`handling fields.
`It is still another object of the present invention to provide
`a rnedrod and system for implementing nested fields In a
`document processing environment.
`It is still another object of the present invention for
`applying general switches to the result of a field in a
`document processor system.
`It is yet another object of the present invention to provide
`a method and system for determining the portion of field to
`be displayed and for adjusting a page layout in a document
`processor accordingly.
`
`BRIEF DESCRIPTION OF THE DRAWINGS
`
`These and other objects will be apparent from the descrip~
`tion below and the accompanying drawings in which:
`FIGS. 1A and 1B are diagrams of displays showing
`documents having fields of the type processed by the present
`invention.
`
`30
`
`FIG. 2 is a flow diagram of the FCa1cFieIds routine used
`to update a field whenever invoked manually by the user or
`autornatically by the system.
`FIG. 3 is a flow diagram of the FCalcFie1dIfld routine
`used to generate the result of a field.
`FIG. 4 is a flow diagram of the CallCalcFune routine
`called by the routine of FIG. 3.
`FIG. 5 is a diagram showing the organization of the data
`structures used to implement the present invention.
`FIG. 6 is a flow diagram of the DcpApplySysSwitches
`routine called by the routine of FIG. 4.
`FIG. 7 is a flow diagram of the ChFetchSvviteh routine.
`FIG. 8 is a How diagram of the DcpApplyFormatSw
`routine called by the routine of FIG. 6.
`FIG. 9 is a flow diagram of the DepApplyPietureSw
`routine called by the routine of FIG. 6.
`FIG. 10 is a flow diagram of the ForrnatLine routine used
`to update display devices while using the present invention.
`FIG. 1] is a flow diagram of the FfcFormatFieldPdcp
`routine called by the routine of FIG. 10.
`FIG. 12 is a flow diagram of the FShowResultPtlcdFvc
`routine called by the routine of FIG. 11.
`FIG. 13 is a flow diagram of the DcpSkipFieldChPflcd
`routine called by the routine of FIG. 11.
`FIG. 14 is a flow diagram of the FltPatseDoeCp routine
`used to fetch keyword text and return the field-specific
`function for the keyword.
`
`DETAILED DESCRIPTION OF THE
`INVENTION
`
`The present invention provides a method and system for
`use with a document processor application program which
`allows a user to insert “calculated text" or “fields” virlltally
`
`45
`
`50
`
`55
`
`17
`
`17
`
`
`
`5,552,982
`
`4
`switch, the result of the nested field will be used to evaluate
`the enclosing field.
`A field nested within field codes is treated as a single
`argument or switch, regardless of the presence of spaces or
`quotes in the result of the nested field. It is also considered
`to be exactly one argument, unless it is “grouped” by using
`quotes. For example, the nested fields
`
`{datelflime}
`
`are considered to be two arguments: the result of the date
`field and the result of the time field. Whereas, the nested
`fields
`
`“{dfll=}{tifl'H=}"
`
`are considered to be one argument-the concatenation of the
`date field and the result of the time field.
`
`Except inside quotes or to separate arguments, white
`space characters are always ignored in field codes. Thus, a
`field could be formatted as:
`
` I
`
`25
`
`l
`
`if appnarne = "Opus"
`‘This is the true text.”
`“This is the false text."
`
`3
`anywhere in a document. The present invention provides a
`single mechanism for handling all fields, wherein the spe-
`cific bchavior of a field is defined by a field specific
`algorithm that is invoked by the generic field mechanism
`This allows the generic field mechanism of the present
`invention to be incorporated in an application program
`without regard to the specific behavior of individual fields.
`In the context of the present invention, a “field" is defined
`as a placeholder object that is evaluated to produce a result.
`A “field” is used to implement generated objects such as
`page numbers, dates, or cross references. A field comprises
`a beginning field character, field codes, a separator field
`character, a field result, and an ending field character speci-
`fied according to the following syntax:
`
`{field eodeslresult}
`
`'I'he field codes in the above expression are typically
`entered in a text stream as ordinary text and may be edited
`or modified as any other character in the text stream. The
`beginning field character (‘T’), the ending field character
`(“}”}, the separator character {‘‘I’‘), and the result are gen-
`erated by the application. Fields are used in two modes: field
`code mode and result mode. In the field code mode, the
`beginning field character, the field codes, and the ending
`field character are displayed. In the result mode, only the
`result of the field codes is displayed. Field codes consist of
`a keyword that identifies the field type, field arguments of
`the field type, switches specific to the field type, and general
`switches, called “system switches.” A switch consists of a
`backslash character (“\"J, a single character switch identifier
`(e.g., “*”). and optionally a switch argument.
`The keyword of a field identifies the type of the field. If
`the keyword is not known, then the field is considered to bc
`a bookmark reference and the keyword is the bookmark
`name.
`
`A keyword may optionally be preceded by a backslash
`character (‘T’). If a keyword is not known and is preceded
`by a backslash, it will not be treated as a bookmark refer-
`ence. Rather, the field will have no result.
`Arguments, both field and switch, are words separated by
`one or more spaces. However, a space between a switch
`identifier and the switch argument is optional. A multj-word
`argument is obtained by surrounding it with quotes C‘). A
`quote can be placed within an argument by preceding it with
`a backslash character 0'') as shown below.
`Examples of arguments:
`
`Field Codes
`
`foo bar
`
`"foo bar"
`"foo \" bar"
`l"Joe\"
`“John \“Johnny\""
`'0: \“
`
`ab-c"def"ghi
`
`foo "" bar
`
`Arguments
`
`foo
`bar
`fun he:
`foo “ bar
`"Joe"
`John "Johnny"
`\
`
`she
`def
`ghi
`foo
`(empty string]
`bar
`
`In the preferred practice of the present invention. fields
`can be nested, up to a pre—sclectcd limit, such as twenty
`deep. The only restriction on nesting is that the keyword for
`a. field cannot be a nested field. Any argument can be a
`nested field. If there is a nested field in an argument or
`
`18
`
`A field may contain one or more switches. A switch
`indicates that behavior other than the default is desired for
`this field. System switches are defined for all fields. In
`addition, a field type may specify its own switches.
`A switch may be defined to take a switch argument. If so,
`the switch argument is immediately following the switch. A
`space between a switch and its switch argument that follows
`is optional. In one implementation, a field preferably can
`contain up to at
`least ten system and ten field specific
`switches. Additional switches will be ignored.
`If a backslash character in the field codes is followed by
`a character that is not a valid switch identifier, that character
`is part of the argument. For example, the field
`
`{quote\q\\foo\b\"}
`
`has one argument
`:-
`q\foo
`
`assuming that q, \, b, and " are not valid switch identifiers.
`Inside quotes, the backslash character is stripped out and
`ignored. For instance, ll results in ‘I. and "-." results in
`The field codes of a field may contain hidden text. If the
`beginning field character {“{") is hidden, then the hidden
`text in the remainder of the field codes will be used when
`parsing the field codes. If the beginning field character is not
`hidden, then any hidden text within the field codes will not
`be used when parsing the field codes. This provides a means
`to annotate the field.
`When displaying a file containing a field, the present
`invention determines the appropriate portion of the field to
`display according to whether the user has selected field code
`mode or result mode. During a generate operation, for each
`field in the text stream, the field processing algorithms of the
`present invention are invoked. The result of each field may
`be generated and updated in a user invoked update opera-
`tion, whenever a file containing fields is printed, during a
`print merge operation, or during periodic automatic updates.
`Typical field types and keywords are set forth in Table 1.
`
`18
`
`
`
`5
`TABLE 1
`
`5,552,982
`
`6
`
`1 23 4
`
`. Cross-Reference of text within document (REF)
`. Index Entry (XE)
`. Footnote reference cross reference (FINREF)
`. Set bookrnarlt to value (SET)
`5. Conditional selection of text (IF)
`6. Index generation (INDEX)
`7. Table of contents entry (TC)
`8. Last text of style cross reference (STYLEREF)
`9. Referred-to-document for Index and TOC (RD)
`10. User defined sequence and sequence cross reference
`(SEQ)
`11. Table of Contents and Tables of other things (TOC)
`12. Document Information (INFO) (see fields that follow)
`13. Document Title ("['ITLE. and INFO TITLE)
`14. Document Subject (SUBJECT and INFO SUBJECT)
`15. Document Author (AUTHOR and INFO AUTHOR)
`16. Document Keywords (KEYWORDS and INFO KEY-
`WORDS)
`17. Document Comments (COMIMENTS and INFO COM-
`MENTS)
`18. Document last saved by (LASTSAVEDBY and INFO
`LASTSAVEDBY)
`19. Document create date (CREATEDATE and INFO CRE
`ATEDATE)
`20. Document
`SAVEDATE)
`last print date (FRINTDATE and INFO
`21. Document
`PRJNTDATE)
`22. Document
`revision number
`REVNUM)
`23. Document edit time (EDITTIME and INFO I-EDITTIME)
`24. Number of pages in doc (NUMPAGES and INFO
`NUMPAGES)
`25. Number of words in doc (NUMWORDS and INFO
`NUMWORDS)
`26. Number of characters in doc (NUMCI-IARS and INFO
`NUMCHARS)
`27. Name of document file (FILENAME and INFO FILE-
`NAME)
`28. Name of document template (TEMPLATE and INFO
`TEMPLATE)
`29. Current date (DATE)
`30. Current time (TIME)
`31. Page number (PAGE)
`32. Mathematical Expression (calculated value) (=)
`33. Copy argument to result (QUOTE)
`34. Include separate document (INCLUDE)
`35. Page number cross reference (PAGEREF)
`36. Ask for user data (set to bookmark) (ASK)
`37. Ask for user data (place in result) (FILLIN)
`38. Data file for Print Merge (DATA)
`39. Invoke next record for Print Merge (NEXT)
`40. Conditionally invoke next record for Print Merge (NEX-
`TIF)
`41. Conditionally skip current record for Print Merge
`(SKIPIF)
`42. Dynamic Data Exchange to other app (DDE)
`43. Hot DDE Link (DDEHOT)
`
`last saved date (SAVEDATE and INFO
`
`(REVNUM and INFO
`
`44. Expand glossary (retaining link to glossary) (GLOS-
`SARY)
`A display showing the field mechanism of the present
`invention is shown in FIGS. 1A and 1B. A document may
`include conventional text strings 102 and fields 104, 106,
`and 108. The fields may provide any of a number of
`predefined functions and be positioned in any location. For
`example, field 104 is a data field, field 106 is a field for
`inserting a title (e.g., Mr.), and field 108 is a field for
`inserting a last name. In FIG. 1A. fields are shown in the
`field code mode. In FIG. 1B, fields are shown in the result
`mode.
`
`FIG. 5 shows data structures of a preferred embodiment
`of the present invention. Each character in a document has
`a character position {cp), which is the character offset within
`the document. As shown in FIG. 5, the beginning field
`character for the first field shown has a cp of 34,
`the
`separator character has a cp of 48, and the ending field
`character has a cp of 53. The data structure plcfld contains
`two parallel arrays: rgcp and rgfld. The array rgcp contains
`an entry for each beginning field character, separator char-
`acter. and ending field character in the document. The entries
`contain the cp of the corresponding character. The entries are
`preferably maintained in sorted order during document
`generation. The array rgfld contains an entry corresponding
`to each entry in the array rgcp. The rgfld entries are an FLD
`data st:ruct:ure as described below. The FLD data structure
`contains the variables ch, fit,
`fDifi"er, and flocked. The
`variable ch indicates whether the corresponding entry in the
`rgcp points to a begiruring field character, a field separator,
`or an ending field character. The variable flt indicates the
`field type. The variable fDifi'cr indicates that the result of the
`field is to be displayed in the mode that is different than the
`global mode setting. The variable flocked indicates that the
`field is locked, which indicates that the result for the field is
`not to be regenerated. FIG. 5 also shows array dnfit. Array
`dnllt contains an entry for each field type, that is, keyword
`that is defined. The dnfit entries are EFLT data structures that
`contain the constants fResult. frm, and pfnCalcFunc. The
`constant fResult indicates that the field type produces a
`result. The constant frm is a refresh mask that indicates when
`the field type is to have a result generated. The constant
`pfnCslcFunc contains a pointer to the routine that generates
`the result for the field type. The variable fit in the array rgfld
`is an index into the array drtflt.
`FIG. 5 shows two fields that are in the document. The first
`field starts at character position 34. The second field starts at
`character position 60. As shown, array rgcp contains six
`entries corresponding to the beginning field characters, the
`field separators, and the ending field characters for these two
`fields. Array rglld contains six corresponding entries. The
`entries corresponding to the beginning field characters con-
`tain the variable fit set to indicate the field type. In this
`example, both fields have the keyword “rei”;
`thus the
`variable ill in both rgfid entries is set to three. Entry number
`three in array dnfit corresponds to the “ref” field type and the
`constant pfnCalcFunc contains a pointer to the routine
`FerCalcf-ltBk.mlrRef, which generates the result for a “ref”
`field.
`
`3-5
`
`45
`
`St}
`
`TABLE 2
`.l*CP is a long describing a character position in the docurncntfl’
`PBOOL is a boclcan flag‘!
`I‘ A ple is a structure containing an array of cp's and an array of objects (in this case fltt's) in
`which die index to the array serves as the I311}: between the two pieces of Information. A handle to
`
`19
`
`19
`
`
`
`5,552,982
`
`TABLE 2-continued
`
`the plefld is stored In the document descriptor. The plefld itself is stored in the file fotrmaI_“'!
`!‘ Infonxnation stored in plefld for each field character‘!
`slrttct FLD
`to FIELD Descriptor‘!
`SI1'l.ll:I
`
`{i
`
`nt ch : '!; .-'*ehFieIdBegiIt. ehFieldSepentte or ch.Field.End‘!
`int [Dirty : 1: !"fie1d must be reperscd‘!
`};
`union
`
`{c
`
`har fit; :"chFieIdEegin:FIEl..D 'I‘y'pe"!
`char bDat.a; !‘eh.FieldSepera1e: field-specific
`cached data‘!
`struct
`{ !"chFieldErId‘!
`int i'DiB.’er : 1; !*t11.is field in ! show
`results mode‘!
`int : 1;
`int fLocked : I: !‘‘this field is locked
`From reealc‘!
`int fflested : 1; !‘fieJd is nested within
`another field‘!
`'
`T. 1 4; !‘sparo‘!
`};
`char grpf: !*ehFt'eldEnd: GRo'uP of hit Flags‘!
`};
`
`1-;
`!"Used to cache inforrrtalion about 3 field.
`Constructed from the info in me two or three fld‘s corresponding to the field.‘!
`stmet FLCD
`{!" FIELD Composite Deseriptor*!
`CP epFi.rst'. !"cp where field begins‘!
`CP dcplnst; !"'Inr:Iudes both {} and all field codes‘!
`CF dcpkesult; !‘lt-teludes I and all result text*!
`3001. fDirty; !*field is dirty and must be Iepa.t'sed*.!
`int fit; !"Fteld’s type‘!
`int bData‘. !*!lt specific cached data‘!
`int if|dChBegin;
`int it'ldChSeparat.c‘.
`int ifldChEnd;
`union
`
`{s
`
`treet
`
`{
`
`inlillflfer : 1; !"1'.hi5 field in ! show results mode‘!
`int; 1:
`int flocked : 1: !’'this field is locked from rceaJc*!
`int 1'Nested : 1; !*I':e'Id is nested within another field‘!
`in: : 4; .-'*spare’!
`};
`int grpf : 8:
`l;
`
`}:
`.-'*'I'his structure provides general inforntation about a specific field type‘!
`stmct EFIZI‘
`{ !"E1crrtt:nl of dnfil. an array of the info below for each field type. flt is the index into
`this array‘!
`int I-‘Result : 1: !*this field may have a result‘!
`int : 4; .-"‘spe.re‘!
`int: l;!*speJ'e".-‘
`int frm : 8; Prefnzslt lime mask‘!
`PFN pfitCaJcFunc: Fpointcr to resale function‘!
`}:
`!‘this is used to map ieh's to t:p‘s‘!
`struet CR
`{ !‘CF Rum‘!
`C? W:
`int ecp;
`};
`!*ho1ds inforrnation about switches found during a fetch‘!
`struet 1'-‘SF
`{ !‘F:'.eId Switch Fetched‘!
`int c‘. !*how many were fietehedfif
`CHAR Igeh {cSwite.h.Max]: !*the switches themselves‘!
`CF rgcpsw [eSwitehMa.x}: .-“cp of the switches‘!
`CP rgcp [eSwilehMa:t]'. !‘cpNi] or the cp of the switelfs erg‘!
`};
`!‘‘this is used by FetchFromFie1d and Functions that call it‘!
`
`20
`
`20
`
`
`
`5,552,982
`
`10
`
`TABLE 2-continued
`
`so-uct FFB
`{ !"Ficld Fetch Block‘!
`union
`
`i:
`
`'‘'this is used also by FetchVisibleRgch".-'
`struct FVB
`{ f*Fetch Visible Block‘!
`int doc; Pdocunzent fetching from‘!
`C1’ cpfirst; Pfirst up to fetch in next fetch (modified?!
`CF cLirn; Flinrit of fetches‘!
`int och: Fnumber of c|1‘s read if rgch. under il' !rgch*.'
`int oer; .-"‘nu.rnbcr of cr's corresponding to cI't's read‘!
`urtion
`
`is
`
`truct FEB
`-{
`.I'*Fetch Block Buffers‘?
`‘tut cc|1Ma.x; !‘max number of ch to place in rgcl:t*.-‘
`CHAR “rgch; !*buffer in which to place chars‘!
`int ccrlhlax; .‘'‘max number of er's to place in rgct“f
`strnct CR ‘1gcr:)‘*b'IJfi'cr in which to place cp runs‘!
`l;
`sI:n.tc1 FEB tho;
`i‘.
`BOOL foverfiow; Pfclch ovcrflowed cchlvlax or on-.rMax, fetch again‘.-’
`i:
`stntct FVB fvb;
`l:
`union
`
`is
`
`truct FSFE
`{ t’*Field Specific Fetch Block’!
`CP cpField'. r-cpr—“u-st of the field being fetched Born‘!
`l'*inputs‘I
`int fit‘. .-“what fit is the field being fetched‘.-'
`int foo; Pbow to treat fetch options‘!
`.f‘outputs‘.-’
`B001. l'Grouped; Pimlicales returned erguntertt was grouped‘!
`B001. l'Neslcd: .“fctc‘t1cd data contained fields‘!
`BOOL fhlotltrg; .-"there was no argttutent fetched‘!
`Palate (he very careful modifyt'ng)*!
`int cchFieldBeg:in; ."‘t:ottnt of cl1lieldBegi.n’s to be matchod*!
`BDOL fGroupPeuding; .-"indicates inside chGroupExtet'na.l pair‘!
`slruct FSF fsflilt; .I'*fit specific switches foundflf
`struct FSF fsiSys; Fsystern switches found‘!
`l;
`struct FSFE fsfb:
`};
`
`t"‘s‘tores in.fon1:at:ion about all defined field switches‘!
`struct FSI
`{ t"‘F1eJd Switch Infonnatjon‘!
`int ch : 7'. !"the switch character. note: packed to ‘i
`int fArg : 1; !*switch expects an argument‘!
`int fit : 8; Pwhat fit does this switch apply to‘!
`l:
`
`l:rits*:‘
`
`The genetic field handling mechanism of the present
`invention comprises two main components: routines for
`generating field results and routines for displaying fields.
`Referring now to FIG. 2. the FCa.lcFields routine is invoked
`by a user or is invoked automatically by the system to
`regenerate field results of a document within a specific
`range. Specifically, the routine l*lCalcFields is invoked when
`a user requests regeneration of fields, during the initial
`layout of headers, during print, page view and print preview
`operations, during print merge operations. whenever a docu-
`ment is opened, and whenever a new document is created
`based on a template that contains fields. The routine FCa1-
`cFields is passed as arguments the pointer pca a.t1d the
`variable frm. The pointer pca points to a strttcmre containing
`a document and a range of character positions. The variable
`frm is a refresh mask, which indicates what action caused
`the results generation to be invoked. The routine FCal-
`cFiclds returns the flag f"Return, which indicates the success
`or failure of the update operation.
`
`51]
`
`21
`
`When routine FCalcFie-Ids is invoked, item 202 selects the
`first field in the range to be regenerated. The system then
`enters loop 203 where fields are processed while (i) the
`process is not interrupted and (ii) the selected field is within
`the range of fields to be regenerated. Decision 204 tests
`whether the looping conditions are satisfied. If not satisfied.
`the routine returns with the flag fRcturn. Otherwise. item
`206 invokes routine FCalcField.lfld to generate the result of
`the selected field. Item 208 sets flag {Return to the logical-
`OR of flag fRelum and the value returned by routine
`FCalcFieldIfid. Item 210 positions the routine at the end of
`the selected field in preparation for selection of the next
`field. and item 212 selects the next field and loops to
`decision 2294 to process the next field.
`Referring now to FIG. 3, the routine FCa.lcFie1dIfld is
`invoked to generate the result of a field. Routine FCal-
`cFieldIfid receives as arguments a pointer to the current
`document, the index ifld into the array rg