Last active
October 21, 2020 07:42
-
-
Save guillaC/e4c8d25ef7fb7b48b94818f3ed4adae4 to your computer and use it in GitHub Desktop.
extract .h from .c files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL enableextensions | |
:start | |
SET /P project="project path:" | |
SET /P save="save path:" | |
SET tmp=%random% | |
CLS | |
FINDSTR /S /B /N /R /C:"#include" %project%\*.c>%tmp% | |
FOR /f "tokens=*" %%a IN (%tmp%) DO CALL :parse %%a | |
GOTO end | |
:parse | |
SET filename=%~2 | |
FOR /R %%x IN (*.h) DO ( | |
ECHO.%%x | FIND /I "%filename%">NUL && ( | |
>NUL COPY %%x %save%\%filename% | |
) | |
) | |
GOTO :eof | |
:end | |
:cycle | |
SET nb=%count% | |
SET count=0 | |
FOR %%x in (*.h) do set /a count+=1 | |
FOR %%f IN (.\*.h) DO ( | |
FINDSTR /S /B /N /R /C:"#include" %%f>%tmp% | |
FOR /f "tokens=*" %%a IN (%tmp%) DO CALL :parse %%a | |
) | |
IF NOT "%nb%"=="%count%" GOTO cycle | |
DEL %tmp% | |
ENDLOCAL | |
ECHO ok. | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment