@@ -72,7 +72,9 @@ FILE *gErrorStream = stderr;
72
72
#define kMaxPrintedErrors 10
73
73
74
74
75
- #ifndef __wasm__
75
+ // "__EMSCRIPTEN__" is defined automatically when Emscripten is used
76
+ // https://emscripten.org/docs/compiling/Building-Projects.html?highlight=SINGLE_FILE#detecting-emscripten-in-preprocessor
77
+ #ifndef __EMSCRIPTEN__
76
78
class AutoLink : public RCX_Link
77
79
{
78
80
public:
@@ -130,7 +132,7 @@ enum {
130
132
kHelpCode = kFirstActionCode ,
131
133
kApiCode ,
132
134
kCompileStdinCode ,
133
- #ifndef __wasm__
135
+ #ifndef __EMSCRIPTEN__
134
136
kDatalogCode ,
135
137
kDatalogFullCode ,
136
138
kClearMemoryCode ,
@@ -157,7 +159,7 @@ static const char *sActionNames[] = {
157
159
" help" ,
158
160
" api" ,
159
161
" " ,
160
- #ifndef __wasm__
162
+ #ifndef __EMSCRIPTEN__
161
163
" datalog" ,
162
164
" datalog_full" ,
163
165
" clear" ,
@@ -224,7 +226,7 @@ static void PrintApi(bool compatMode);
224
226
static bool SameString (const char *s1, const char *s2);
225
227
static void PrintVersion ();
226
228
227
- #ifndef __wasm__
229
+ #ifndef __EMSCRIPTEN__
228
230
static RCX_Result Download (RCX_Image *image);
229
231
static RCX_Result UploadDatalog (bool verbose);
230
232
static RCX_Result DownloadFirmware (const char *filename, bool fast);
@@ -258,7 +260,7 @@ int main(int argc, char **argv)
258
260
result = ProcessCommandLine (argc, argv);
259
261
PrintError (result);
260
262
261
- #ifndef __wasm__
263
+ #ifndef __EMSCRIPTEN__
262
264
gLink .Close ();
263
265
#endif
264
266
@@ -389,7 +391,7 @@ RCX_Result ProcessCommandLine(int argc, char ** argv)
389
391
case ' 1' :
390
392
req.fFlags |= Compiler::kCompat_Flag ;
391
393
break ;
392
- #ifndef __wasm__
394
+ #ifndef __EMSCRIPTEN__
393
395
case ' b' :
394
396
req.fBinary = true ;
395
397
break ;
@@ -607,7 +609,7 @@ RCX_Result ProcessFile(const char *sourceFile, const Request &req)
607
609
608
610
609
611
// The option to provide a file that is not to be compiled is not supported in WebAssembly
610
- #ifndef __wasm__
612
+ #ifndef __EMSCRIPTEN__
611
613
if (req.fDownload ) {
612
614
// The supplied input file was specified to not be compiled
613
615
result = Download (image);
@@ -700,7 +702,7 @@ RCX_Image *Compile(const char *sourceFile, int flags)
700
702
}
701
703
702
704
// There is no communication with the brick from WebAssembly
703
- #ifndef __wasm__
705
+ #ifndef __EMSCRIPTEN__
704
706
705
707
/* *
706
708
* Set the clock/watch on the target
@@ -1086,7 +1088,7 @@ void PrintError(RCX_Result error, const char *filename)
1086
1088
fprintf (STDERR, " Problem talking to IR device\n " );
1087
1089
break ;
1088
1090
case kRCX_ReplyError :
1089
- #ifndef __wasm__
1091
+ #ifndef __EMSCRIPTEN__
1090
1092
if (gLink .WasErrorFromMissingFirmware ()) {
1091
1093
fprintf (STDERR, " No firmware installed on %s\n " , targetName);
1092
1094
}
@@ -1186,7 +1188,7 @@ void PrintUsage()
1186
1188
fprintf (stdout," -q: quiet; suppress action sounds\n " );
1187
1189
fprintf (stdout," -O<outfile>: specify output file\n " );
1188
1190
fprintf (stdout," -1: use NQC API 1.x compatibility mode\n " );
1189
- #ifndef __wasm__
1191
+ #ifndef __EMSCRIPTEN__
1190
1192
fprintf (stdout," -b: treat input file as a binary file (don't compile it)\n " );
1191
1193
fprintf (stdout," Communication Options:\n " );
1192
1194
fprintf (stdout," -d: send program to \%s\n " , targetName);
@@ -1213,7 +1215,7 @@ void PrintUsage()
1213
1215
}
1214
1216
1215
1217
// No AutoLink instance in WebAssembly
1216
- #ifndef __wasm__
1218
+ #ifndef __EMSCRIPTEN__
1217
1219
RCX_Result AutoLink::Open ()
1218
1220
{
1219
1221
RCX_Result result;
0 commit comments