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:
parent
49bbe94381
commit
c8e4098fb2
2 changed files with 20 additions and 10 deletions
|
@ -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
|
||||
if "%ARCH%" == "ARM" (
|
||||
if %BITS% == 64 (
|
||||
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-aarch64.zip"
|
||||
set MINGW_DIR=llvm-mingw-20231128-ucrt-aarch64
|
||||
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20240308/llvm-mingw-20240308-ucrt-aarch64.zip"
|
||||
set MINGW_DIR=llvm-mingw-20240308-ucrt-aarch64
|
||||
) else (
|
||||
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-armv7.zip"
|
||||
set MINGW_DIR=llvm-mingw-20231128-ucrt-armv7
|
||||
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20240308/llvm-mingw-20240308-ucrt-armv7.zip"
|
||||
set MINGW_DIR=llvm-mingw-20240308-ucrt-armv7
|
||||
)
|
||||
set MINGW_TEMP_FILE=temp.zip
|
||||
) else (
|
||||
|
|
|
@ -228,9 +228,9 @@ IF os$ = "LNX" THEN BATCHFILE_EXTENSION = ".sh"
|
|||
IF MacOSX THEN BATCHFILE_EXTENSION = ".command"
|
||||
|
||||
|
||||
DIM inlinedatastr(255) AS STRING
|
||||
DIM inlinedatastr(0 TO 255) AS STRING
|
||||
FOR i = 0 TO 255
|
||||
inlinedatastr(i) = str2$(i) + ","
|
||||
inlinedatastr(i) = "0x" + RIGHT$("0" + HEX$(i), 2) + ","
|
||||
NEXT
|
||||
|
||||
|
||||
|
@ -11962,13 +11962,23 @@ ELSE
|
|||
'inline data
|
||||
ff = OpenBuffer%("B", tmpdir$ + "data.bin")
|
||||
x$ = ReadBufRawData$(ff, GetBufLen&(ff))
|
||||
x2$ = "uint8 inline_data[]={"
|
||||
FOR i = 1 TO LEN(x$)
|
||||
x2$ = x2$ + inlinedatastr$(ASC(x$, i))
|
||||
|
||||
idsL = LEN(inlinedatastr(255))
|
||||
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
|
||||
x2$ = x2$ + "0};"
|
||||
|
||||
WriteBufLine GlobTxtBuf, "uint8 inline_data[]={"
|
||||
WriteBufLine GlobTxtBuf, x2$
|
||||
WriteBufLine GlobTxtBuf, "0};"
|
||||
WriteBufLine GlobTxtBuf, "uint8 *data=&inline_data[0];"
|
||||
|
||||
x$ = "": x2$ = ""
|
||||
|
||||
END IF
|
||||
|
|
Loading…
Reference in a new issue