Skip to content

Commit

Permalink
Replace __wasm__ define with __EMSCRIPTEN__
Browse files Browse the repository at this point in the history
  • Loading branch information
mesheets committed Jul 1, 2024
1 parent cf79990 commit abab733
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions nqc/nqc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ FILE *gErrorStream = stderr;
#define kMaxPrintedErrors 10


#ifndef __wasm__
// "__EMSCRIPTEN__" is defined automatically when Emscripten is used
// https://emscripten.org/docs/compiling/Building-Projects.html?highlight=SINGLE_FILE#detecting-emscripten-in-preprocessor
#ifndef __EMSCRIPTEN__
class AutoLink : public RCX_Link
{
public:
Expand Down Expand Up @@ -130,7 +132,7 @@ enum {
kHelpCode = kFirstActionCode,
kApiCode,
kCompileStdinCode,
#ifndef __wasm__
#ifndef __EMSCRIPTEN__
kDatalogCode,
kDatalogFullCode,
kClearMemoryCode,
Expand All @@ -157,7 +159,7 @@ static const char *sActionNames[] = {
"help",
"api",
"",
#ifndef __wasm__
#ifndef __EMSCRIPTEN__
"datalog",
"datalog_full",
"clear",
Expand Down Expand Up @@ -224,7 +226,7 @@ static void PrintApi(bool compatMode);
static bool SameString(const char *s1, const char *s2);
static void PrintVersion();

#ifndef __wasm__
#ifndef __EMSCRIPTEN__
static RCX_Result Download(RCX_Image *image);
static RCX_Result UploadDatalog(bool verbose);
static RCX_Result DownloadFirmware(const char *filename, bool fast);
Expand Down Expand Up @@ -258,7 +260,7 @@ int main(int argc, char **argv)
result = ProcessCommandLine(argc, argv);
PrintError(result);

#ifndef __wasm__
#ifndef __EMSCRIPTEN__
gLink.Close();
#endif

Expand Down Expand Up @@ -389,7 +391,7 @@ RCX_Result ProcessCommandLine(int argc, char ** argv)
case '1':
req.fFlags |= Compiler::kCompat_Flag;
break;
#ifndef __wasm__
#ifndef __EMSCRIPTEN__
case 'b':
req.fBinary = true;
break;
Expand Down Expand Up @@ -607,7 +609,7 @@ RCX_Result ProcessFile(const char *sourceFile, const Request &req)


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

// There is no communication with the brick from WebAssembly
#ifndef __wasm__
#ifndef __EMSCRIPTEN__

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

// No AutoLink instance in WebAssembly
#ifndef __wasm__
#ifndef __EMSCRIPTEN__
RCX_Result AutoLink::Open()
{
RCX_Result result;
Expand Down

0 comments on commit abab733

Please sign in to comment.