1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-20 02:04:44 +00:00

Optimize inline-data generation logic

This commit is contained in:
Samuel Gomes 2024-03-10 18:56:08 +05:30
parent 49bbe94381
commit c8e4098fb2
2 changed files with 20 additions and 10 deletions

View file

@ -68,11 +68,11 @@ rem MINGW_DIR is actually the internal directory name inside the zip / 7z file
rem It needs to be updated whenever the toolchains are updated rem It needs to be updated whenever the toolchains are updated
if "%ARCH%" == "ARM" ( if "%ARCH%" == "ARM" (
if %BITS% == 64 ( if %BITS% == 64 (
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-aarch64.zip" set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20240308/llvm-mingw-20240308-ucrt-aarch64.zip"
set MINGW_DIR=llvm-mingw-20231128-ucrt-aarch64 set MINGW_DIR=llvm-mingw-20240308-ucrt-aarch64
) else ( ) else (
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-armv7.zip" set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20240308/llvm-mingw-20240308-ucrt-armv7.zip"
set MINGW_DIR=llvm-mingw-20231128-ucrt-armv7 set MINGW_DIR=llvm-mingw-20240308-ucrt-armv7
) )
set MINGW_TEMP_FILE=temp.zip set MINGW_TEMP_FILE=temp.zip
) else ( ) else (

View file

@ -228,9 +228,9 @@ IF os$ = "LNX" THEN BATCHFILE_EXTENSION = ".sh"
IF MacOSX THEN BATCHFILE_EXTENSION = ".command" IF MacOSX THEN BATCHFILE_EXTENSION = ".command"
DIM inlinedatastr(255) AS STRING DIM inlinedatastr(0 TO 255) AS STRING
FOR i = 0 TO 255 FOR i = 0 TO 255
inlinedatastr(i) = str2$(i) + "," inlinedatastr(i) = "0x" + RIGHT$("0" + HEX$(i), 2) + ","
NEXT NEXT
@ -11962,13 +11962,23 @@ ELSE
'inline data 'inline data
ff = OpenBuffer%("B", tmpdir$ + "data.bin") ff = OpenBuffer%("B", tmpdir$ + "data.bin")
x$ = ReadBufRawData$(ff, GetBufLen&(ff)) x$ = ReadBufRawData$(ff, GetBufLen&(ff))
x2$ = "uint8 inline_data[]={"
FOR i = 1 TO LEN(x$) idsL = LEN(inlinedatastr(255))
x2$ = x2$ + inlinedatastr$(ASC(x$, i)) xL = LEN(x$)
x2$ = SPACE$(xL * idsL) ' pre-allocate buffer
x2Ofs = 1
FOR i = 1 TO xL
MID$(x2$, x2Ofs, idsL) = inlinedatastr(ASC(x$, i))
x2Ofs = x2Ofs + idsL
NEXT NEXT
x2$ = x2$ + "0};"
WriteBufLine GlobTxtBuf, "uint8 inline_data[]={"
WriteBufLine GlobTxtBuf, x2$ WriteBufLine GlobTxtBuf, x2$
WriteBufLine GlobTxtBuf, "0};"
WriteBufLine GlobTxtBuf, "uint8 *data=&inline_data[0];" WriteBufLine GlobTxtBuf, "uint8 *data=&inline_data[0];"
x$ = "": x2$ = "" x$ = "": x2$ = ""
END IF END IF