diff --git a/docs/demo b/docs/demo new file mode 100644 index 0000000..cd69a2f --- /dev/null +++ b/docs/demo @@ -0,0 +1,12 @@ +Write-Host "" +Write-Host "Welcome to CJIT!" +Write-Host "We'll be downloading our quick demo setup, please wait a bit," +Write-Host "then all will be found inside the 'cjit-demo' folder right here." +Invoke-WebRequest -OutFile "cjit.exe" -Uri "https://github.com/dyne/cjit/releases/latest/download/cjit.exe" +Invoke-WebRequest -OutFile "cjit-demo.tar.gz" -Uri "https://github.com/dyne/cjit/releases/latest/download/cjit-demo.tar.gz" +.\cjit.exe --xtgz cjit-demo.tar.gz +cp .\cjit.exe cjit-demo +cd cjit-demo +Write-Host "Ready to start! Follow the tutorial:" +Write-Host " --> https://dyne.org/docs/cjit <--" +Write-Host "" diff --git a/docs/demo.sh b/docs/demo.sh new file mode 100644 index 0000000..47f53ec --- /dev/null +++ b/docs/demo.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +echo +echo "Welcome to CJIT!" +echo "We'll be downloading our quick demo setup, please wait a bit," +echo "then all will be found inside the 'cjit-demo' folder right here." +curl -sLo cjit https://github.com/dyne/cjit/releases/latest/download/cjit-$(uname)-$(uname -m) +chmod +x cjit +curl -sLo cjit-demo.tar.gz https://github.com/dyne/cjit/releases/latest/download/cjit-demo.tar.gz +./cjit --xtgz cjit-demo.tar.gz +cp ./cjit cjit-demo/ +cd cjit-demo +echo "Ready to start! Follow the tutorial:" +echo " --> https://dyne.org/docs/cjit <--" +echo +exit 0 diff --git a/src/cjit.c b/src/cjit.c index 8f8c436..b6b3d59 100644 --- a/src/cjit.c +++ b/src/cjit.c @@ -37,7 +37,7 @@ #define tcc(cjit) (TCCState*)cjit->TCC #define setup if(!cjit->done_setup)cjit_setup(cjit) -#define debug(fmt,par) if(!cjit->quiet)_err(fmt,par) +#define debug(fmt,par) if(cjit->verbose)_err(fmt,par) // declared at bottom void _out(const char *fmt, ...); void _err(const char *fmt, ...); @@ -534,25 +534,25 @@ void cjit_set_output(CJITState *cjit, int output) { } void cjit_define_symbol(CJITState *cjit, const char *sym, const char *value) { tcc_define_symbol(tcc(cjit),sym,value); - if(!cjit->quiet)_err("+D %s",sym,value?value:""); + if(cjit->verbose)_err("+D %s %s",sym,value?value:""); } void cjit_add_include_path(CJITState *cjit, const char *path) { tcc_add_include_path(tcc(cjit), path); - if(!cjit->quiet)_err("+I %s",path); + debug("+I %s",path); } // TODO: temporary, to be reimplemented in linker.c void cjit_add_library_path(CJITState *cjit, const char *path) { tcc_add_library_path(tcc(cjit), path); - if(!cjit->quiet)_err("+L %s",path); + debug("+L %s",path); } // TODO: temporary, to be reimplemented in linker.c void cjit_add_library(CJITState *cjit, const char *path) { tcc_add_library(tcc(cjit), path); - if(!cjit->quiet)_err("+l %s",path); + debug("+l %s",path); } void cjit_set_tcc_options(CJITState *cjit, const char *opts) { tcc_set_options(tcc(cjit),opts); - if(!cjit->quiet)_err("+O %s",opts); + debug("+O %s",opts); } // stdout message free from context @@ -564,11 +564,7 @@ void _out(const char *fmt, ...) { va_end(args); msg[len] = '\n'; msg[len+1] = 0x0; //safety -#if defined(__EMSCRIPTEN__) - EM_ASM_({Module.print(UTF8ToString($0))}, msg); -#else write(fileno(stdout), msg, len+1); -#endif } // error message free from context @@ -581,11 +577,5 @@ void _err(const char *fmt, ...) { va_end(args); msg[len] = '\n'; msg[len+1] = 0x0; -#if defined(__EMSCRIPTEN__) - EM_ASM_({Module.printErr(UTF8ToString($0))}, msg); -#elif defined(__ANDROID__) - __android_log_print(ANDROID_LOG_ERROR, "ZEN", "%s", msg); -#else write(fileno(stderr),msg,len+1); -#endif } diff --git a/src/main.c b/src/main.c index 55889d1..7fdc2d0 100644 --- a/src/main.c +++ b/src/main.c @@ -253,10 +253,10 @@ int main(int argc, char **argv) { } else if(opt.ind < left_args) { // process files on commandline before separator - if(!CJIT->quiet)_err("Source code:"); + if(CJIT->verbose)_err("Source code:"); for (i = opt.ind; i < left_args; ++i) { const char *code_path = argv[i]; - if(!CJIT->quiet)_err("%c %s",(*code_path=='-'?'|':'+'), + if(CJIT->verbose)_err("%c %s",(*code_path=='-'?'|':'+'), (*code_path=='-'?"standard input":code_path)); if(*code_path=='-') { // stdin explicit #if defined(_WIN32)