|
3.3 Coding Style Although FunnelWeb wasn't coded under any formal C coding standard, it was coded in accordance with a fairly strict personal style of C which developed during the development of FunnelWeb. This section aims to describe some of the more important elements of the coding style. Portability: This was a major goal of the FunnelWeb implementation. Two excellent books guided this move to portability. They were [Rabinowitz90] (which deals with C code itself) and [Horton90] (which deals with the portability of various library calls). Other works such as [Kernighan88] and [ANSI] were also helpful. Identifiers: [Rabinowitz90] specifies that for wide portability, identifiers of block and file scope should be unique to eight characters, and identifiers of program scope should be unique to six characters. I have gone further in FunnelWeb and actually made these restrictions actual limits on identifier length. Because names must be so short, a system of abbreviations was developed to organize the identifiers used within FunnelWeb. Each abbreviation consists of a letter pair. Here are most of the abbreviations used:
bp - Body Part. cm - Compare. Used to prefix comparison routines that return [-1,0,1]. dc - Document component. dm - Dump package. el - Element. eq - Equal. Used to prefix comparison routines that return a boolean. ex - Expression. f - Global files. ll - List of lists. ln - Line record. ls - List Package. lr - Lister package. ma - Macro. mc - Macro Call. mn - Macro Name. op - Options package. pr - Parser. ps - Position record. sc - Scrap record. sn - Section. tb - Table package. ty - Typesetter directive. wf - Write file package. wl - Write with EOL (misc.c). wr - Write (misc.c). Pointers: Variables or types denoting pointers start with "p_". Types: Names denoting types end in "_t". Thus, a type for a pointer to a table would be named p_tb_t. File names: All FunnelWeb source files have file names that are from one to eight characters long and file extensions that are from one to three characters long. This ensures that the FunnelWeb source code can be portably moved to all kinds of machines, including MSDOS!
Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved. |