STAMP Function Library Reference Manual

functions for morphological transfer and synthesis

version 2.0b1

July 1998

by Stephen McConnel


Table of Contents


1. Introduction to the STAMP function library

Only the outline of this manual has been written -- it needs a LOT of work!!

2. Variable and function naming conventions

The basic goal behind choosing names in the STAMP function library is for the name to convey information about what it represents. This is achieved in two ways: striving for a descriptive name rather than a short cryptic abbreviated name, and following a different pattern of capitalization for each type of name.

2.1 Preprocessor macro names

Preprocessor macro names are written entirely in capital letters. If the name requires more than one word for an adequate description, the words are joined together with intervening underscore (_) characters.

2.2 Data structure names

Data structure names consist of one or more capitalized words. If the name requires more than one word for an adequate description, the words are joined together without underscores, depending on the capitalization pattern to make them readable as separate words.

2.3 Variable names

Variable names in the STAMP function library follow a modified form of the Hungarian naming convention described by Steve McConnell in his book Code Complete on pages 202-206.

Variable names have three parts: a lowercase type prefix, a descriptive name, and a scope suffix.

2.3.1 Type prefix

The type prefix has the following basic possibilities:

b
a Boolean, usually encoded as a char, short, or int
c
a character, usually a char but sometimes a short or int
d
a double precision floating point number, that is, a double
e
an enumeration, encoded as an enum or as a char, short, or int
i
an integer, that is, an int, short, long, or (rarely) char
s
a data structure defined by a struct statement
sz
a NUL (that is, zero) terminated character string
pf
a pointer to a function

In addition, the basic types may be prefixed by these qualifiers:

u
indicates that an integer or a character is unsigned
a
indicates an array of the basic type
p
indicates a pointer to the type, possibly a pointer to an array or to a pointer

2.3.2 Descriptive name

The descriptive name portion of a variable name consists of one or more capitalized words concatenated together. There are no underscores (_) separating these words from each other, or from the type prefix. For the STAMP function library, the descriptive name for global variables begins with Stamp.

2.3.3 Scope suffix

The scope suffix has these possibilities:

_g
indicates a global variable accessible throughout the program
_m
indicates a module (semiglobal) variable accessible throughout the file (declared static)
_in
indicates a function argument used for input
_out
indicates a function argument used for output (must be a pointer)
_io
indicates a function argument used for both input and output (must be a pointer)
_s
indicates a function variable that retains its value between calls (declared static)

The lack of a scope suffix indicates that a variable is declared within a function and exists on the stack for the duration of the current call.

2.4 Function names

Global function names in the STAMP function library have two parts: a verb that is all lowercase followed by a noun phrase containing one or more capitalized words. These pieces are concatanated without any intervening underscores (_). For the STAMP library functions, the noun phrase section includes Stamp.

2.5 Examples

Given the discussion above, it is easy to discern at a glance what type of item each of the following names refers to.

SAMPLE_NAME
is a preprocessor macro.
SampleName
is a data structure.
pSampleName
is a local pointer variable.
writeSampleName
is a function (that may apply to a data structure named SampleName).

3. STAMP data structures

4. STAMP global variables

5. STAMP functions

Bibliography

  1. McConnel, Stephen. 1998. STAMP Reference Manual. SIL International.
  2. McConnel, Stephen. 1998. OPAC Function Library Reference Manual. SIL International.
  3. Weber, David J., H. Andrew Black, and Stephen R. McConnel. 1988. AMPLE: a tool for exploring morphology. Occasional Publications in Academic Computing No. 12. Dallas, TX: Summer Institute of Linguistics.
  4. Weber, David J., H. Andrew Black, Stephen R. McConnel, and Alan Buseman. 1990. STAMP: a tool for dialect adaptation. Occasional Publications in Academic Computing No. 15. Dallas, TX: Summer Institute of Linguistics.

Index

Jump to:


This document was generated on 20 March 2003 using texi2html 1.56k.