Structure of SELEX Common Blocks
Structure of SELEX Common Blocks
We are attempting to standardize the structure of our common blocks. These
rules were develped originally with respect to OCS tables but they can also be
applied to most common blocks that we use. A more through discussion of the
rationale behind these rules can be found in here.
Standard SELEX common block rules
- Parameters for number of records, maximum number of fields and variable
for present number of records are {l,m,n}xxx where xxx is the table name.
These variables have no '_' to distinguish them from field variables which
require an '_' between the field and table names. The prefix is not
optional, exactly "l", 'm' and 'n' are required. All tables must have at
least these three things plus a table type declaration and a common
statment.
- The common block name for table xxx must begin xxx_. The recommended
suffix
is "blk". Database common block names must be for the form 'xxx_cbk'.
The name of the include file must match the name of the common block.
(eg: xxx_blk.inc).
- All field variables have the form field_table and are type declared
with a ! comment defining them and follow fortran variable naming
conventions
([i-o] are integer). Either "field" or "table" may include "_". The two
must be seperated by an "_".
- Field variables may only be an integer multiple (n) of 4 bytes long and
are typed and dimensioned as Type*4n field_table(lxxx/n,1). Each field type
declaration line must have a ! comment defining the variable and its units.
- Lxxx is an even multiple of the largest type field. That is, lxxx
must be even if the largest field is *8 and must be divisable by 4 if the
largest field is *16, etc.
- The field - table equivalence has ! comment with field type (eg: !i4)
and has "c ddl" and c endddl" comment lines delimiting the field names
which can be known internally at run time.
Recommendations for standard SELEX common blocks
- Comments are cheap - use them!
- Keep all variables lower case. Do not imbed spaces in variable names.
(Eg:
" x_part" not "x _part".) These suggestions help in searching for
variables. Fortran is not case sensitive - UNIX (and therefore grep) is!
Internally, our string parser converts everything (eg: field names) to
lower case by default.
- Keeping these include files neat, extremely well documented and
clear is the best timesaving investment we can make.