Skip to content

Commit 8d82180

Browse files
committed
Alternative?
1 parent 81ea2cf commit 8d82180

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/libquickjs.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#include <R_ext/Error.h>
2-
#include <R_ext/Print.h>
1+
void Rf_error(const char *, ...);
2+
void Rprintf(const char *, ...);
3+
4+
//#include <R_ext/Error.h>
5+
//#include <R_ext/Print.h>
6+
#include <stdarg.h>
7+
#include <stdio.h>
8+
#include <stdlib.h>
39

410
void Rf_abort() {
511
Rf_error("Error!");
@@ -9,13 +15,20 @@ void Rf_exit(int code) {
915
Rf_error("Error: %d", code);
1016
}
1117

18+
void Rf_printf(void *file, const char *fmt, ...) {
19+
va_list args;
20+
va_start(args, fmt);
21+
Rprintf(fmt, args);
22+
va_end(args);
23+
}
24+
1225
#define abort Rf_abort
1326
#define exit Rf_exit
1427
#define _exit Rf_exit
15-
#define fprintf(file, ...) Rprintf(__VA_ARGS__)
16-
#define putchar(c) Rprintf("%s", c)
17-
#define stderr NULL
18-
#define stdout NULL
28+
#define fprintf Rf_printf
29+
//#define putchar Rprintf
30+
//#define stderr NULL
31+
//#define stdout NULL
1932

2033
#include "quickjs/cutils.c"
2134
#include "quickjs/libbf.c"

0 commit comments

Comments
 (0)