fix underscores in errno (and related) headers

This commit is contained in:
mrdudz 2022-08-28 21:36:22 +02:00
parent 6ba3deffa4
commit 5d390489a8
4 changed files with 31 additions and 21 deletions

View File

@ -4,10 +4,10 @@
; Variables and functions
.global __errno, __oserror
.global __osmaperrno
.global __seterrno
.global __directerrno, __mappederrno
.global ___errno, ___oserror
.global ___osmaperrno
.global ___seterrno
.global ___directerrno, ___mappederrno
; Error codes, must match the values in the C headers
.enum

View File

@ -225,7 +225,7 @@ void cbm_k_untlk (void);
/* The cbm_* I/O functions below set _oserror (see errno.h),
/* The cbm_* I/O functions below set __oserror (see errno.h),
** in case of an error.
**
** error-code BASIC error
@ -251,7 +251,7 @@ unsigned int __fastcall__ cbm_load (const char* name, unsigned char device, void
** address of the file if "data" is the null pointer (like load"name",8,1
** in BASIC).
** Returns number of bytes that were loaded if loading was successful;
** otherwise 0, "_oserror" contains an error-code, then (see table above).
** otherwise 0, "__oserror" contains an error-code, then (see table above).
*/
unsigned char __fastcall__ cbm_save (const char* name, unsigned char device,
@ -274,7 +274,7 @@ void __fastcall__ cbm_close (unsigned char lfn);
int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size);
/* Reads up to "size" bytes from a file into "buffer".
** Returns the number of actually-read bytes, 0 if there are no bytes left.
** -1 in case of an error; then, _oserror contains an error-code (see table
** -1 in case of an error; then, __oserror contains an error-code (see table
** above). (Remember: 0 means end-of-file; -1 means error.)
*/
@ -282,7 +282,7 @@ int __fastcall__ cbm_write (unsigned char lfn, const void* buffer,
unsigned int size);
/* Writes up to "size" bytes from "buffer" to a file.
** Returns the number of actually-written bytes, or -1 in case of an error;
** _oserror contains an error-code, then (see above table).
** __oserror contains an error-code, then (see above table).
*/
unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...);

View File

@ -35,9 +35,9 @@
/* Please note: All functions in this file will set _oserror *and* return its
** value. The only exception is dio_open, which will return NULL, but _oserror
** will be set. All function will also set _oserror in case of successful
/* Please note: All functions in this file will set __oserror *and* return its
** value. The only exception is dio_open, which will return NULL, but __oserror
** will be set. All function will also set __oserror in case of successful
** execution, effectively clearing it.
*/

View File

@ -45,12 +45,17 @@
/* Operating system specific error code */
extern unsigned char _oserror;
extern unsigned char __oserror;
extern int _errno;
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _oserror __oserror
#endif
extern int __errno;
/* System errors go here */
#define errno _errno
#define errno __errno
/* errno must be a macro */
@ -83,21 +88,26 @@ extern int _errno;
int __fastcall__ _osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from _oserror)
int __fastcall__ __osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from __oserror)
** into one of the E... codes above. It is user callable.
*/
unsigned char __fastcall__ _seterrno (unsigned char code);
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _osmaperrno __osmaperrno
#endif
unsigned char __fastcall__ __seterrno (unsigned char code);
/* Set errno to a specific error code and return zero. Used by the library */
int __fastcall__ _directerrno (unsigned char code);
/* Set errno to a specific error code, clear _oserror and return -1. Used
int __fastcall__ __directerrno (unsigned char code);
/* Set errno to a specific error code, clear __oserror and return -1. Used
** by the library.
*/
int __fastcall__ _mappederrno (unsigned char code);
/* Set _oserror to the given platform specific error code. If it is a real
int __fastcall__ __mappederrno (unsigned char code);
/* Set __oserror to the given platform specific error code. If it is a real
** error code (not zero) set errno to the corresponding system error code
** and return -1. Otherwise return zero.
** Used by the library.