mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-22 14:30:29 +00:00
1 line
13 KiB
Plaintext
1 line
13 KiB
Plaintext
|
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* ks.fileio.e
*
* Description: This include file contains all the generic file
* support macros from Kopriha Software.
*
*
* Table of contents:
*
* Structures:
*
* KS_FILE . . . . . . . . . Structure to abstract a file
*
* Macros:
*
* + KS_FILE_CLOSE() . . . . . . . Close a file
* + KS_FILE_CHANGE_AUXTYPE() . . . Change the aux type of a file
* + KS_FILE_CREATE() . . . . . . . Create a file (w ftype,auxtype)
* + KS_FILE_DELETE() . . . . . . . Delete a file
* + KS_FILE_GET_BUFFER_SIZE(). . . Get the input/output buffer size
* + KS_FILE_GET_DIRECTORY() . . . Get the current directory
* + KS_FILE_GET_NEXT_FILE() . . . Get next filename from a directory
* + KS_FILE_GET_VOLUME() . . . . . Get volume name from pathname
* + KS_FILE_GET_VOLUME_SPACE() . . Get the total/available space on
* the specified volume
* + KS_FILE_OPEN() . . . . . . . . Open a file
* + KS_FILE_PATH_ADD_FILE() . . . Append a filename to a path/dir
* + KS_FILE_READ() . . . . . . . . Read from a file
* KS_FILE_RENAME() . . . . . . . Rename a file (given pathnames)
* + KS_FILE_SET_BUFFER_SIZE(). . . Set the input/output buffer size
* * KS_FILE_SET_DIRECTORY() . . . Set the current directory
* + KS_FILE_WRITE() . . . . . . . Write to a file
*
* + indicates that the routine was debugged
* * indicates the routine exists but was not debugged
*
*
* Notes:
*
* History:Oct 13, 1990 Dave Created this file for basic
* I/O (read/write)
*
* Feb 25, 1991 Dave Added buffer enhancements/create.
*
* Mar 5, 1991 Dave Added directory, file, path and
* volume calls
*
* Mar 24, 1991 Dave Added delete and change aux type
*
* Jun 07, 1991 Dave Broke the ks.fileio.cc module into
* lots of pieces so we could easily
* build a library.
*
* Jun 30, 1991 Dave Added a rename function.
*
*/
#ifndef _KS_FILEIO_E_
#define _KS_FILEIO_E_
#ifndef _KS_DEFINES_
#include "ks.defines.h"
#endif
#ifndef _GSOS_
#include <gsos.h>
#endif
/*
* Buffer flag constants - used to determine if a buffer should
* be used for I/O. The idea here is that if you specify a buffer,
* then you have to read/write without specifying a byte position
* (KS_NEXT_FILE_POSITION).
*/
#define KS_FILE_NO_BUFFER ((Word) 0)
#define KS_FILE_BUFFER_IO ((Word) 1)
#define KS_NEXT_FILE_POSITION ((Word) -1)
/*
* The following are definitions that I expected to find in the
* APW 1.1/Orca/C update, but could not. I want to be able to
* recompile without worrying about hard-coding constants in my
* program, I defined the following macros:
*/
#define KS_FILE_DATA_FORK ((Word) 0) /* For GS/OS Open */
#define KS_FILE_RESOURCE_FORK ((Word) 1)
#define KS_FILE_READ_ACCESS ((Word) readEnable)
#define KS_FILE_WRITE_ACCESS ((Word) writeEnable)
#define KS_BLOCK_DEVICE ((Word) 0x0080) /* used with DInfo */
/*
* KS_FILE - generic file structure
*/
typedef struct
{
KS_STRUCT_ID struct_id;/* Structure id */
Handle file_handle; /* Handle that created this structure */
Word refNum; /* Reference # (or channel #) of the file */
Word access; /* Access mode of file (read or write) */
LongWord eof; /* End of File of data fork */
LongWord resource_eof; /* End of file for resource fork */
/* Note: Not all systems support filetypes*/
Word fileType; /* Value of file's fileType attribute */
LongWord auxType; /* Auxilary file type */
LongWord data_size; /* Amount of data read/written for user */
Word end_of_file; /* TRUE==We've read to end of file */
Word end_of_dir; /* TRUE==We've read to end
|