text
stringlengths
0
834k
set ANY=.*
set HID_LINE=%WSOKAY%\(%IDENTIFIER%\)%WS%\(%INTEGER%\)%WS%\""\(%ANY%\)\""%WSOKAY%
rem -------------------------------
rem Okay, have SED change the above format
rem into the following formats (one format
rem for each output file
rem
rem #define HID_devstring devcontext#
rem #define BS_devstring ""helpstring""
rem
rem Example:
rem
rem #define HID_comctls]] 2000001
rem #define BS_comctls ""Microsoft Windows Common Controls""
rem
rem This format is needed by VBIDE.SRC and WIZARD.SRC as well
rem as all OLE controls.
rem
rem Note that comment lines at the beginning of a line
rem are carried through to the destination. This is
rem quite intentional.
rem Remove comments that don't begin a line
%SED% ""s#^\(..*\)//.*$#\1#g"" < %FILE_ID% >> %FILE_TMP1%
rem
rem Add the STRINGTABLE section to the .RC file
rem
echo #include ""%IncludedFile%"" >> %FILE_DEST3%
echo STRINGTABLE DISCARDABLE >> %FILE_DEST3%
echo BEGIN >> %FILE_DEST3%
rem Okay, go ahead and make the transformations
%SED% ""s/^%HID_LINE%$/#define HID_\1 \2/g"" < %FILE_TMP1% >> %FILE_DEST1%
%SED% ""s/^%HID_LINE%$/#define BS_\1 \""\3\""/g"" < %FILE_TMP1% >> %FILE_DEST2%
%SED% ""s/^%HID_LINE%$/ HID_\1 \& 65535 \""\3\""/g"" < %FILE_TMP1% >> %FILE_DEST3%
echo END >> %FILE_DEST3%
rem -------------------------------
rem Time for some error checking
if not exist %FILE_DEST1% goto NoDestCreated1
if not exist %FILE_DEST2% goto NoDestCreated2
if not exist %FILE_DEST3% goto NoDestCreated3
rem Are there any lines that were not in the correct
rem format and are not comments?
rem Remove all comments so we can check
rem the format of the lines.
rem Note that we need only check one
rem of the output files in order to
rem test the format of the input file.
if exist %FILE_TMP1% del %FILE_TMP1%
if exist %FILE_TMP2% del %FILE_TMP2%
%SED% ""s#%WSOKAY%//.*$##g"" < %FILE_DEST1% > %FILE_TMP1%
set FILE_BAD=%FILE_DEST1%.ERR
if exist %FILE_BAD% del %FILE_BAD%
rem Now remove blank lines
%GREP% -v ""^$"" %FILE_TMP1% > %FILE_TMP2%
rem Now find any lines in an incorrect format
%GREP% -v ""#define "" %FILE_TMP2% > %FILE_BAD%
rem Did grep write any lines to %FILE_BAD%?
if not errorlevel 1 goto BadFormat
rem Remove empty error file
if exist %FILE_BAD% del %FILE_BAD%
rem ------------------------------
rem Remove temporary files
if exist %FILE_TMP1% del %FILE_TMP1%
if exist %FILE_TMP2% del %FILE_TMP2%
goto end
:NoSource
echo %PROG%: The source file %FILE_ID% could not be found.
goto end
:ReadOnly1
echo %PROG%: Error: Could not delete destination file %FILE_DEST1%
goto end
:ReadOnly2
echo %PROG%: Error: Could not delete destination file %FILE_DEST2%
goto end
:Readonly3
echo %PROG%: Error: Could not delete destination file %FILE_DEST3%
goto end
:NoDestCreated1
echo %PROG%: Error: Something went wrong, %FILE_DEST1% was not created.
echo You might try setting _ECHO=1 and then running again to see what
echo failed.