Skip to content

Commit abab733

Browse files
committed
Replace __wasm__ define with __EMSCRIPTEN__
1 parent cf79990 commit abab733

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

nqc/nqc.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ FILE *gErrorStream = stderr;
7272
#define kMaxPrintedErrors 10
7373

7474

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__
7678
class AutoLink : public RCX_Link
7779
{
7880
public:
@@ -130,7 +132,7 @@ enum {
130132
kHelpCode = kFirstActionCode,
131133
kApiCode,
132134
kCompileStdinCode,
133-
#ifndef __wasm__
135+
#ifndef __EMSCRIPTEN__
134136
kDatalogCode,
135137
kDatalogFullCode,
136138
kClearMemoryCode,
@@ -157,7 +159,7 @@ static const char *sActionNames[] = {
157159
"help",
158160
"api",
159161
"",
160-
#ifndef __wasm__
162+
#ifndef __EMSCRIPTEN__
161163
"datalog",
162164
"datalog_full",
163165
"clear",
@@ -224,7 +226,7 @@ static void PrintApi(bool compatMode);
224226
static bool SameString(const char *s1, const char *s2);
225227
static void PrintVersion();
226228

227-
#ifndef __wasm__
229+
#ifndef __EMSCRIPTEN__
228230
static RCX_Result Download(RCX_Image *image);
229231
static RCX_Result UploadDatalog(bool verbose);
230232
static RCX_Result DownloadFirmware(const char *filename, bool fast);
@@ -258,7 +260,7 @@ int main(int argc, char **argv)
258260
result = ProcessCommandLine(argc, argv);
259261
PrintError(result);
260262

261-
#ifndef __wasm__
263+
#ifndef __EMSCRIPTEN__
262264
gLink.Close();
263265
#endif
264266

@@ -389,7 +391,7 @@ RCX_Result ProcessCommandLine(int argc, char ** argv)
389391
case '1':
390392
req.fFlags |= Compiler::kCompat_Flag;
391393
break;
392-
#ifndef __wasm__
394+
#ifndef __EMSCRIPTEN__
393395
case 'b':
394396
req.fBinary = true;
395397
break;
@@ -607,7 +609,7 @@ RCX_Result ProcessFile(const char *sourceFile, const Request &req)
607609

608610

609611
// The option to provide a file that is not to be compiled is not supported in WebAssembly
610-
#ifndef __wasm__
612+
#ifndef __EMSCRIPTEN__
611613
if (req.fDownload) {
612614
// The supplied input file was specified to not be compiled
613615
result = Download(image);
@@ -700,7 +702,7 @@ RCX_Image *Compile(const char *sourceFile, int flags)
700702
}
701703

702704
// There is no communication with the brick from WebAssembly
703-
#ifndef __wasm__
705+
#ifndef __EMSCRIPTEN__
704706

705707
/**
706708
* Set the clock/watch on the target
@@ -1086,7 +1088,7 @@ void PrintError(RCX_Result error, const char *filename)
10861088
fprintf(STDERR, "Problem talking to IR device\n");
10871089
break;
10881090
case kRCX_ReplyError:
1089-
#ifndef __wasm__
1091+
#ifndef __EMSCRIPTEN__
10901092
if (gLink.WasErrorFromMissingFirmware()) {
10911093
fprintf(STDERR, "No firmware installed on %s\n", targetName);
10921094
}
@@ -1186,7 +1188,7 @@ void PrintUsage()
11861188
fprintf(stdout," -q: quiet; suppress action sounds\n");
11871189
fprintf(stdout," -O<outfile>: specify output file\n");
11881190
fprintf(stdout," -1: use NQC API 1.x compatibility mode\n");
1189-
#ifndef __wasm__
1191+
#ifndef __EMSCRIPTEN__
11901192
fprintf(stdout," -b: treat input file as a binary file (don't compile it)\n");
11911193
fprintf(stdout,"Communication Options:\n");
11921194
fprintf(stdout," -d: send program to \%s\n", targetName);
@@ -1213,7 +1215,7 @@ void PrintUsage()
12131215
}
12141216

12151217
// No AutoLink instance in WebAssembly
1216-
#ifndef __wasm__
1218+
#ifndef __EMSCRIPTEN__
12171219
RCX_Result AutoLink::Open()
12181220
{
12191221
RCX_Result result;

0 commit comments

Comments
 (0)