1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-21 09:17:52 +00:00

Renamed oserrcheck to __mappederrno. Added an additional function named

__directerrno and moved both to errno.s. Changed several sources to use these
functions. Needs testing.
                         


git-svn-id: svn://svn.cc65.org/cc65/trunk@4718 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2010-06-10 18:10:53 +00:00
parent 5741b6e7d3
commit 131a5cad09
13 changed files with 124 additions and 108 deletions
-1
View File
@@ -146,7 +146,6 @@ S_OBJS = _cwd.o \
mkdir.o \
modfree.o \
modload.o \
oserrcheck.o \
printf.o \
putchar.o \
putenv.o \
+2 -2
View File
@@ -7,7 +7,7 @@
.export _chdir
.import __syschdir
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -17,7 +17,7 @@
.proc _chdir
jsr __syschdir ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc
+37 -3
View File
@@ -1,11 +1,45 @@
;
; Ullrich von Bassewitz, 06.06.1998
; Ullrich von Bassewitz, 2003-08-12
;
; int _errno;
; Helper functions for several high level file functions.
;
.export __errno
.include "errno.inc"
.code
; ----------------------------------------------------------------------------
; int __fastcall__ _directerrno (unsigned char code);
; /* Set errno to a specific error code, clear _oserror and return -1. Used
; * by the library.
; */
__directerrno:
jsr __seterrno ; Set errno, returns with A = 0
sta __oserror ; Clear __oserror
beq fail ; Branch always
; ----------------------------------------------------------------------------
; 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.
; */
__mappederrno:
sta __oserror ; Store the error code
tax ; Did we have an error?
beq ok ; Branch if no
jsr __osmaperrno ; Map os error into errno code
jsr __seterrno ; Save in errno
fail: lda #$FF ; Return -1
tax
ok: rts
; ----------------------------------------------------------------------------
.bss
__errno:
+2 -2
View File
@@ -7,7 +7,7 @@
.export _mkdir
.import __sysmkdir
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -15,6 +15,6 @@
.proc _mkdir
jsr __sysmkdir ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc
-30
View File
@@ -1,30 +0,0 @@
;
; Ullrich von Bassewitz, 2003-08-12
;
; Helper function for several high level file functions.
;
; The function will store the value in A into _oserror. If the value is not
; zero, it is translated into a standard error number which is then stored
; into errno, and -1 is returned in a/x. If the value in A was zero, errno
; is not changed, and zero is returned in a/x.
;
.export oserrcheck
.include "errno.inc"
.proc oserrcheck
sta __oserror ; Store the error code
tax ; Did we have an error?
beq ok ; Branch if no
jsr __osmaperrno ; Map os error into errno code
jsr __seterrno ; Save in errno
lda #$FF ; Return -1
tax
ok: rts
.endproc
+2 -2
View File
@@ -7,7 +7,7 @@
.export _remove
.import __sysremove
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -15,7 +15,7 @@
.proc _remove
jsr __sysremove ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc
+2 -2
View File
@@ -7,7 +7,7 @@
.export _rename
.import __sysrename
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -15,7 +15,7 @@
.proc _rename
jsr __sysrename ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc
+2 -2
View File
@@ -7,7 +7,7 @@
.export _rmdir
.import __sysrmdir
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -15,6 +15,6 @@
.proc _rmdir
jsr __sysrmdir ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc
+2 -2
View File
@@ -7,7 +7,7 @@
.export _uname
.import __sysuname
.import oserrcheck
.import __mappederrno
;--------------------------------------------------------------------------
@@ -15,7 +15,7 @@
.proc _uname
jsr __sysuname ; Call the machine specific function
jmp oserrcheck ; Store into _oserror, set errno, return 0/-1
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
.endproc