|
Conventions
Source conventions used in the library
Featured StackSince version 0.6.0 FFL uses the ANS stack notation. Stack parameters input to and output from a word are described by: ( stack: before -- after) where stack specifies which stack is used. The code for the control-flow-stack is C:, for the return-stack it is R: and for the float stack F:. If no stack identifier is present in the notation, the data stack is used. Before represents the stack parameter data types before execution of the word and after represents them after execution. The top of the stack is to the right. The following symbols are used in before and after:
As an addition to this table the FFL variables on the stack are represented by the three alphabetic characters of the defining module. For example the stack notation of the sh1-finish word, used in the Starting chapter is: ( sh1 -- u1 u2 u3 u4 u5 ). This word expects a sh1 variable on stack and returns five unsigned numbers. The FFL variables are actually aligned addresses (a-addr). It is possible that a word returns different stack parameters after execution. This is described by after1 | after2. If a word has both compile time as run time behaviour, this is described by ( before1 -- after1 ; before2 -- after2 ). The stack parameters before1 and after1 specifies stack behaviour during compilation time and before2 and after2 during run time. A few words in the FFL parse text during compilation. Those words use the following syntax: ( before "parsed-text-abbreviation" -- after ). The parsed-text-abbreviation uses the following specifications:
Word namingThere are two different type of words in the FFL: general use words and library words. General wordsThe general words perform small, general actions. They use normal, descriptive names. Exampes are nil<>, #bits/byte, begin-stringtable and so on. Library wordsThe name of the library words start with a prefix, followed by a special character and ends with a descriptive name. The prefix is equal to the module name. The special character is one of the following:
The descriptive name specifies the action that the word performs on the optional stack parameters. Some special characters are used for abbreviations:
InconsistenciesDue to historical reasons there are two groups of words that do not follow this naming convention. Those are module-name-create and module-name-new. Based on the name you should expect that those words expect a module variable on the stack, but actually they don't. So they should be named module-name+create and module-name+new, but again for historical reasons they are not.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||