add PLUG.bat

main
Dominik Madarász 2024-02-11 11:37:31 +01:00
parent b685dc7511
commit 0a2167cf68
5 changed files with 111 additions and 3 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ libv4k.*
*.dSYM
.DS_store
*.raddbg
plugins

107
PLUG.bat 100644
View File

@ -0,0 +1,107 @@
@echo off
setlocal enableDelayedExpansion
if "%1"=="add" if not "%2" == "" (
if not exist "plugins\%2" (
echo adding %2
git clone https://github.com/%2 "plugins\%2"
)
exit /b
)
if "%1"=="addlist" if not "%2" == "" (
if not exist "%2" (
echo provide valid recipe!
exit /b
)
for /f "tokens=* delims=" %%a in (%2) do (
if not exist "plugins\%%a" (
echo adding %%a
git clone https://github.com/%%a "plugins\%%a"
) else (
pushd "plugins\%%a"
git fetch
git rev-list --count HEAD..@{u} > repo.0
findstr /m "0" "repo.0" >nul
if !errorlevel!==0 (
echo already satisfied %%a
) else (
echo updating %%a
git pull
)
del repo.0
popd
)
)
exit /b
)
if "%1"=="del" if not "%2" == "" (
if exist "plugins\%2" (
echo deleting %2
rd /q /s "plugins\%2" && rem 1>nul 2>nul
)
exit /b
)
if not "%1"=="dir" ( echo plug ^[dir^|add^|addlist^|del^] && exit /b )
set fwk_done=no
goto dir_fwk
rem list plugins and descriptions
:dir_v4k
curl -s "https://api.github.com/search/repositories?q=v4k+topic:v4k+language:c+language:cpp+language:lua&sort=created&order=asc" > plugs.0
goto process_plugs
:dir_fwk
curl -s "https://api.github.com/search/repositories?q=fwk+topic:fwk+language:c+language:cpp+language:lua&sort=created&order=asc" > plugs.0
:process_plugs
findstr /C:"\"description\"" /C:"\"clone_url\"" plugs.0 > plugs.1 && rem /C:"\"name\""
rem remove keys, commas and quotes
if exist plugs.x del plugs.x
for /f "tokens=*" %%i in (plugs.1) do (
set var=%%i
set var=!var:,=!
set var=!var:"name": =!
set var=!var:"clone_url": =!
set var=!var:"description": =!
set var=!var:https://github.com/=!
set var=!var:.git=!
set var=!var:"=!
echo !var! >> plugs.x
)
rem determine number of lines
for /f %%i in ('find /c /v "" ^< plugs.x') do set "cnt=%%i"
rem read the file into an array
<plugs.x (
for /l %%i in (1 1 %cnt%) do (
set "str.%%i="
set /p "str.%%i="
)
)
rem combine odd/even lines
for /l %%i in (1 2 %cnt%) do (
set /A from=%%i+1
set /A to=%%i+2
for /l %%u in (!from! 2 !to!) do (
rem display the array values
if exist "plugins/!str.%%u!" ( echo [x] !str.%%u!: !str.%%i! ) else ( echo [ ] !str.%%u!: !str.%%i! )
)
)
rem clean up
del plugs.*
if "!fwk_done!"=="no" (
set fwk_done=yes
goto dir_v4k
)

View File

@ -363849,7 +363849,7 @@ const char *font_wrap(const char *text, float max_width) {
array(char*) words = strsplit(text, " ");
static __thread int slot = 0;
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
static __thread char buf[16][FONT_MAX_STRING_LEN] = {0};
int len = strlen(text) + array_count(words);
slot = (slot+1) % 16;

View File

@ -2295,7 +2295,7 @@ const char *font_wrap(const char *text, float max_width) {
array(char*) words = strsplit(text, " ");
static __thread int slot = 0;
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
static __thread char buf[16][FONT_MAX_STRING_LEN] = {0};
int len = strlen(text) + array_count(words);
slot = (slot+1) % 16;

View File

@ -10993,7 +10993,7 @@ const char *font_wrap(const char *text, float max_width) {
array(char*) words = strsplit(text, " ");
static __thread int slot = 0;
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
static __thread char buf[16][FONT_MAX_STRING_LEN] = {0};
int len = strlen(text) + array_count(words);
slot = (slot+1) % 16;