UFAS - L66 C library support for UFAS.

Description:

The GCOS8 C compiler library provides limited support for UFAS format files. The callable routines parallel the GMAP macros supplied in the macro file .DMAC.

The routines are loaded by requesting the UFAS Standard Library, by specifying "StandardLibrary=ufas" on the C command line.

File Formats:

The library routines support files and/or tapes in GFRC format, ISP format, and UFF format files of Sequential, Relative, and Indexed organization. For access to GFRC disk files, you should normally use the regular C library.

Usage:

Each source file should include the file <ufas.h>. This defines the file pointer type (U_FILE), declares the functions, and defines keywords for the calls.

A call to the routine "u_open" will create a FIB and open the given file. This call replaces both the DLOPEN and FIBMAC macros. "u_open" returns a pointer to a structure, which is passed to other routines to perform I/O on that file. When the file is closed by calling "u_close", the FIB is released.

UFAS Packages:

By default, the routine "u_open" selects the appropriate package name (".daspi", ".dibla", etc.) according to the selected format, organization, access, and processing mode. Because of this a maximal set of routines is loaded, requiring about 20K words.

If the user wishes to reduce the size of the program, a reference to the external name "u_usym" (e.g. via the "USe=" compiler option) will prevent the routines from being loaded. Instead, the user must provide the package name on EVERY call to "u_open".

The include file <ufas.h> also declares all the package names, except that underscores replace periods in the names.

Hidden Macros:

Most of the UFAS macros correspond to one of the "U_" routines given in this package. However, three macros are missing: FIBMAC, UFSRET, and DWRAP.

The FIBMAC macro is not needed, since "u_open" builds the FIB according to the supplied arguments. Most of the FIBMAC options not supported by "u_open" are irrelevant to UFF or ISP files.

The UFSRET macro is used by GMAP error-handling routines to return control to UFAS. This macro is built into the C interface, and is automatically executed after the user's error function returns.

The DWRAP macro, which should be called to flush and close all the UFAS files before a program terminates, is likewise built into the C interface. The normal C wrapup will close all UFAS files just before the Standard I/O files are closed.

Error Functions:

If the user elects to provide error-handling functions, they should be declared as follows:

void func( ufile, stat )
U_FILE ufile;
char *stat;

where "ufile" is the file on which the error occurred and "stat" points to the two-byte status, followed by a null byte. The function may choose to call "longjmp" to handle the condition; if this is done, the only action subsequently allowed on this particular file is to close it, since UFAS has inhibited the file. Alternatively, the function may alter the second status byte (stat[1]), to change the action taken by the UFAS routines upon return from the error routine. The error routine can perform I/O on any other UFAS file which has not also been inhibited by an error, as well as on any standard I/O unit. The effect of changing the status byte is documented in the UFAS Manual, Chapter 11.

Label Functions:

User-supplied label handlers for GFRC tapes should be declared as:

void func( ufile, buffer )
U_FILE ufile;
unsigned *buffer;

where "ufile" is the file for which the label is being processed, and "buffer" is a pointer to the UFAS label buffer (which generally contains BCD characters).

Files used:

c/l66.0/ufas - The Random library containing the interface routines.

See Also:

GCOS8 OS Unified File Access System, Bull order number DH07.

expl c lib setjmp

Copyright © 1996, Thinkage Ltd.