Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#ifndef VCC_COMPAT_STDIO_H
|
||||
#define VCC_COMPAT_STDIO_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#define EOF (-1)
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
// %% %c %s %d %i %u %o %x %X. Integer forms also accept l. A decimal
|
||||
// width, left alignment, zero padding, and string/integer precision are
|
||||
// supported. Return the full length, or -1 for unsupported formats or lengths
|
||||
// above INT_MAX. If capacity is positive the prefix is always NUL terminated.
|
||||
// A null destination is allowed when capacity is zero. Input and output must
|
||||
// not overlap.
|
||||
int snprintf(char *dest, size_t capacity, const char *format, ...);
|
||||
int vsnprintf(char *dest, size_t capacity, const char *format, va_list args);
|
||||
|
||||
// Two foreground Disk BASIC streams. Names use 8.3 format with an optional
|
||||
// :0 through :3 drive suffix (default :0). Modes r, w and a read, truncate
|
||||
// and append respectively; w/a create missing files. Append b for binary.
|
||||
// Add + for both input and output. r+ requires an existing file. w+ creates
|
||||
// or truncates; a+ creates or preserves. All three start reading at byte zero.
|
||||
// Every a+ write appends, even after a seek. Both +b and b+ select binary.
|
||||
// After input, seek or rewind before writing unless input encountered EOF.
|
||||
// Flush, seek or rewind between output and input.
|
||||
// Text reads fold CR, LF and CRLF to C newline; text writes C newline as CR.
|
||||
// Close streams before changing mounted media or writing through another API.
|
||||
typedef struct VCCFile FILE;
|
||||
FILE *fopen(const char *path, const char *mode);
|
||||
int fclose(FILE *stream);
|
||||
// Disk BASIC file management uses the same paths as fopen. Close participating
|
||||
// files first. rename stays on one drive and refuses an existing destination,
|
||||
// including an alias of the source. remove releases the file's granules.
|
||||
// Both return 0 on success or EOF on failure; inspect vcc_file_error().
|
||||
int rename(const char *oldPath, const char *newPath);
|
||||
int remove(const char *path);
|
||||
int fgetc(FILE *stream);
|
||||
char *fgets(char *dest, int capacity, FILE *stream);
|
||||
size_t fread(void *dest, size_t size, size_t count, FILE *stream);
|
||||
// Same conversions and length limit as snprintf. Return the number of bytes
|
||||
// accepted or a negative value on error. A prefix may already be written.
|
||||
// Check fflush or fclose for delayed disk errors.
|
||||
int fprintf(FILE *stream, const char *format, ...);
|
||||
int vfprintf(FILE *stream, const char *format, va_list args);
|
||||
int fputc(int c, FILE *stream);
|
||||
int fputs(const char *text, FILE *stream);
|
||||
size_t fwrite(const void *source, size_t size, size_t count, FILE *stream);
|
||||
// Publish data and the file's exact length. A fresh reader can open the file
|
||||
// while the writer remains open. Pass NULL to flush all open output streams.
|
||||
// Returns 0 on success or EOF on failure. Check fclose for delayed errors.
|
||||
int fflush(FILE *stream);
|
||||
// Positions are 32-bit offsets in the guest file. Binary streams support
|
||||
// signed offsets from any origin within the existing file. In text mode
|
||||
// restore an ftell bookmark with SEEK_SET, or use zero with any origin.
|
||||
// Seeking flushes pending output. The next append write still goes to EOF.
|
||||
long ftell(FILE *stream);
|
||||
int fseek(FILE *stream, long offset, int origin);
|
||||
// With <stdio.h> alone, rewind is an alias for this function, including
|
||||
// when taking its address. In a file that also includes CMOC's <disk.h>,
|
||||
// rewind keeps its FileDesc meaning; use vcc_rewind for a FILE stream.
|
||||
// A successful rewind clears EOF and errors. Check ferror after a retry.
|
||||
void vcc_rewind(FILE *stream);
|
||||
#ifndef _H_disk
|
||||
#define rewind vcc_rewind
|
||||
#endif
|
||||
int feof(FILE *stream);
|
||||
int ferror(FILE *stream);
|
||||
// Clear this open stream's EOF and error indicators. The position, pending
|
||||
// bytes and last I/O direction are preserved. To retry a failed flush on
|
||||
// the same disk, correct the cause, call clearerr, then call fflush again.
|
||||
void clearerr(FILE *stream);
|
||||
|
||||
// The latest failure (including a failed fopen). A successful fopen resets
|
||||
// this value to DECB_OK. See <decbfile.h> for DECB_ERR_* values.
|
||||
unsigned char vcc_file_error(void);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user