fix wrc to handle multiline strings like msvc6's rc

Dan Kegel dank at kegel.com
Sat Jan 18 18:07:54 CST 2003


As discussed with davep.  Gets us one step closer to being
able to build our apps either with gcc as winelib apps or
with msvc6 as .exe's.

Changelog:
     * tools/wrc/parser.l: \ at EOL in string now behaves like in msvc6's rc
     * programs/wcmd/wcmdrc.rc: added \n on continued lines to match new wrc behavior

Note: several other .rc files had trailing backslashes in
strings, but they looked like they might have already
been written assuming the new behavior, so I let them be.

Copyright 2003 Dan Kegel.  License: LGPL

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
-------------- next part --------------
Index: tools/wrc/parser.l
===================================================================
RCS file: /home/wine/wine/tools/wrc/parser.l,v
retrieving revision 1.22
diff -d -u -r1.22 parser.l
--- tools/wrc/parser.l	15 Aug 2002 21:57:36 -0000	1.22
+++ tools/wrc/parser.l	18 Jan 2003 23:44:39 -0000
@@ -456,6 +456,7 @@
 <yylstr>\\x[0-9a-fA-F]{1,3} {  yyerror("Invalid hex escape sequence '%s'", yytext); }
 
 <yylstr>\\[0-9]+	yyerror("Bad escape sequence");
+<yylstr>\\\n{ws}*	;	/* backslash at EOL continues string after leading whitespace on next line */
 <yylstr>\\a		addwchar('\a');
 <yylstr>\\b		addwchar('\b');
 <yylstr>\\f		addwchar('\f');
@@ -499,7 +500,8 @@
 			}
 <yystr>\\x[0-9a-fA-F]	{  yyerror("Invalid hex escape sequence '%s'", yytext); }
 
-<yystr>\\[0-9]+		yyerror("Bad escape secuence");
+<yystr>\\[0-9]+		yyerror("Bad escape sequence");
+<yystr>\\\n{ws}*	;	/* backslash at EOL continues string after leading whitespace on next line */
 <yystr>\\a		addcchar('\a');
 <yystr>\\b		addcchar('\b');
 <yystr>\\f		addcchar('\f');
Index: programs/wcmd/wcmdrc.rc
===================================================================
RCS file: /home/wine/wine/programs/wcmd/wcmdrc.rc,v
retrieving revision 1.6
diff -d -u -r1.6 wcmdrc.rc
--- programs/wcmd/wcmdrc.rc	1 Jun 2002 02:55:52 -0000	1.6
+++ programs/wcmd/wcmdrc.rc	18 Jan 2003 23:44:39 -0000
@@ -22,12 +22,12 @@
 {
   WCMD_ATTRIB, "Help about ATTRIB\n"
   WCMD_CALL,
-"CALL <batchfilename> is used within a batch file to execute commands \
-from another batch file. When the batch file exits, control returns to \
-the file which called it. The CALL command may supply parameters to the \
-called procedure. \
- \
-Changes to default directory, environment variables etc made within a \
+"CALL <batchfilename> is used within a batch file to execute commands\n\
+from another batch file. When the batch file exits, control returns to\n\
+the file which called it. The CALL command may supply parameters to the\n\
+called procedure.\n\
+\n\
+Changes to default directory, environment variables etc made within a\n\
 called procedure are inherited by the caller.\n"
 
   WCMD_CD,     "Help about CD\n"
@@ -43,99 +43,99 @@
   WCMD_DIR,    "Help about DIR\n"
 
   WCMD_ECHO,
-"ECHO <string> displays <string> on the current terminal device.\
- \
-ECHO ON causes all subsequent commands in a batch file to be displayed\
-on the terminal device before they are executed.\
- \
-ECHO OFF reverses the effect of a previous ECHO ON (ECHO is OFF by\
-default). The ECHO OFF command can be prevented from displaying by\
+"ECHO <string> displays <string> on the current terminal device.\n\
+\n\
+ECHO ON causes all subsequent commands in a batch file to be displayed\n\
+on the terminal device before they are executed.\n\
+\n\
+ECHO OFF reverses the effect of a previous ECHO ON (ECHO is OFF by\n\
+default). The ECHO OFF command can be prevented from displaying by\n\
 preceding it with an @ sign.\n"
 
   WCMD_ERASE,  "Help about ERASE\n"
 
   WCMD_FOR,
-"The FOR command is used to execute a command for each of a set of files. \
- \
-Syntax: FOR %variable IN (set) DO command \
- \
-The requirement to double the % sign when using FOR in a batch file does \
+"The FOR command is used to execute a command for each of a set of files.\n\
+\n\
+Syntax: FOR %variable IN (set) DO command\n\
+\n\
+The requirement to double the % sign when using FOR in a batch file does\n\
 not exist in wcmd.\n"
 
   WCMD_GOTO,
-"The GOTO command transfers execution to another statement within a \
-batch file. \
- \
-The label which is the target of a GOTO may be up to 255 characters \
-long but may not include spaces (this is different to other operating \
-systems). If two or more identical labels exist in a batch file the \
-first one will always be executed. Attempting to GOTO a non-existent \
-label terminates the batch file execution. \
- \
+"The GOTO command transfers execution to another statement within a\n\
+batch file.\n\
+\n\
+The label which is the target of a GOTO may be up to 255 characters\n\
+long but may not include spaces (this is different to other operating\n\
+systems). If two or more identical labels exist in a batch file the\n\
+first one will always be executed. Attempting to GOTO a non-existent\n\
+label terminates the batch file execution.\n\
+\n\
 GOTO has no effect when used interactively.\n"
 
   WCMD_HELP,   "Help about HELP\n"
 
   WCMD_IF,
-"IF is used to conditionally execute a command.\
- \
-Syntax:	IF [NOT] EXIST filename command \
-	IF [NOT] string1==string2 command \
-	IF [NOT] ERRORLEVEL number command \
- \
-In the second form of the command, string1 and string2 must be in double \
+"IF is used to conditionally execute a command.\n\
+\n\
+Syntax:	IF [NOT] EXIST filename command\n\
+	IF [NOT] string1==string2 command\n\
+	IF [NOT] ERRORLEVEL number command\n\
+\n\
+In the second form of the command, string1 and string2 must be in double\n\
 quotes. The comparison is not case-sensitive.\n"
 
   WCMD_LABEL,  "Help about LABEL\n"
   WCMD_MD,     "Help about MD\n"
   WCMD_MKDIR,  "Help about MKDIR\n"
   WCMD_MOVE,
-"MOVE relocates a file or directory to a new point within the file system. \
- \
-If the item being moved is a directory then all the files and subdirectories \
-below the item are moved as well. \
- \
+"MOVE relocates a file or directory to a new point within the file system.\n\
+\n\
+If the item being moved is a directory then all the files and subdirectories\n\
+below the item are moved as well.\n\
+\n\
 MOVE fails if the old and new locations are on different DOS drive letters.\n"
 
   WCMD_PATH,
-"PATH displays or changes the wcmd search path. \
- \
-Entering PATH will display the current PATH setting (initially this is \
-the value given in your wine.conf file). To change the setting follow the \
-PATH command with the new value. \
- \
-It is also possible to modify the PATH by using the PATH environment \
-variable, for example: \
+"PATH displays or changes the wcmd search path.\n\
+\n\
+Entering PATH will display the current PATH setting (initially this is\n\
+the value given in your wine.conf file). To change the setting follow the\n\
+PATH command with the new value.\n\
+\n\
+It is also possible to modify the PATH by using the PATH environment\n\
+variable, for example:\n\
 		PATH %PATH%;c:\\temp \n"
 
   WCMD_PAUSE,
-"PAUSE displays a message on the screen 'Press Return key to continue'\
-and waits for the user to press the Return key. It is mainly useful in\
-batch files to allow the user to read the output of a previous command\
+"PAUSE displays a message on the screen 'Press Return key to continue'\n\
+and waits for the user to press the Return key. It is mainly useful in\n\
+batch files to allow the user to read the output of a previous command\n\
 before it scrolls off the screen.\n"
 
   WCMD_PROMPT,
-"PROMPT sets the command-line prompt.\
- \
-The string following the PROMPT command (and the space immediately after)\
-appears at the beginning of the line when wcmd is waiting for input.\
- \
-The following character strings have the special meaning shown:\
- \
-$$    Dollar sign         $_    Linefeed            $b    Pipe sign (|)\
-$d    Current date        $e    Escape              $g    > sign\
-$l    > sign              $n    Current drive       $p    Current path\
-$q    Equal sign          $t    Current time        $v    wcmd version\
- \
-Note that entering the PROMPT command without a prompt-string resets the\
-prompt to the default, which is the current drive letter followed by a\
-greater-than (>) sign.\
- \
-The prompt can also be changed by altering the PROMPT environment variable,\
+"PROMPT sets the command-line prompt.\n\
+\n\
+The string following the PROMPT command (and the space immediately after)\n\
+appears at the beginning of the line when wcmd is waiting for input.\n\
+\n\
+The following character strings have the special meaning shown:\n\
+\n\
+$$    Dollar sign         $_    Linefeed            $b    Pipe sign (|)\n\
+$d    Current date        $e    Escape              $g    > sign\n\
+$l    > sign              $n    Current drive       $p    Current path\n\
+$q    Equal sign          $t    Current time        $v    wcmd version\n\
+\n\
+Note that entering the PROMPT command without a prompt-string resets the\n\
+prompt to the default, which is the current drive letter followed by a\n\
+greater-than (>) sign.\n\
+\n\
+The prompt can also be changed by altering the PROMPT environment variable,\n\
 so the command 'SET PROMPT=text' has the same effect as 'PROMPT text'\n"
 
   WCMD_REM,
-"A command line beginning REM (followed by a space) performs no\
+"A command line beginning REM (followed by a space) performs no\n\
 action, and can therefore be used as a comment in a batch file.\n"
 
   WCMD_REN,    "Help about REN\n"
@@ -144,26 +144,26 @@
   WCMD_RMDIR,  "Help about RMDIR\n"
 
   WCMD_SET,
-"SET displays or changes the wcmd environment variables.\
- \
-SET without parameters shows all of the current environment.\
- \
-To create or modify an environment variable the syntax is:\
- \
-      SET <variable>=<value>\
- \
-where <variable> and <value> are character strings. There must be no\
-spaces either side of the equals sign, nor can the variable or value\
-have embedded spaces.\
- \
-Under Wine, the environment of the underlying operating system is\
-included into the Win32 environment, there will generally therefore be\
-many more values than in a native Win32 implementation. Note that it is\
+"SET displays or changes the wcmd environment variables.\n\
+\n\
+SET without parameters shows all of the current environment.\n\
+\n\
+To create or modify an environment variable the syntax is:\n\
+\n\
+      SET <variable>=<value>\n\
+\n\
+where <variable> and <value> are character strings. There must be no\n\
+spaces either side of the equals sign, nor can the variable or value\n\
+have embedded spaces.\n\
+\n\
+Under Wine, the environment of the underlying operating system is\n\
+included into the Win32 environment, there will generally therefore be\n\
+many more values than in a native Win32 implementation. Note that it is\n\
 not possible to affect the operating system environment from within wcmd.\n"
 
   WCMD_SHIFT,
-"SHIFT is used in a batch file to remove one parameter from the head of \
-the list, so parameter 2 becomes parameter 1 and so on. It has no effect \
+"SHIFT is used in a batch file to remove one parameter from the head of\n\
+the list, so parameter 2 becomes parameter 1 and so on. It has no effect\n\
 if called from the command line.\n"
 
   WCMD_TIME,   "Help about TIME\n"
@@ -171,16 +171,16 @@
   WCMD_TITLE,  "Sets the window title for the wcmd window, syntax TITLE [string]"
 
   WCMD_TYPE,
-"TYPE <filename> copies <filename> to the console device (or elsewhere\
+"TYPE <filename> copies <filename> to the console device (or elsewhere\n\
 if redirected). No check is made that the file is readable text.\n"
 
   WCMD_VERIFY,
-"VERIFY is used to set, clear or test the verify flag. Valid forms are: \
- \
-VERIFY ON	Set the flag \
-VERIFY OFF	Clear the flag \
-VERIFY		Displays ON or OFF as appropriate. \
- \
+"VERIFY is used to set, clear or test the verify flag. Valid forms are:\n\
+\n\
+VERIFY ON	Set the flag\n\
+VERIFY OFF	Clear the flag\n\
+VERIFY		Displays ON or OFF as appropriate.\n\
+\n\
 The verify flag has no function in Wine.\n"
 
   WCMD_VER,
@@ -189,34 +189,34 @@
   WCMD_VOL,    "Help about VOL\n"
 
   WCMD_EXIT,
-"EXIT terminates the current command session and returns\
+"EXIT terminates the current command session and returns\n\
 to the operating system or shell from which you invoked wcmd.\n"
 
-  1000, "WCMD built-in commands are:\
-ATTRIB\t\tShow or change DOS file attributes\
-CALL\t\tInvoke a batch file from inside another\
-CD (CHDIR)\tChange current default directory\
-CLS\t\tClear the console screen\
-COPY\t\tCopy file\
-CTTY\t\tChange input/output device\
-DATE\t\tShow or change the system date\
-DEL (ERASE)\tDelete a file or set of files\
-DIR\t\tList the contents of a directory\
-ECHO\t\tCopy text directly to the console output\
-HELP\t\tShow brief help details on a topic\
-MD (MKDIR)\tCreate a subdirectory\
-MOVE\t\tMove a file, set of files or directory tree\
-PATH\t\tSet or show the search path\
-PROMPT\t\tChange the command prompt\
-REN (RENAME)\tRename a file\
-RD (RMDIR)\tDelete a subdirectory\
-SET\t\tSet or show environment variables\
-TIME\t\tSet or show the current system time\
-TITLE\t\tSet the window title for the WCMD session\
-TYPE\t\tType the contents of a text file\
-VER\t\tShow the current version of WCMD\
-VOL\t\tShow the volume label of a disk device\
-EXIT\t\tClose down WCMD\n\
+  1000, "WCMD built-in commands are:\n\
+ATTRIB\t\tShow or change DOS file attributes\n\
+CALL\t\tInvoke a batch file from inside another\n\
+CD (CHDIR)\tChange current default directory\n\
+CLS\t\tClear the console screen\n\
+COPY\t\tCopy file\n\
+CTTY\t\tChange input/output device\n\
+DATE\t\tShow or change the system date\n\
+DEL (ERASE)\tDelete a file or set of files\n\
+DIR\t\tList the contents of a directory\n\
+ECHO\t\tCopy text directly to the console output\n\
+HELP\t\tShow brief help details on a topic\n\
+MD (MKDIR)\tCreate a subdirectory\n\
+MOVE\t\tMove a file, set of files or directory tree\n\
+PATH\t\tSet or show the search path\n\
+PROMPT\t\tChange the command prompt\n\
+REN (RENAME)\tRename a file\n\
+RD (RMDIR)\tDelete a subdirectory\n\
+SET\t\tSet or show environment variables\n\
+TIME\t\tSet or show the current system time\n\
+TITLE\t\tSet the window title for the WCMD session\n\
+TYPE\t\tType the contents of a text file\n\
+VER\t\tShow the current version of WCMD\n\
+VOL\t\tShow the volume label of a disk device\n\
+EXIT\t\tClose down WCMD\n\n\
 Enter HELP <command> for further information on any of the above commands\n"
 }
 LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL


More information about the wine-patches mailing list