1. euc + edx - C generation issue
- Posted by axtens_bruce in March
- 492 views
I might be able to fix this for myself but others might not.
-Bruce
Euphoria to C Translator v4.2.0 development 64-bit Windows, Using System Memory Revision Date: 2024-01-19 01:49:39 Id: f24f7211dcc0b65b7824f24188b86cc88fb0b05e
C:\Euphoria\bin>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=C:/Users/bugma/scoop/apps/tdm-gcc/current/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-git-10.3.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,jit,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --enable-libstdcxx-threads --enable-libstdcxx-time=yes --enable-mingw-wildcard --with-gnu-ld --disable-werror --enable-nls --disable-win32-registry --enable-large-address-aware --disable-rpath --disable-symvers --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=https://github.com/jmeubank/tdm-gcc/issues Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.3.0 (tdm64-1)
C:\Euphoria\bin>euc edx.ex Build directory: build-581655\ Translating code, pass: 1 2 3 4 5 6 7 8 9 10 11 generating Compiling with GCC Compiling 2% init-.c Compiling 8% edx.c edx.c: In function '_1next_key': edx.c:4122:27: error: stray '#' in program 4122 | show_console() #endif // _WIN32 | ^ edx.c:4122:23: error: expected ';' before 'endif' 4122 | show_console() #endif // _WIN32 | ^ ~~~~~ | ; edx.c:4205:27: error: stray '#' in program 4205 | show_console() #endif // _WIN32 | ^ edx.c:4205:23: error: expected ';' before 'endif' 4205 | show_console() #endif // _WIN32 | ^ ~~~~~ | ; edx.c:4210:27: error: stray '#' in program 4210 | show_console() #endif // _WIN32 | ^ edx.c:4210:23: error: expected ';' before 'endif' 4210 | show_console() #endif // _WIN32 | ^ ~~~~~ | ; edx.c:4215:27: error: stray '#' in program 4215 | show_console() #endif // _WIN32 | ^ edx.c:4215:23: error: expected ';' before 'endif' 4215 | show_console() #endif // _WIN32 | ^ ~~~~~ | ; edx.c: In function '_1shell': edx.c:6901:27: error: stray '#' in program 6901 | show_console() #endif // _WIN32 | ^ edx.c:6901:23: error: expected ';' before 'endif' 6901 | show_console() #endif // _WIN32 edx.c:10994:27: error: stray '#' in program 10994 | show_console() #endif // _WIN32 | ^ edx.c:10994:23: error: expected ';' before 'endif' 10994 | show_console() #endif // _WIN32 | ^ ~~~~~ | ; edx.c: At top level: edx.c:10993: error: unterminated #if 10993 | #if _WIN32 | edx.c:6900: error: unterminated #if 6900 | #if _WIN32 | edx.c:4214: error: unterminated #if 4214 | #if _WIN32 | edx.c:4209: error: unterminated #if 4209 | #if _WIN32 | edx.c:4204: error: unterminated #if 4204 | #if _WIN32 | edx.c:4121: error: unterminated #if 4121 | #if _WIN32 | Couldn't compile file 'edx.c' Status: 1 Command: x86_64-w64-mingw32-gcc -DEWINDOWS -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -lws2_32 -Ic:/Euphoria -ffast-math edx.c
2. Re: euc + edx - C generation issue
- Posted by SDPringle in March
- 478 views
It seems like the C generator is failing to put newlines and semicolons after show_console.
3. Re: euc + edx - C generation issue
- Posted by SDPringle in March
- 464 views
It seems like I fixed this issue in another branch and have sent it up. It is in the "translator-portable-c" branch. You need to switch branches and download it.
If you have machines with differing platforms, I invite you to build the translator of the branch and translate a demo program with it using the '-makefile' option. The resulting code should be portable C. You can take the C code and compile it somewhere else without needing the translator or the Euphoria interpreter. Although you will need the library.
4. Re: euc + edx - C generation issue
- Posted by ghaberek (admin) in March
- 479 views
Looks like the problem is here: compile.e:6170. You should be able to just drop a semicolon in that string and then rebuild the translator.
procedure opGET_KEY() -- read an immediate key (if any) from the keyboard or return -1 m_stmtln("#if _WIN32") c_stmt0("show_console();") -- <-- missing semicolon goes here m_stmtln("#endif") CSaveStr("_0", Code[pc+1], 0, 0, 0) c_stmt("@ = get_key(0);\n", Code[pc+1]) CDeRefStr("_0") target = {-1, 1000} SetBBType(Code[pc+1], TYPE_INTEGER, target, TYPE_OBJECT, 0) pc += 2 end procedure
Alternatively, you can modify that line and then just run eui.exe euc.ex instead of euc.exe to test the changes. It will be slower but the output should be the same.
-Greg