TIP: Click on subject to list as thread! ANSI
echo: ms_word
to: ALL
from: CHRISTOPHER GREAVES
date: 1996-11-05 12:09:00
subject: TEMPLATE STANDARDS 1

I'm still working towards standards for development of macros, 
styles and the templates that house them.
I have a huge (190K) client template that contains some 150 
macros, one of which is called "StringUtils" - that macro houses 
a host of general-purpose macros and functions.
It's time to sort out the mess.
What goes into a macro? A template? 
                            TEMPLATES
                            =========
I will have a new template called STRINGUTILS into which I will 
put all general-purpose string handling macros that could be used 
in other applications besides the current client application. 
Candidates are:
        DisplayCharacterCode (Displays the decimal ASCII code of 
                the character to the right of the text cursor; 
                moves one character to the right)
        IsLowerCaseAlphabetic (returns True if the leading 
                character of the current selection is a lower-
                case alphabetic character)
        IsAlphabetic (returns the logical .OR. of 
                IsLowerCaseAlphabetic and IsUpperCaseAlphabetic)
I will have a new template called TABLEUTILS into which I will 
put all general-purpose table handling macros that could be used 
in other applications besides the current client application. 
Candidates are:
        AllButLeftColumnNormal (sets style of all columns to 
                Normal, except for the left-most column) 
        AppendOneCell (the contents of the current cell are 
                appended to the contents of the cell immediately 
                above)
        AppendToCellRight (the contents of the current cell are 
                appended to the contents of the cell immediately 
                to the right) 
        
I will have a new template called DOCUTILS into which I will 
put all general-purpose document handling macros that could be used 
in other applications besides the current client application. 
Candidates are:
        DeletePrivateFields (hunts for {Private}, usually a 
                result of the WP51 Initial Codes item, and 
                deletes such fields)
        DeleteRemainingHeaders (removes all page headers except 
                the first one in the document)
        TokeniseTables (hunts for Word tables, writes them to a 
                separate document with a unique name, places an 
                escape character (I use Japanese Yen symbol) and 
                the unique file name.
I will have a new template called FORMATUTILS into which I will 
put all general-purpose style and format handling macros that 
could be used in other applications besides the current client 
application. 
Candidates are:
        BulletHyphen (looks for lines whose leading non white-
                space character is a hyphen, and applies a style 
                called "BulletHyphen" to that line)
        GlueToStyleAbove (Joins two lines, applies the style of 
                the earlier line)
        NumberedHeadings (Looks for lines whose leading non 
                white-space character is a digit-string, period, 
                digit-string; removes the numbering and applies a 
                built-in Heading style.
I will retain the existing CLIENT TEMPLATE into which I will 
put all project-related macros that probably can't be used 
elsewhere. 
Candidates are:
        AttachNum (trawls the document looking for lines whose 
                only alphabetic string is "Attachment")
        BuildDocument (this is the driver that calls all other 
                documents to clean up a WP51 document)
        EncodeUlineStrings (searches for strings of underlined 
                spaces or strings of underscore characters and 
                replaces them with an escape character 9I use the 
                English Pound symbol) and a digit rounded to a 
                multiple of five).
                        MACROS & FUNCTIONS
                        ==================
At the moment, the only reason I can see for having a macro whose 
internal units are called from an external macro, is that of 
FUNCTION calls.
All the sub routines which currently reside in the mammoth macro 
StringUtils could be written as stand-alone subroutines in an 
appropriate template (see above).
Functions seem to need to be defined within a subroutine/macro.
Consequently, within the STRINGUTILS template, I'll have a 
subroutine called "FX" (Function(x)) and within it will be 
function definitions, such as the IsLowerCaseAlphabetic described 
above, and within the TABLEUTILS template I'll have another FX 
macro embedding IsInTable (which returns True if the text cursor 
is currently within a table cell). The  DOCUTILS template will 
have an FX macro that embeds such lovelies as the function 
GetDocname$, which returns the name of the current document.
                         GLOBAL VARIABLES
                         ================
Some of you will recall my earlier question about Global 
variables that exist beyond the life of an executed macro.
My current thinking is to write a set of functions within the FX 
macro within the STRINGUTILS template. Functions such as Pound$ 
will return the character "English Pound" (ascii 156) and Yen$ 
which will return ascii 157. As best I can determine, I can use 
(Continued to next message)
 * 1st 2.00b #6263 *  People and Computers
--- PCBoard (R) v15.3/25
---------------
* Origin: Westonia Computer Systems 1:250/636 (416)241-1981 (1:3615/51)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.