From ec6e648007860b64dd5b600677c32eeaba3b8dfe Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Sun, 27 Nov 2022 00:11:04 +0100 Subject: [PATCH] Simplify #include Solving #119 --- internal/c/qbx.cpp | 63 +++------------------------------------------- source/qb64pe.bas | 20 ++++----------- 2 files changed, 9 insertions(+), 74 deletions(-) diff --git a/internal/c/qbx.cpp b/internal/c/qbx.cpp index 851daef16..b89fa1aef 100755 --- a/internal/c/qbx.cpp +++ b/internal/c/qbx.cpp @@ -1291,13 +1291,8 @@ inline uint16 varseg_dblock_check(uint8 *off) { } } -#ifdef QB64_WINDOWS -#include "..\\temp\\global.txt" -#include "..\\temp\\regsf.txt" -#else #include "../temp/global.txt" #include "../temp/regsf.txt" -#endif extern int32 ScreenResize; extern int32 ScreenResizeScale; @@ -1306,21 +1301,13 @@ extern int32 ScreenResizeScale; // main() begins, to set global, static variables // controlling app init void set_dynamic_info() { -#ifdef QB64_WINDOWS -#include "..\\temp\\dyninfo.txt" -#else #include "../temp/dyninfo.txt" -#endif } void sub_clear(int32 ignore, int32 ignore2, int32 stack, int32 passed) { static ptrszint tmp_long; // note: stack can be ignored -#ifdef QB64_WINDOWS -#include "..\\temp\\clear.txt" -#else #include "../temp/clear.txt" -#endif // reset DATA read offset data_offset = 0; // close open files @@ -1399,11 +1386,7 @@ void chain_input() { sub_get(FF, NULL, byte_element((uint64)&int32val, 4), 0); // read COMMON data -#ifdef QB64_WINDOWS -#include "..\\temp\\inpchain.txt" -#else #include "../temp/inpchain.txt" -#endif sub_close(FF, 1); @@ -1614,11 +1597,7 @@ extensions_ready: chain_savescreenstate(FF); -#ifdef QB64_WINDOWS -#include "..\\temp\\chain.txt" -#else #include "../temp/chain.txt" -#endif // add "end of commands" value int32val = 0; sub_put(FF, NULL, byte_element((uint64)&int32val, 4), 0); @@ -2340,11 +2319,7 @@ onstrig_recheck: x = onstrig[(di << 8) + i].id; i64 = onstrig[(di << 8) + i].pass; switch (x) { -#ifdef QB64_WINDOWS -#include "..\\temp\\onstrig.txt" -#else #include "../temp/onstrig.txt" -#endif // example..... // case 1: //... @@ -2379,11 +2354,7 @@ onkey_recheck: x = onkey[i].id; i64 = onkey[i].pass; switch (x) { -#ifdef QB64_WINDOWS -#include "..\\temp\\onkey.txt" -#else #include "../temp/onkey.txt" -#endif // example..... // case 1: //... @@ -2412,17 +2383,11 @@ onkey_recheck: x = ontimer[i].id; i64 = ontimer[i].pass; switch (x) { - -#ifdef QB64_WINDOWS -#include "..\\temp\\ontimer.txt" -#else #include "../temp/ontimer.txt" -#endif - // example..... - // case 1: - //... - // break; - + // example..... + // case 1: + //... + // break; default: break; } // switch @@ -2526,25 +2491,6 @@ void QBMAIN(void *unused) { sf_mem_lock->type = 3; } -#ifdef QB64_WINDOWS -#include "..\\temp\\maindata.txt" -#include "..\\temp\\mainerr.txt" -#include "..\\temp\\runline.txt" - if (timer_event_occurred) { - timer_event_occurred--; -#include "..\\temp\\ontimerj.txt" - } - if (key_event_occurred) { - key_event_occurred--; -#include "..\\temp\\onkeyj.txt" - } - if (strig_event_occurred) { - strig_event_occurred--; -#include "..\\temp\\onstrigj.txt" - } - chain_input(); -#include "..\\temp\\main.txt" -#else #include "../temp/maindata.txt" #include "../temp/mainerr.txt" #include "../temp/runline.txt" @@ -2562,6 +2508,5 @@ void QBMAIN(void *unused) { } chain_input(); #include "../temp/main.txt" -#endif //} (closed by main.txt) diff --git a/source/qb64pe.bas b/source/qb64pe.bas index c97b42b3a..283419fc1 100644 --- a/source/qb64pe.bas +++ b/source/qb64pe.bas @@ -4804,21 +4804,11 @@ DO END IF 'dynamiclibrary IF LEN(headername$) THEN - IF os$ = "WIN" THEN - IF MID$(headername$, 2, 1) = ":" OR LEFT$(headername$, 1) = "\" THEN - WriteBufLine RegTxtBuf, "#include " + CHR$(34) + headername$ + CHR$(34) - ELSE - WriteBufLine RegTxtBuf, "#include " + CHR$(34) + "..\\..\\" + headername$ + CHR$(34) - END IF - END IF - IF os$ = "LNX" THEN - - IF LEFT$(headername$, 1) = "/" THEN - WriteBufLine RegTxtBuf, "#include " + CHR$(34) + headername$ + CHR$(34) - ELSE - WriteBufLine RegTxtBuf, "#include " + CHR$(34) + "../../" + headername$ + CHR$(34) - END IF - + IF (os$ = "WIN" AND (MID$(headername$, 2, 1) = ":" OR LEFT$(headername$, 1) = "\")) _ + OR (os$ = "LNX" AND (LEFT$(headername$, 1) = "/")) THEN + WriteBufLine RegTxtBuf, "#include " + CHR$(34) + headername$ + CHR$(34) + ELSE + WriteBufLine RegTxtBuf, "#include " + CHR$(34) + "../../" + headername$ + CHR$(34) END IF END IF