From: Peter.Hammond@brunel.ac.uk (Peter D Hammond)
Newsgroups: comp.lang.fortran
Subject: BCF77 Document in English
Date: 13 Aug 92 16:01:35 GMT
Organization: Brunel University, Uxbridge, UK
X-Newsreader: Tin 1.1 PL3

Hi.

I worked out one way to do it; copy the file to .article while in vi,
quit vi without saving, then go back in to add this bit. Seems to
work, but there must be a better way?

This is the requested documentation for BCF77 translated into English.
I did not do the translation, so dont blame me if its wrong. It looks
OK to me though.
------------:<------------Begin manual------------:<-------------------

BC-FORTRAN77 Version 1.3b

The version b of BC-FORTRAN77, consisting of the following five
programs (Note: I'm not so sure about this word--"Datei" ) has been
completely programmed by me.  I grant the right to use version b for non-
commercial purposes, but retain the right to sell this version, also
together with other products.  Each copy must be attached to this text.  The
use of this version for military purposes or related research is forbidden !
July, 1990                                      A. Koestli


BC-FORTRAN77 Version b consists of a compiler, linker, module library and a
resident timing system, which contains among other things a simple debugger.
This version runs on an MS-DOS system with 640kB RAM.  A hard disk is not
necessary.  This allows a compiler to be used simply for programming
courses.  It is also true that such compilers exist for ATARI ST and AMIGA.

Inquiries about another or newer version will only be answered if 20 DM
(note: currently about $13) cash or check are sent to cover my costs.  I
only send 3.5" diskettes.

BC-FORTRAN77 Vers. b consists of the following programs:

     LIES.TXT  This text
     BCF.EXE   Compiler
     BCL.EXE   Linker
     BCRTSY.EXE Resident timing system
     LIB.B     Library with standard functions

If a copy is made, all programs must be adopted without changes.

                                Installation
BEFORE the Compiler, Linker or a related program is started, the resident
timing system MUST be loaded.  This is done using the program BCRTSY.EXE.
If BC_FORTRAN77 is used regularly, it is recommended that BCRTSY.EXE is
started in AUTOEXEC.BAT.  The *.EXE programs are copied into a dictionary
which is included in PATH, the program LIB.B belongs in an APPEND dictionary
(see the MS_DOS commands PATH and APPEND).

                                  Compiler
The compiler is started with:
          BCF [-option...] Data Base...
If the data base does not contain any points, then .F is added.  The
translated form of the programs are included in Data Base.B .

Example:
          BCF -D TEST.F
Translates TEST.F with debug option to TEST.B
          BCF TEST SUB
Translates TEST.F to TEST.B and SUB.F to SUB.B
          BCF TEST.X
translates TEST.X to TEST.B

                              Compiler Options
/Option may also be used rather than -Option.

     -D   Debug, summarizes -BVL
     -B   debug code, implies -H and also creates a code for debugging
          messages, to test boundaries and substrings.
     -H   parcheck, code to test parameter lists and to create stack
          overflow.
     -V   varlist: variable list for debugger.
     -L   lineslist: Lists lines for debugger.
     -U   Uppercase: Changes lower to upper case (except for character
          constants and formats)  If this option is lacking, xy, XY, Xy and
          xY are different variables!
     -F   Freeinput: Source program not in FORTRAN format. Not standard!
     -P   Protocol: Gives the translated lines.
     -S   Short protocol: one line per module with larger stack frame and
          code (bytes).
     -O   one: Only creates one output file with the name of the first input
          file.

                             Language Standard
BC-FORTRAN77 translates the full standard using ANSI/ISO.  The language
standard is breached by several exceptions (most of these are considered
extensions).  I strongly recommend against using these dialect
constructions, since they are not standardised and therefore not exactly
defined.

The most important of these are:

     INTEGER*1   8 bit INTEGER
     INTEGER*2  16 bit INTEGER
     INTEGER*4   as INTEGER
     LOGICAL*1   8 bit LOGICAL
     LOGICAL*2  16 bit LOGICAL
     LOGICAL*4   as LOGICAL
     IMPLICIT NONE excludes the implicit Typdef.
     COMMON /%adr/ Absolute common, adr is the constant or simple variable
                   which gives the simple segment address.
     EQUIVALENCE () between character and other types as well as
                    combinations in the common.
     Recursive subprogram commands
     Names with a maximum of 8 characters (standard: 6)

The most important restrictions are:

     32kB Code+SAVE/DATA per subprogram
     32kB local data per subprogram (stack frame)
     32kB per common (actually 64kB, but the address of the last field must
          be less than 32kB.
     700  subprograms per data base.
     500  different commons per data base.

In addition there are a number of restrictions which lead to false messages
when unusually large subprograms are used, but in most cases the 32kB code
limit has been exceeded.

                                   Linker
The linker is started with:
          BCL [-options...] Data base...
If there are no data points, the .B is included.  The program data base is
saved using the name of the first data base, but with .EXE rather than .B .
The data base LIB.B must also be included to link the standard functions and
the I/O routines to the program.

Example:
          BCL -S16 TEST SUB LIB
or:
          BCL -S16 TEST.B SUB.B LIB.B
links the data bases TEST.B and SUB.B and saves the usable program TEST.EXE,
which uses a stack size of 16kB.

                               Linker Options
     -Sn  Stack size for the program to be created is set to n kB (max: 64).
          If this option is not used, a 64kB size stack will be assumed.
          All local variables and fields of a subprogram routine will be
          included in the stack.
     -O   optimized linking: Unused subprograms are excluded.
     -P   protocol: lists common blocks and program modules.



                                Restrictions
The most important restriction is the RAM size--the program data base to be
created (without commons and stack) can be no larger than the largest
available memory block after BCL is loaded.  On the other hand, given large
commons and stack, a program may also be created which cannot be started in
the given RAM.

The number of subprograms is limited to 3000, the number of common blocks to
1500. (The ridiculous 640kB restriction of MS-DOS would take precedence.)

                               Timing System
The timing system BCRTSY.EXE contains routines which are necessary for a
FORTRAN77 program and must be loaded before the program is started.
BCRTST includes:
     Arithmetic routines:
          32 bit INTEGER multiplication/division
          REAL arithmetic
          DOUBLE PRECISION arithmetic
          The IEEE accompanying comma format is used,
          REAL: 7 decimal places, 32 bit
          1 bit sign, 8 bit exp., 24 bit mantissa (?)
          DOUBLE PRECISION: 14 decimal places, 64 bit
          1 bit sign, 11 bit exp., 52 bit mantissa
          A mathematical coprocessor is not supported. ( A 80x87/version
          exists, but cannot be tested, since I don't have the hardware.)

                             CHARACTER Routines
Debugger:
     A simple debugger to search for errors.  After a timing error, an error
message is given and input expected.  The debugger may also be activated by
pressing a key to interrupt the program if the program is translated with
the B-option.  The following keys are recognized by the debugger as
commands:
     T    Traceback-Follows the subroutine call stacks back, gives the next
          highest Progunit by line number, if -L is used when compiled.
     U    Untrace-Makes all traceback actions retroactive.  This also occurs
          implicitly before the program is reactivated.
     V    Variables of the actual subprogram are given actual values, if it
          is translated with the V-option.  This relates to the last
          Prog.unit if T is pressed.
     Z    End program.
     Space  Continue if no timing error has occurred.
     S    program step (to the next label, subprogram, ELSE, ENDIF, DO)
     C    subprogram step (to the next CALL or RETURN).

LIB.B includes the mathematical functions to the full extent of the
standard.  If error messages arise during linking such as:
          External not found: f_SORT
the LIB.B must be included when BCL is called up.


                               Program Start
A program data base created using BCL may be started as any other using a
desktop or a shell.

                               Error Messages
The error messages from the compiler, linker and timing system should be
self-explanatory except for the following.  A complete listing (26 pages in
the Version P handbook) is not possible in this short description.

     IO-Error: Number
          In/Output error; can be caught, since the IOSTAT=parameter is
          given in the IO statement.  The number is the same value as given
          in the IOSTAT variable.

Numbers:

     -1   End of data base.
     -2   End of data in the middle of a record.
     1    Data base number already in use (OPEN)
     2    Too many data bases (OPEN) Max. 32
     3    Data base name too long (OPEN) Max. 31 characters
     5    Data base number not open. only 5 and 6 may be used without OPEN.
     6    Formatted/unformatted contradiction.
     7    REC parameter for data base with ACCESS='SEQUENTIAL'
     8    BACKSPACE, REWIND, ENDFILE for this data base not possible (AUX:
          and PRN:)
     10   Internal I/O only formatted.
     20   Integer overflow during input.
     21   data errors during input by list, for example: missing apostrophe
          for string of characters.
     22   Unexpected end of data.
     23   record too long.
     24   Reading error using UNFORMATTED SEQUENTIAL.
     30   Format element and I/O elements incompatible.
          INTEGER requires an I-format element
          REAL, DOUBLE PRECISION (COMPLEX) a F-, G-, E-, or D- format
          element,
          LOGICAL an L-format element, CHARACTER an A-format element.

     31   format element L: T or F expected (input)
     32   format element I: unexpected character (input)
          space, sign or number allowed.
     33   format element E, F or D: unexpected character (input)
          space, sign, number, decimal point, E, e, D or d (exponent)
          allowed.
     34   Too many ( in format
     35   Too many ) in format.
     36   Number order in the wrong place in format.
     37   Format element not recognized.
     38   . lacking in F, E, G or D format element.
     39   4H text or 'text' in format for READ.
          In FORTRAN66 this text could be read in in one format; this is no
          longer allowed in FORTRAN77.
     40   Exponent too large for given format
     42   Format element too long.  Max. length of the internal record (80
          characters).
     43   Internal I/O, record too long.
     44   TL, record too long.  If a record is longer than the internal
          record, it is not possible to tabulate to the left.
     45   Length of field 0 with I,L,F,E,G,D format element.

1000+n    MS-DOS error n
1002      Data base not found.
1003      Directory step not found.
1004      Too many data bases
1005      Access not allowed.
1008      Not enough RAM available.
1012      Access not possible.
1015      Incorrect procedural identification.

                                  Problems

The 80x87 Version is not tested and therefore not included.

All errors should be reported by mail.
-- 
BFN, Pete.

 Dept. Materials Technology | Disclaimer: SERC pay me | You sometimes have to  
 Brunel University          | to report my opinions,  |    listen to
 Uxbridge                   | not for theirs or the   | A lot of useless talk.
 Middx, UB8 3PH, UK.        | the university's.       |         N. Peart. (RUSH)