The following is a guide to setting machine-dependent constants in $I/u/mach.m: F77_COM The external name generated by the FORTRAN compiler for a common block. f77 often turns "common/abc/..." into external name "abc_" F77_SUB The external name generated by the FORTRAN compiler for a subroutine. f77 often turns "subroutine abc" into external name "abc_" F77_MAIN The external name generated by the FORTRAN compiler for the main routine. f77 often uses external name "MAIN__", but 4.2BSD uses "MAIN_" MAX_FILE_NAME_LEN Maximum number of characters allowed in a UNIX file name. Typically 14. S truncates all file names to this size prior to UNIX system calls. For 4.2BSD, this can be large (like 100). PIPESIZE Number of bytes into a pipe before blocking (typically 4096) OpSys The version of the UNIX operating system being used on the machine. Presently, the following are recognized: ATT System III, IV, etc. (use Sys III ioctls) Berkeley 4.1BSD, ... (assumed to have paging) 32V, 7th ??? NCPW Number of characters per word (FORTRAN integer variable) NBPC Number of bits per character (unused?) DEPS Smallest positive number such that 1.0d0+DEPS != 1.0d0 EPS Smallest positive number such that 1.0e0+EPS != 1.0e0 LARGEINT A valid integer near the maximum size of an integer on the machine (not used for precise numeric work -- just wants to be very big) BIGINT A valid integer near the maximum size of an integer on the machine (not used for precise numeric work -- just wants to be very big) BIGEXP An integer such that both 10^BIGEXP and 10^(-BIGEXP) are valid and are very large and near zero, respectively. BIG A valid real number, 10^BIGEXP, that is near the upper limit of the machine representation (not used for precise numerical work) SMALL A valid positive real number, 10^(-BIGINT), close to the smallest positive real number representable. NA An integer with the following properties: very large and unlikely to occur (hence 1237867 is much better than 1000000) If the bit-pattern of this integer is interpreted as a real number, it should also be unlikely. The best candidates in this respect look like unnormalized floating point numbers, which would never be stored by the FORTRAN compiler. For example, you would not want NA interpreted as a REAL to be 2.00001, since a computation like 5.1-3.1 might accidentally end up as NA. NAs are always inspected as integers by the code. See the examples below for particular machines. natst Integer function which returns a non-zero value if its argument is NA. setna Subroutine which sets its argument (interpreted as an integer) to NA. NOARG Similar to NA; used when a routine has an argument that may be omitted. SAVE defined as "save $*" for a compiler that has a "save" statement to indicate static storage allocation. (Used when the compiler allocates variables upon entry to a routine, as in C automatic storage. Similar to the C static statement). CHARACTER maps into a "character" statement appropriate for the FORTRAN compiler or into a suitable-size integer declaration if the FORTRAN compiler does not have character variables. __________________________________________________ Special Characters: EOS A special character used to denote the end of a character string. In many cases will be "\0", the standard C null byte string terminator. NEWLINE A special character used to denote a new-line inside a character string. In many cases will be "\n", the standard C newline character. ESCAPE A special character used to denote an escape inside a character string. In many cases will be "\\", the standard C escape character. BACKSPACE A special character used to denote a backspace inside a character string. In many cases will be "\b", the standard C backspace character. TAB A special character used to denote a tab inside a character string. In many cases will be "\t", the standard C tab character. All of these characters must be allowed inside FORTRAN strings. __________________________________________________ CHARMAKE Corresponds to FORTRAN-77 char() intrinsic: converts the integer value given as an argument into a single character. ICHAR Corresponds to FORTRAN-77 ichar() intrinsic: converts the character given as an argument into an integer (often using ASCII representation). CRAY } There is a macro of the same name as each target machine. When compiled IBM } on a CRAY, for example, the arguments to the CRAY macro are emitted UNIX } into the output code. When compiled on any other machine, the arguments GCOS } to the CRAY macro are eaten. I1MACH Integer machine-dependent constants, as defined by the PORT library. The particular required entries are: (9) The largest positive integer (10) The base, b, for floating point arithmetic (11) Number of base-b digits in a single precision floating-pt number (12) The smallest exponent (13) The largest exponent R1MACH Real machine-dependent constants, as defined by the PORT library. The particular required entries are: (1) The smallest positive single-precision number (2) The largest single-precision number (3) b^(-t) where b is the base and t is the number of digits in a single-precision mantissa (4) b^(1-t) the smallest safely detectable value of abs((x-y)/x) (5) log base 10 of b The following are m4 macro definitions for the macros described above. There are definitions for the Cray-1, IBM-360, Honeywell GCOS, and various UNIX machines. -------------------------------------------------- # cray-1 macros define(`NCPW',8)define(`NBPC',7)#chars per word, bits per char define(`DEPS',1.1d-28) define(`LARGEINT',9 000 000 000 000 000 000)define(`BIGINT',LARGEINT) define(`PRECISION',1.5e-14)define(`NDIGITS',13) define(`BIGEXP',2465)define(`BIG',1e`'BIGEXP)define(`SMALL',1e-BIGEXP) define(`NA',`ifelse($1,,9223125746250153983,natst($1)!=0)') define(`NOARG',9223125746250153981) define(`SAVE',`save $*') # only for F77 define(`CHARACTER',`ifelse($1,,CHAR,$2,*,`character*(*) $1',`character*$2 $1') dnl ifelse($3,,,`(shift(shift($*)))')') define(`EOS',`~') define(`ESCAPE',`\\')define(`NEWLINE',`') define(`BACKSPACE',`') define(`ISIZEOF',`ifelse($1,4,2,1)') # size of modes in integer words define(`CRAY',`$*') define(`ICHAR',`ichar($1)') # for macro processor define(`CHARMAKE',`char($1)') define(`R1MACH',`ifelse($1,1,0.366720773510969E-2465, $1,2,0.272687033904796e2466, $1,3,0.7105427357601e-14, $1,4,0.14210854715202e-13, $1,5,0.301029995663981)') define(`I1MACH',`ifelse( $1,9,9223372036854775807, $1,10,2, $1,11,47, $1,12,-8189, $1,13,8190)') -------------------------------------------------- # ibm macros define(`NCPW',4)define(`NBPC',8)#chars per word, bits per char define(`DEPS',1.4d-17) define(`LARGEINT',2 100 000 000)define(`BIGINT',LARGEINT) define(`PRECISION',1.e-6)define(`NDIGITS',6) define(`BIGEXP',75)define(`BIG',1e`'BIGEXP)define(`SMALL',1e-BIGEXP) define(`NA',`ifelse($1,,2130771967,natst($1)!=0)') define(`NOARG',2130771965) define(`EOS',`') define(`ESCAPE',`\\')define(`NEWLINE',`') define(`BACKSPACE',`') define(`ISIZEOF',`ifelse($1,4,2,1)') # size of modes in integer words define(`ICHAR',`ichar($1)') # for macro processor define(`CHARMAKE',`char($1)') define(`R1MACH',`ifelse($1,1,5.39761e-79, $1,2,7.237005e75, $1,3,5.960464e-8, $1,4,9.5e-7, $1,5,1.20412)') define(`I1MACH',`ifelse( $1,9,2147483647, $1,10,16, $1,11,6, $1,12,-64, $1,13,63)') -------------------------------------------------- # UNIX machines (3B, Motorola 68000, DEC VAX) #define(`OpSys',`Berkeley') #define(`OpSys',`ATT') define(`NA',`ifelse($1,,1073741825,natst($1)!=0)')define(`NOARG',1073741827) # for Vaxes, etc #define(`NA',`ifelse($1,,1996490069,natst($1)!=0)')define(`NOARG',1996490067) # for 3B machines #define(`NA',`ifelse($1,,2139095041,natst($1)!=0)')define(`NOARG',2139095143) # for 68000 based machines # common block and subroutine names generated by f77 end in underscore define(`F77_COM',`$1_') define(`F77_SUB',`$1_') define(`F77_MAIN',`MAIN__') # 4.2BSD uses MAIN_ rather than MAIN__ # max file name length - dataset names truncated to this size # change this to something big (like 100) for 4.2BSD define(`MAX_FILE_NAME_LEN',14) #number of bytes into a pipe before blocking define(`PIPESIZE',4096) define(`NCPW',4)define(`NBPC',8)#chars per word, bits per char define(`DEPS',1.d-17) define(`LARGEINT',1073741824)define(`BIGINT',LARGEINT) define(`PRECISION',1.2e-7) # 1e-6 for Inter define(`NDIGITS',7) define(`BIGEXP',38)define(`BIG',1e`'BIGEXP)define(`SMALL',1e-BIGEXP) define(`SAVE',`save $*') # only for F77 define(`CHARACTER',`ifelse($1,,CHAR,$2,*,`character*(*) $1',`character*$2 $1') dnl ifelse($3,,,`(shift(shift($*)))')') define(`EOS',`\\0') define(`ESCAPE',`\\\\')define(`NEWLINE',`\\n') define(`BACKSPACE',`\\b') define(`TAB',`\\t') define(`GCOS',`')define(`UNIX',`$*') define(`ICHAR',`ichar($1)') # for macro processor define(`CHARMAKE',`char($1)') # from PORT (PDP11 & VAX use floating binary, INTER uses hex) # PDP11 or VAX constants define(`R1MACH',`ifelse($1,1,0.29387359E-38, $1,2,0.17014117E39, $1,3,0.59604645E-07, $1,4,0.11920929E-06, $1,5,0.30103000E00)') define(`I1MACH',`ifelse( $1,9,2147483647, $1,10,2, $1,11,24, $1,12,-127, $1,13,127)') define(`SIZEOF',`ifelse($1,DBL,2,1)') -------------------------------------------------- # Honeywell macros define(`NCPW',4)define(`NBPC',9)#chars per word, bits per char define(`DEPS',1.d-17) define(`LARGEINT',30 000 000 000)define(`BIGINT',LARGEINT) define(`PRECISION',1.e-8)define(`NDIGITS',8) define(`BIGEXP',32)define(`BIG',1e`'BIGEXP)define(`SMALL',1e-BIGEXP) define(`NA',`ifelse($1,,34359738367,natst($1)!=0)')define(`NOARG',31138512895) define(`SAVE',`') # only for F77 define(`CHARACTER',`ifelse($1,,CHAR,$2,*,`character*500 $1',`character*$2 $1') dnl define(`EOS',`') define(`ESCAPE',`\\')define(`NEWLINE',`') define(`BACKSPACE',`') define(`TAB',` ') define(`GCOS',`$1')define(`UNIX',`') define(`ICHAR',`float(fld(0,9,$1))') # for macro processor (produce ascii code) define(`CHARMAKE',`bool($1*2**27)') # this doesn't work !!! define(`R1MACH',`ifelse($1,1,0.29387359E-38, $1,2,0.17014118E39, $1,3,0.74505806E-08, $1,4,0.14901161E-07, $1,5,0.30103000E00)') define(`I1MACH',`ifelse( $1,9,o377777777777, $1,10,2, $1,11,27, $1,12,-127, $1,13,127)')