davep wrote:
On Saturday 18 Jan 2003 08:44, Dan Kegel wrote:
Remaining issue I could use help with:
- multiline strings from resource file are displayed with extra newline
between lines in wine, but not in windows. To reproduce, build either as winelib app or build under MSVC6, then run in wine; usage message comes out double-spaced. Help!
Use a backslash on the end of each line to escape the LF.
Look at programs/wcmd/wcmdrc.rc for an example.
I did. Unfortunately, if I do STRING_FOO, "This is a two-line \ string" it looks good in Wine, but it's run together on one line in Windows. Conversely, if I do STRING_FOO, "This is a two-line \n \ string" it looks good in Windows, but it's double-spaced in Wine.
Something's fishy here. Our .rc files should be usable in both environments without change. - Dan
On Saturday 18 Jan 2003 19:29, Dan Kegel wrote:
davep wrote:
On Saturday 18 Jan 2003 08:44, Dan Kegel wrote:
Remaining issue I could use help with:
- multiline strings from resource file are displayed with extra newline
between lines in wine, but not in windows. To reproduce, build either as winelib app or build under MSVC6, then run in wine; usage message comes out double-spaced. Help!
Use a backslash on the end of each line to escape the LF.
Look at programs/wcmd/wcmdrc.rc for an example.
I did. Unfortunately, if I do STRING_FOO, "This is a two-line \ string" it looks good in Wine, but it's run together on one line in Windows. Conversely, if I do STRING_FOO, "This is a two-line \n \ string" it looks good in Windows, but it's double-spaced in Wine.
Something's fishy here. Our .rc files should be usable in both environments without change.
I suspect it's a resource compiler thing. The history predates the mailing-list archives at winehq and also my own mail archive so it must be before 1999, but IIRC at that time the only resource compiler to support multi-line text was Borland's. At the time I was tinkering with WineLib applications and also working on wcmd, so I suggested to the developer of Wine's resource compiler that he follow the Borland convention. It seems that MS compilers now accept a similar but incompatible syntax (how unusual) which is the cause of your confusion.
Dave
Dan Kegel wrote:
- multiline strings from resource file are displayed with extra newline
between lines in wine, but not in windows. To reproduce, build either as winelib app or build under MSVC6, then run in wine; usage message comes out double-spaced. Help!
Unfortunately, if I do STRING_FOO, "This is a two-line \ string" it looks good in Wine, but it's run together on one line in Windows. Conversely, if I do STRING_FOO, "This is a two-line \n \ string" it looks good in Windows, but it's double-spaced in Wine.
Something's fishy here. Our .rc files should be usable in both environments without change.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tools/rc_49... says that \ is a simple line-continuation character. Thus \ at the end of a line in the .rc file should not insert a newline in the resource, I think. And it looks like our resource compiler is violating this. Compiling the stringtable entry
1, "xx\ yy"
yields different results with our compiler and the one in vc6:
$ tools/wrc/wrc rsrc.rc -o x.res
$ hexdump -C x.res 00000000 00 00 00 00 20 00 00 00 ff ff 00 00 ff ff 00 00 |.... ...........| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 2a 00 00 00 20 00 00 00 ff ff 06 00 ff ff 07 00 |*... ...........| 00000030 00 00 00 00 00 10 09 04 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 05 00 78 00 78 00 |............x.x.| 00000050 0a 00 79 00 79 00 00 00 00 00 00 00 00 00 00 00 |..y.y...........| 00000060 00 00 00 00 00 00 00 00 00 00 00 00 |............| 0000006c
$ wine /dos/c/Program\ Files/Microsoft\ Visual\ Studio/Common/MSDev98/bin/rc.exe /r /fo y.res rsrc.rc
$ hexdump -C y.res 00000000 00 00 00 00 20 00 00 00 ff ff 00 00 ff ff 00 00 |.... ...........| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 28 00 00 00 20 00 00 00 ff ff 06 00 ff ff 07 00 |(... ...........| 00000030 00 00 00 00 30 10 09 04 00 00 00 00 00 00 00 00 |....0...........| 00000040 00 00 00 00 00 00 00 00 00 00 04 00 78 00 78 00 |............x.x.| 00000050 79 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00 |y.y.............| 00000060 00 00 00 00 00 00 00 00 |........|
After squinting at our source, I came up with a one-line patch to fix our resource compiler (attached). If that looks good, I can do a patch that fixes up all our .rc files that expected backslash to behave in a nonstandard way. - Dan
On Saturday 18 Jan 2003 21:45, Dan Kegel wrote:
Something's fishy here. Our .rc files should be usable in both environments without change.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tools/rc_ 490l.asp says that \ is a simple line-continuation character. Thus \ at the end of a line in the .rc file should not insert a newline in the resource, I think. And it looks like our resource compiler is violating this.
{snip}
After squinting at our source, I came up with a one-line patch to fix our resource compiler (attached). If that looks good, I can do a patch that fixes up all our .rc files that expected backslash to behave in a nonstandard way.
Right. I can't find reference in the documentation on Borland's way of handling this, and in any case BC5 is long obsolete. Patching Wine's resource compiler to work the way Win32 developers would expect looks like the Right Thing.
Dave
davep wrote:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tools/rc_ 490l.asp says that \ is a simple line-continuation character. Thus \ at the end of a line in the .rc file should not insert a newline in the resource, I think. And it looks like our resource compiler is violating this.
After squinting at our source, I came up with a one-line patch to fix our resource compiler (attached). If that looks good, I can do a patch that fixes up all our .rc files that expected backslash to behave in a nonstandard way.
Right. I can't find reference in the documentation on Borland's way of handling this, and in any case BC5 is long obsolete. Patching Wine's resource compiler to work the way Win32 developers would expect looks like the Right Thing.
OK. I improved my patch to handle L"strings", and made it eat whitespace at the beginning of continued lines (that's what msvc6's rc does). Also update wcmd's rc file to match; none of the others looked like they desperately needed changing.
To see the effect, blow away all your .res files before rebuilding, else make might not know to run wrc again.
Patch submitted to wine-patches (filename backslash-2.patch). - Dan