@xnetx/tinyc-native-arm64-apple-darwin 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ LIBTCCAPI void tcc_set_realloc(TCCReallocFunc *my_realloc);
|
|
|
16
16
|
|
|
17
17
|
/*****************************/
|
|
18
18
|
typedef struct TCCState TCCState;
|
|
19
|
+
typedef struct TCCIO TCCIO;
|
|
19
20
|
|
|
20
21
|
/* create a new TCC compilation context */
|
|
21
22
|
LIBTCCAPI TCCState *tcc_new(void);
|
|
@@ -30,6 +31,14 @@ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
|
|
|
30
31
|
typedef void TCCErrorFunc(void *opaque, const char *msg);
|
|
31
32
|
LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, TCCErrorFunc *error_func);
|
|
32
33
|
|
|
34
|
+
/* tinyc: install a TCCIO (tinyc_io.h) on a state; NULL restores the
|
|
35
|
+
* stdio default. All of the state's compiler output - diagnostics
|
|
36
|
+
* without an error callback, -E output, run stdio - goes through it. */
|
|
37
|
+
LIBTCCAPI void tcc_set_io(TCCState *s, TCCIO *io);
|
|
38
|
+
/* tinyc: the state's IO, or the stdio singleton when none (or a NULL
|
|
39
|
+
* state) is given. Never returns NULL. */
|
|
40
|
+
LIBTCCAPI TCCIO *tcc_get_io(TCCState *s);
|
|
41
|
+
|
|
33
42
|
/* set options as from command line (multiple supported) */
|
|
34
43
|
LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
|
|
35
44
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/* tinyc_io.h - IO abstraction for the TinyC dual-form kernel.
|
|
2
2
|
*
|
|
3
|
-
* All compiler-owned input/output goes through a TCCIO object
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* All compiler-owned input/output goes through a TCCIO object owned
|
|
4
|
+
* by a TCCState: tcc_set_io (libtcc.h) installs one on a state, and
|
|
5
|
+
* every compiler output path of that state - diagnostics, help,
|
|
6
|
+
* version, -E output, the -run stdio redirect - goes through it.
|
|
7
|
+
* There is no process-wide current IO. A state with no IO installed,
|
|
8
|
+
* and a NULL TCCIO everywhere in this API, mean the stdio
|
|
9
|
+
* implementation: output goes directly to the process's real
|
|
10
|
+
* stdout/stderr and input comes from the real stdin.
|
|
7
11
|
*/
|
|
8
12
|
#ifndef TINYC_IO_H
|
|
9
13
|
#define TINYC_IO_H
|
|
@@ -63,40 +67,40 @@ void tcc_io_free(TCCIO *io);
|
|
|
63
67
|
const char *tcc_io_buffer_data(TCCIO *io, int channel, size_t *len);
|
|
64
68
|
void tcc_io_buffer_clear(TCCIO *io);
|
|
65
69
|
|
|
66
|
-
/* ----
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
TCCIO *
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
void
|
|
77
|
-
void
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
void
|
|
81
|
-
|
|
82
|
-
/*
|
|
83
|
-
*
|
|
84
|
-
FILE *tinyc_io_open_out_stream(
|
|
70
|
+
/* ---- write helpers (used by the compiler's own output paths) ------- */
|
|
71
|
+
|
|
72
|
+
/* Each helper takes the IO to write to - a state's IO as returned by
|
|
73
|
+
* tcc_get_io (libtcc.h), or any TCCIO directly. A NULL IO, like a
|
|
74
|
+
* state with nothing installed, resolves to the stdio singleton. */
|
|
75
|
+
int tinyc_io_write_out(TCCIO *io, const char *buf, size_t len);
|
|
76
|
+
int tinyc_io_write_err(TCCIO *io, const char *buf, size_t len);
|
|
77
|
+
void tinyc_io_out_str(TCCIO *io, const char *s);
|
|
78
|
+
void tinyc_io_err_str(TCCIO *io, const char *s);
|
|
79
|
+
void tinyc_io_out_fmt(TCCIO *io, const char *fmt, ...);
|
|
80
|
+
void tinyc_io_err_fmt(TCCIO *io, const char *fmt, ...);
|
|
81
|
+
void tinyc_io_err_line(TCCIO *io, const char *s); /* writes s + "\n" to err */
|
|
82
|
+
/* Flush io; on Windows also delivers any of io's -E stream output
|
|
83
|
+
* still sitting in its temp file (see tinyc_io_open_out_stream). */
|
|
84
|
+
void tinyc_io_flush(TCCIO *io);
|
|
85
|
+
|
|
86
|
+
/* A FILE* whose writes forward to io's out channel, or NULL when io
|
|
87
|
+
* resolves to the stdio default (callers then keep using stdout). */
|
|
88
|
+
FILE *tinyc_io_open_out_stream(TCCIO *io);
|
|
85
89
|
|
|
86
90
|
/* ---- -run stdio redirection ----------------------------------------- */
|
|
87
91
|
|
|
88
|
-
/* Called by tcc_run around the run program's entry point
|
|
89
|
-
*
|
|
90
|
-
* redirected through it for the duration of
|
|
91
|
-
* bytes read_in returns (then EOF), and
|
|
92
|
-
* fd 1/2 is delivered to write_out/
|
|
93
|
-
* run ends. The host's fds are
|
|
94
|
-
*
|
|
95
|
-
* and the run program uses the process's real
|
|
96
|
-
* keep_stdin != 0 leaves fd 0 alone (tcc_run has already
|
|
97
|
-
* stdin from a file for the program). Nested calls are
|
|
98
|
-
* only the outermost pair redirects. */
|
|
99
|
-
void tinyc_run_redirect_begin(int keep_stdin);
|
|
92
|
+
/* Called by tcc_run around the run program's entry point, with the
|
|
93
|
+
* running state's IO. When that IO is a non-stdio TCCIO, the
|
|
94
|
+
* process's fd 0/1/2 are redirected through it for the duration of
|
|
95
|
+
* the run: fd 0 is fed the bytes read_in returns (then EOF), and
|
|
96
|
+
* what the program writes to fd 1/2 is delivered to write_out /
|
|
97
|
+
* write_err, per channel, when the run ends. The host's fds are
|
|
98
|
+
* restored by tinyc_run_redirect_end. With the stdio IO both
|
|
99
|
+
* functions are no-ops and the run program uses the process's real
|
|
100
|
+
* stdio. keep_stdin != 0 leaves fd 0 alone (tcc_run has already
|
|
101
|
+
* reopened stdin from a file for the program). Nested calls are
|
|
102
|
+
* counted: only the outermost pair redirects. */
|
|
103
|
+
void tinyc_run_redirect_begin(TCCIO *io, int keep_stdin);
|
|
100
104
|
void tinyc_run_redirect_end(void);
|
|
101
105
|
|
|
102
106
|
/* ---- run-path diagnostic markers ------------------------------------ */
|
|
@@ -113,8 +117,12 @@ void tinyc_diag_mark_ptr(const char *label, const void *p);
|
|
|
113
117
|
|
|
114
118
|
/* The compiler's real main, exported from the dual-form file. */
|
|
115
119
|
int tinyc_main(int argc, char **argv);
|
|
116
|
-
/* tinyc_main with
|
|
117
|
-
*
|
|
120
|
+
/* tinyc_main with io installed on every state main creates during
|
|
121
|
+
* the call (main builds a fresh state per pass). States created
|
|
122
|
+
* through the tcc_* API are unaffected. */
|
|
123
|
+
int tinyc_main_with_io(int argc, char **argv, TCCIO *io);
|
|
124
|
+
/* tinyc_main_with_io, plus a flush of io once main has returned:
|
|
125
|
+
* the form the packages' CLI capture calls bind. */
|
|
118
126
|
int tinyc_main_io(int argc, char **argv, TCCIO *io);
|
|
119
127
|
|
|
120
128
|
#ifdef __cplusplus
|