n.c header order fixes

This commit is contained in:
ESL 2024-07-22 18:24:24 -04:00
parent d84362c0ab
commit 09e5b3b4f7
4 changed files with 15 additions and 10 deletions

3
n.c
View file

@ -1,5 +1,6 @@
/* n.c -- generated via skint nsf2c.ssc n.sf */ /* n.c -- generated via skint nsf2c.ssc n.sf */
#include "s.h"
#include "n.h" #include "n.h"
#ifdef NAN_BOXING #ifdef NAN_BOXING
@ -999,8 +1000,6 @@ void oportputshared(obj x, obj p, int disp) {
/* system-dependent extensions */ /* system-dependent extensions */
#include "s.h"
extern int is_tty_port(obj o) extern int is_tty_port(obj o)
{ {

View file

@ -4,6 +4,7 @@
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
(%include "s.h")
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -1526,7 +1527,6 @@ void oportputshared(obj x, obj p, int disp) {
; system-dependent extensions ; system-dependent extensions
(%localdef "/* system-dependent extensions */") (%localdef "/* system-dependent extensions */")
(%localdef "#include \"s.h\"")
(%localdef " (%localdef "
extern int is_tty_port(obj o) extern int is_tty_port(obj o)

View file

@ -41,13 +41,19 @@
(display ".c -- generated via skint nsf2c.ssc " oport) (display ".c -- generated via skint nsf2c.ssc " oport)
(display (path-strip-directory ifname) oport) (display (path-strip-directory ifname) oport)
(display " */" oport) (newline oport) (newline oport) (display " */" oport) (newline oport) (newline oport)
(display "#include \"" oport) (let loop ([x (read iport)] [end-of-includes? #f])
(display mname oport)
(display ".h\"" oport) (newline oport) (newline oport)
(let loop ([x (read iport)])
(unless (eof-object? x) (unless (eof-object? x)
(process-top-form x oport) (cond [end-of-includes?
(loop (read iport)))) (process-top-form x oport)
(loop (read iport) #t)]
[(and (list2? x) (eq? (car x) '%include) (string? (cadr x)))
(display "#include " oport) (write (cadr x) oport) (newline oport)
(loop (read iport) #f)]
[else ; switching to body forms
(display "#include \"" oport) (display mname oport)
(display ".h\"" oport) (newline oport) (newline oport)
(process-top-form x oport)
(loop (read iport) #t)])))
(close-input-port iport) (close-input-port iport)
(if (pair? ?ofname) (close-output-port oport))) (if (pair? ?ofname) (close-output-port oport)))

View file

@ -117,7 +117,7 @@ extern char **cxg_argv;
(case (car x) (case (car x)
[(%definition) (display (cadr x) oport) (newline oport)] [(%definition) (display (cadr x) oport) (newline oport)]
[(%localdef)] ; does not go into n.h [(%localdef)] ; does not go into n.h
[(%include)]))) ; time.h already in prelude [(%include)]))) ; all needed includes already included
(define (process-file ifname . ?ofname) (define (process-file ifname . ?ofname)
(define iport (open-input-file ifname)) ; relative to wd, not this script! (define iport (open-input-file ifname)) ; relative to wd, not this script!