]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/_file.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / common / _file.s
index 19e6ac20257f0c99bc248c9ec5e21eac4025960a..84686a062ac834d3dbfeacaf96c82ddbd4411306 100644 (file)
@@ -4,25 +4,35 @@
 ; Data for the stdio file stream.
 ;
 
-       .export         __filetab, _stdin, _stdout, _stderr
+               .export         __filetab
+
+        .include        "stdio.inc"
+        .include        "fcntl.inc"
+        .include        "_file.inc"
+
+;----------------------------------------------------------------------------
+; File data
 
 .data
 
 __filetab:
-in:    .byte   0, 1            ; stdin
-out:   .byte   1, 1            ; stdout
-err:   .byte   2, 1            ; stderr
-       .byte   0, 0            ; free slot
-       .byte   0, 0            ; free slot
-       .byte   0, 0            ; free slot
-       .byte   0, 0            ; free slot
-       .byte   0, 0            ; free slot
+        .byte   0, _FOPEN, 0    ; stdin
+        .byte   1, _FOPEN, 0    ; stdout
+        .byte   2, _FOPEN, 0    ; stderr
+.repeat FOPEN_MAX - 3
+        .byte   0, _FCLOSED, 0  ; free slot
+.endrepeat
+
+
+; Standard file descriptors
 
 _stdin:
-       .word   in
+       .word   __filetab + (STDIN_FILENO * .sizeof(_FILE))
 
 _stdout:
-       .word   out
+       .word   __filetab + (STDOUT_FILENO * .sizeof(_FILE))
 
 _stderr:
-       .word   err
+       .word   __filetab + (STDERR_FILENO * .sizeof(_FILE))
+
+