From a12f58ad91b65838b1fd166b1b7bb525f8b5d76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 10 Oct 2023 07:14:16 +0200 Subject: [PATCH] detect single-header use in lab --- MAKE.bat | 7 +++++-- bind/lua | Bin 12153344 -> 12153344 bytes bind/v4k.lua | 28 ++++++++++++++-------------- engine/joint/v4k.h | 38 +++++++++++++++----------------------- engine/split/v4k_pack.h | 31 +++++++++++++++---------------- engine/split/v4k_system.h | 7 ------- engine/v4k.h | 38 +++++++++++++++----------------------- 7 files changed, 64 insertions(+), 85 deletions(-) diff --git a/MAKE.bat b/MAKE.bat index 6fcc42b..9865a8f 100644 --- a/MAKE.bat +++ b/MAKE.bat @@ -695,7 +695,6 @@ for %%f in ("workbench\plugins\*.c") do ( rem demos if "!demos!"=="yes" ( !echo! 00-ui && !cc! !o! 00-ui.exe demos\00-ui.c !import! !args! || set rc=1 -!echo! 00-loop && !cc! !o! 00-loop.exe demos\00-loop.c !import! !args! || set rc=1 !echo! 00-script && !cc! !o! 00-script.exe demos\00-script.c !import! !args! || set rc=1 !echo! 00-hello && !cc! !o! 00-hello.exe demos\00-hello.c !import! !args! || set rc=1 !echo! 01-sprite && !cc! !o! 01-sprite.exe demos\01-sprite.c !import! !args! || set rc=1 @@ -721,7 +720,11 @@ if "!demos!"=="yes" ( rem lab if "!lab!"=="yes" ( for %%f in ("demos\99-*") do ( - !echo! %%~nf && !cc! !o! %%~nf.exe demos\%%~nf.c !import! !args! || set rc=1 + set limport=!import! + >nul find "V4K_IMPLEMENTATION" demos\%%~nf.c && ( + set limport= + ) + !echo! %%~nf && !cc! !o! %%~nf.exe demos\%%~nf.c !limport! !args! || set rc=1 ) ) diff --git a/bind/lua b/bind/lua index a0125b971a4443debffe09bc68af6d04e00c4a8c..2c458c942157d19dbc7b2adac36a5afccebfb9a6 100644 GIT binary patch delta 1452 zcmXxeYfw~W9LMoJXL)qFFBg$pxWQVOA`1j4#j>U%2r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0rP|%< z7iG&%YHsOEYVPQme_aAP8(m#VskUros?Ht3jZ5jBsdM8X`n8!l&-6g*uB}4%rPHPB zCQsly`V={b>-1Y>$~K|%(e0#1nVs<@7cJi*bp9nSossN8Fx^A`ig5ZZa{Er9i=j7= zU%^VBChb*1mq_1Ce&MZ}^pgC@fL=l z;BCBvcQK6jFoF{}iBotVqZq?DPU8$Fa26lnL!84$n8e5U1XK7F=b_>PF5)w2TGi~O HiKG7k75gFg diff --git a/bind/v4k.lua b/bind/v4k.lua index 6acbe37..77d0f34 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -2204,25 +2204,25 @@ bool id_valid(uintptr_t id); uint64_t swap64( uint64_t x ); float swap32f(float n); double swap64f(double n); - uint16_t lil16(uint16_t n); - uint32_t lil32(uint32_t n); - uint64_t lil64(uint64_t n); - uint16_t big16(uint16_t n); - uint32_t big32(uint32_t n); - uint64_t big64(uint64_t n); - float lil32f(float n); - double lil64f(double n); - float big32f(float n); - double big64f(double n); + uint16_t lil16(uint16_t n); + uint32_t lil32(uint32_t n); + uint64_t lil64(uint64_t n); + float lil32f(float n); + double lil64f(double n); + uint16_t big16(uint16_t n); + uint32_t big32(uint32_t n); + uint64_t big64(uint64_t n); + float big32f(float n); + double big64f(double n); uint16_t* lil16p(void *p, int sz); - uint16_t* big16p(void *p, int sz); uint32_t* lil32p(void *p, int sz); - uint32_t* big32p(void *p, int sz); uint64_t* lil64p(void *p, int sz); - uint64_t* big64p(void *p, int sz); float * lil32pf(void *p, int sz); - float * big32pf(void *p, int sz); double * lil64pf(void *p, int sz); + uint16_t* big16p(void *p, int sz); + uint32_t* big32p(void *p, int sz); + uint64_t* big64p(void *p, int sz); + float * big32pf(void *p, int sz); double * big64pf(void *p, int sz); typedef uint16_t half; float half_to_float(half value); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index b80c662..38d41f6 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -16062,32 +16062,31 @@ API int is_little(); API uint16_t swap16( uint16_t x ); API uint32_t swap32( uint32_t x ); API uint64_t swap64( uint64_t x ); - API float swap32f(float n); API double swap64f(double n); -API uint16_t lil16(uint16_t n); -API uint32_t lil32(uint32_t n); -API uint64_t lil64(uint64_t n); -API uint16_t big16(uint16_t n); -API uint32_t big32(uint32_t n); -API uint64_t big64(uint64_t n); +API uint16_t lil16(uint16_t n); // swap16 as lil +API uint32_t lil32(uint32_t n); // swap32 as lil +API uint64_t lil64(uint64_t n); // swap64 as lil +API float lil32f(float n); // swap32 as lil +API double lil64f(double n); // swap64 as lil -API float lil32f(float n); -API double lil64f(double n); -API float big32f(float n); -API double big64f(double n); +API uint16_t big16(uint16_t n); // swap16 as big +API uint32_t big32(uint32_t n); // swap32 as big +API uint64_t big64(uint64_t n); // swap64 as big +API float big32f(float n); // swap32 as big +API double big64f(double n); // swap64 as big API uint16_t* lil16p(void *p, int sz); -API uint16_t* big16p(void *p, int sz); API uint32_t* lil32p(void *p, int sz); -API uint32_t* big32p(void *p, int sz); API uint64_t* lil64p(void *p, int sz); -API uint64_t* big64p(void *p, int sz); - API float * lil32pf(void *p, int sz); -API float * big32pf(void *p, int sz); API double * lil64pf(void *p, int sz); + +API uint16_t* big16p(void *p, int sz); +API uint32_t* big32p(void *p, int sz); +API uint64_t* big64p(void *p, int sz); +API float * big32pf(void *p, int sz); API double * big64pf(void *p, int sz); #if is(cl) @@ -17792,13 +17791,6 @@ API void trap_on_quit(int signal); // helper util API void trap_on_abort(int signal); // helper util API void trap_on_debug(int signal); // helper util -#define hton16 big16 -#define ntoh16 big16 -#define hton32 big32 -#define ntoh32 big32 -#define hton64 big64 -#define ntoh64 big64 - #define PANIC(...) PANIC(va(__VA_ARGS__), __FILE__, __LINE__) // die() ? API int (PANIC)(const char *error, const char *file, int line); diff --git a/engine/split/v4k_pack.h b/engine/split/v4k_pack.h index bc1de1c..6529312 100644 --- a/engine/split/v4k_pack.h +++ b/engine/split/v4k_pack.h @@ -7,32 +7,31 @@ API int is_little(); API uint16_t swap16( uint16_t x ); API uint32_t swap32( uint32_t x ); API uint64_t swap64( uint64_t x ); - API float swap32f(float n); API double swap64f(double n); -API uint16_t lil16(uint16_t n); -API uint32_t lil32(uint32_t n); -API uint64_t lil64(uint64_t n); -API uint16_t big16(uint16_t n); -API uint32_t big32(uint32_t n); -API uint64_t big64(uint64_t n); +API uint16_t lil16(uint16_t n); // swap16 as lil +API uint32_t lil32(uint32_t n); // swap32 as lil +API uint64_t lil64(uint64_t n); // swap64 as lil +API float lil32f(float n); // swap32 as lil +API double lil64f(double n); // swap64 as lil -API float lil32f(float n); -API double lil64f(double n); -API float big32f(float n); -API double big64f(double n); +API uint16_t big16(uint16_t n); // swap16 as big +API uint32_t big32(uint32_t n); // swap32 as big +API uint64_t big64(uint64_t n); // swap64 as big +API float big32f(float n); // swap32 as big +API double big64f(double n); // swap64 as big API uint16_t* lil16p(void *p, int sz); -API uint16_t* big16p(void *p, int sz); API uint32_t* lil32p(void *p, int sz); -API uint32_t* big32p(void *p, int sz); API uint64_t* lil64p(void *p, int sz); -API uint64_t* big64p(void *p, int sz); - API float * lil32pf(void *p, int sz); -API float * big32pf(void *p, int sz); API double * lil64pf(void *p, int sz); + +API uint16_t* big16p(void *p, int sz); +API uint32_t* big32p(void *p, int sz); +API uint64_t* big64p(void *p, int sz); +API float * big32pf(void *p, int sz); API double * big64pf(void *p, int sz); #if is(cl) diff --git a/engine/split/v4k_system.h b/engine/split/v4k_system.h index 0762890..20876c8 100644 --- a/engine/split/v4k_system.h +++ b/engine/split/v4k_system.h @@ -55,13 +55,6 @@ API void trap_on_quit(int signal); // helper util API void trap_on_abort(int signal); // helper util API void trap_on_debug(int signal); // helper util -#define hton16 big16 -#define ntoh16 big16 -#define hton32 big32 -#define ntoh32 big32 -#define hton64 big64 -#define ntoh64 big64 - #define PANIC(...) PANIC(va(__VA_ARGS__), __FILE__, __LINE__) // die() ? API int (PANIC)(const char *error, const char *file, int line); diff --git a/engine/v4k.h b/engine/v4k.h index c5714db..fb547e9 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -2129,32 +2129,31 @@ API int is_little(); API uint16_t swap16( uint16_t x ); API uint32_t swap32( uint32_t x ); API uint64_t swap64( uint64_t x ); - API float swap32f(float n); API double swap64f(double n); -API uint16_t lil16(uint16_t n); -API uint32_t lil32(uint32_t n); -API uint64_t lil64(uint64_t n); -API uint16_t big16(uint16_t n); -API uint32_t big32(uint32_t n); -API uint64_t big64(uint64_t n); +API uint16_t lil16(uint16_t n); // swap16 as lil +API uint32_t lil32(uint32_t n); // swap32 as lil +API uint64_t lil64(uint64_t n); // swap64 as lil +API float lil32f(float n); // swap32 as lil +API double lil64f(double n); // swap64 as lil -API float lil32f(float n); -API double lil64f(double n); -API float big32f(float n); -API double big64f(double n); +API uint16_t big16(uint16_t n); // swap16 as big +API uint32_t big32(uint32_t n); // swap32 as big +API uint64_t big64(uint64_t n); // swap64 as big +API float big32f(float n); // swap32 as big +API double big64f(double n); // swap64 as big API uint16_t* lil16p(void *p, int sz); -API uint16_t* big16p(void *p, int sz); API uint32_t* lil32p(void *p, int sz); -API uint32_t* big32p(void *p, int sz); API uint64_t* lil64p(void *p, int sz); -API uint64_t* big64p(void *p, int sz); - API float * lil32pf(void *p, int sz); -API float * big32pf(void *p, int sz); API double * lil64pf(void *p, int sz); + +API uint16_t* big16p(void *p, int sz); +API uint32_t* big32p(void *p, int sz); +API uint64_t* big64p(void *p, int sz); +API float * big32pf(void *p, int sz); API double * big64pf(void *p, int sz); #if is(cl) @@ -3859,13 +3858,6 @@ API void trap_on_quit(int signal); // helper util API void trap_on_abort(int signal); // helper util API void trap_on_debug(int signal); // helper util -#define hton16 big16 -#define ntoh16 big16 -#define hton32 big32 -#define ntoh32 big32 -#define hton64 big64 -#define ntoh64 big64 - #define PANIC(...) PANIC(va(__VA_ARGS__), __FILE__, __LINE__) // die() ? API int (PANIC)(const char *error, const char *file, int line);