Fortran Friends Libraries for 32-bits
Fortran Libraries compatible with 32-bit addressing architecture
(Iyonix)
Although the Acornsoft Fortran compiler does not work on Iyonix, the object
code it makes will run. The problem is that the libraries, in particular the
Fortran system library, are not compatible.
We have rewritten the
Fortran system library, removing three bugs, and no doubt introducing many
more.
Please try the new library which is included in Fortran Friends library (224K) and let us know
of new problems or omissions.
The user libraries (Utils, Graphics etc.) have also been
translated to 32-bit compatible code.
All these libraries will still work on the original 26-bit addressing
computers.
Probably any debugger you use will not work properly
We shall not fix this, so just use your old method to debug
before compiling and linking for 32-bit architecture machines.
Enhancements/differences from Acornsoft Fortran
Bugs removed:
- Bug 4: OPEN file names are no longer truncated to 30 characters,
240 character names are allowed (the limit allowed by RISCOS)
- Bug 5 & 5a: STATUS='SCRATCH' files can be rewound and re-read
- Bug 8: Character comparison no longer ignores last character in first
string when the first string is longer than the second.
Of course, this new library does not remove bugs in the compiler itself.
Enhancements also in Acornsoft Fortran library
(see Acornsoft manual for details):
- Random numbers [RND01() and SETRND(I)]
- OS_Byte [OSBYTE, OSBYTE1 and OSBYTE2]
- OS_Word [OSWORD]
- OS_CLI [OSCLI, and OSGETERROR]
I/O enhancements (which may be different from those of Acornsoft
so beware).
- Unit numbers from 1 to 99 are allowed but:
unit 5 is always the keybord input
unit 6 is always the VDU output
- Setting the file names with the command line has not been
implemented. (It could be done if really needed.)
See also the treatment of 'Default file names' below.
- Extended format descriptors
- Zw.d hex translation, w is the width of the field,
d is the number of digits printed, thus Z10.8 will
always print eight characters right-adjusted preceeded by two blanks.
w and d do not have to be even
- Ow.d octal
- Bw.d binary
- Q sends the size of the formatted buffer
remaining (bytes) to the next integer in the output list (ignored on
input)
- $ don’t do “newline” after
writing to the screen
- Format controlled input
Numeric/logical input terminates on finding ",". Warnings:
- don't use tab descriptors
- does not work for A descriptor
- List-directed CHARACTER input
Should be 'abcde...', but can be "abcde...", or even abcde...,
i.e. without any quotes but in this form the string can not contain a space,
a comma, a '/' or have a count thus:
3*'empty' or 3*"empty" will transfer three strings 'empty', whereas
3*empty will transfer one string '3*empty'
These forms allow normal comma-separated-variable records to be read
without complicated decoding though you must know a priori how many
fields there are in a record or terminate all records with "/".
- List-directed complex input
The real and imaginary parts must still be given within parentheses but
either or both may be omitted. Thus "(1.0)" or "(1.0,)" will enter a real
part of 1.0, leaving the imaginary part unchanged; "(,1.0)" will enter an
imaginary part of 1.0 while leaving the real part unchanged.
- Formatted file record length
External files, whether sequential or direct access, have a maximum
record length of 512 bytes. The length of records of internal files is
limited only by the size of the CHARACTER variable.
Unformatted records, whether sequential or direct access, can be any
size up to 2 Gbytes.
- Indexed Input
If you want to read records in a sequential file in a non-sequential
order you can set up an index to the records and then use the index to access
them immediately. This works for both formatted and unformatted records
- First you must set up the INTEGER index to the file. Do this by
reading the file sequentially and before each READ statement:
CALL FLGETP(NUNIT,INDX)
where NUNIT is the Fortran unit number and INDX is the returned address of
the record about to be read. Store the index of any records you may want to
read non-sequentially later.
- To read a record with index INDX
CALL FLSETP(NUNIT,INDX)
to position the file at byte INDX; then read the record in the usual way.
- End-of-file
The ENDFILE statement writes a special record in the physical file which is
interpreted on reading and can be detected by IOSTAT=-2 (rather than IOSTAT=-1
for the physical end of the file). You can write and read beyond this type of
end-of-file marker; it counts as a record if you then BACKSPACE over it.
CALL FLSKIP(NUNIT,IEOF)
skips the rest of the file. It returns IEOF:
- > 0 if the file is not open or is illegal in any way
- =-1 for physical end of file detected
- =-2 for logical end-of-file as described above) and positions the
file for reading after the marker.
- OPEN qualifiers
- FORM='PRINTER' to interpret Fortran carriage control characters
(implies FORM='FORMATTED')
- ACCESS='APPEND' positions the file at the end ready for more writing
(implies ACCESS='SEQUENTIAL')
- Default file names
If the name of an external file is not defined with a "FILE=filnam" in an
OPEN statenemt Fortran will invent the name "FTnnF001" (nn = unit number).
This may be changed by assigning an alias through the operating system, e.g.
the system command: "Set FT10F001 My_file" will force I/O on stream 10 to the
file "My_File" provided that stream 10 has not been OPENed with an explicit
name. "UnSet FT10F001" returns to the normal convention.
- INQUIRE file names
INQUIRE works with full file names: beginning with the filing system and
ending with the leaf name. This is what it will give for
INQUIRE(UNIT=nn,NAME=TEXT)
even if the OPEN gave something much simpler.
When the file is defined with a name rather than a unit it will try to make
up a full file name by doing the following:
- it will first expand any logical name enclosed in chevrons: "<...>"
- if the name starts with "@" it will change "@" for the Currently
Selected Directory name (CSD)
- if the name begins with "%" it will change "%" for the current library
- if the name contains "$" it will try to use the name as it is
- if none of these is satisfied it will add the CSD to the beginning.
- INQUIRE replies
When INQUIRE can not determine a variable it returns the following:
ACCESS | 'UNKNOWN' |
BLANK | 'UNKNOWN' |
DIRECT | 'UNKNOWN' |
EXIST | .FALSE. |
FORM | 'UNKNOWN' |
FORMATTED | 'UNKNOWN' |
NAME | blank fill |
NAMED | .FALSE. |
NEXTREC | 0 (because the file is not connected or is not direct access) |
NUMBER | 0 (because the file is not connected) |
OPENED | .FALSE. |
RECL | 0 (because the file is not connected or is not direct access) |
SEQUENTIAL | 'UNKNOWN' |
UNFORMATTED | 'UNKNOWN' |
- File length
The current length of an open file can be found with:
CALL FFSIZE(NUNIT,LBLK,NBLK,IERR)
which returns the number of 'blocks' in the file attached to unit NUNIT in
NBLK; the block length in 4-byte words (LBLK) must be supplied.
IERR will be returned =0 if there is no error.
- Error reporting
If the system reports an error it gives a trace-back through the subprogram
chain. This is limited by default to a depth of 6 routines. To change the
maximum length of this trace-back:
CALL TRACEDEPTH(NEWMAX)
- Input/Output error numbers as returned by IOSTAT
- Illegal ACCESS code
- Illegal BLANK code
- Illegal FORM code
- Illegal STATUS code
- Illegal unit number
- Can not open OLD file
- Can not open NEW file (e.g. it is a directory)
- Can not open an existing file as NEW (or SCRATCH)
- Can not open an interactive unit
- OLD file is not direct access
- Illegal RECL for direct access file
- Unknown ACCESS code
- Illegal unit number
- Direct access REWIND
- File not open for REWIND
- Direct access ENDFILE
- File not open for ENDFILE
- Direct access BACKSPACE
- File not open for BACKSPACE
- Direct access record # is illegal
- Can not write to unformatted file
- Can not open file
- Illegal unit number
- ACCESS conflict
- Formatted I/O on unformatted file
- Unformatted I/O on formatted file
- Unformatted read header is wrong
- Can not read file
- Unformatted internal I/O not allowed
- Recursive I/O
- List-directed I/O to direct access file
- Buffer overflow on formatted read from file
- Buffer overflow on keyboard read.
- Escape pressed during keyboard input
- No more record reading internal file
- Can not write to formatted file
- No more records writing internal file
- Formatted output buffer overflow
- Data word length incompatible with format descriptor
- Format has no data-transfer descriptor
- Formatted input buffer overflow
- Hollerith data illegal in input format
- Formatted input integer overflow
- Tab outside formatted input record
- Negative tab position in formatted output
- Unformatted direct-access output record overflow
- Unformatted input record overflow
- Unexpected ASCII character in format
- non-positive tab
- non-positive X-skip
- non-positive Hollerith field
- negative repeat count for data descriptor
- negative repeat count for parenthesis
- B not followed by N or Z
- No count after tab descriptor
- No count (e) in Ew.dEe or Gw.dEe
- d part missing from F,E,D or G descriptor
- w missing from numeric or logical descriptor
- Unexpected right parenthesis
- Too deep parenthesis structure (maximum is 10)
- Illegal character in binary input
- Illegal character in logical input
- Illegal character in octal input
- Illegal character in hexadecimal input
- Illegal character in integer input
- Illegal character in floating input
- Illegal character in complex input
- Illegal file name in INQUIRE (Error number 101)
Page last updated 03 May 2003
Click here to return to Fortran Friends Top page