* On Thu, 14 Apr 2005, Jacek Caban wrote:
*Saulius Krasuckas wrote:
And the second question is: should it go to the "include/wine/test.h" or some separate header like a "include/wine/strings.h".
wine/test.h doesn't seems to me to be a good place for it. Also, as it's used only in tests, wine/strings.h doesn't need this. I think the best place is the source of the test.
* On Thu, 14 Apr 2005, Paul Millar wrote:
I think really we want a separate module that can be linked in as part of the build process. I've always thought (albeit secretly) that having functions inside include/wine/test.h is a bit of a hack.
So I see two ways to solve this:
1, writing winetest_atoi() inside a separate file (lets say atoi.c) and duplicating it across some parts of the Winetest (mlang, ole32).
2, linking dinamycally these Winetest binaries to shlwapi.dll, which implements StrToIntA() already:
| [s2@katleriai wine]$ grep -B15 -A1 WINAPI.*StrToIntA dlls/shlwapi/string.c | /************************************************************************* | * StrToIntA [SHLWAPI.@] | * | * Read a signed integer from a string. | * | * PARAMS | * lpszStr [I] String to read integer from | * | * RETURNS | * The signed integer value represented by the string, or 0 if no integer is | * present. | * | * NOTES | * No leading space is allowed before the number, although a leading '-' is. | */ | int WINAPI StrToIntA(LPCSTR lpszStr) | {
Is the latter way acceptable, what does the crew think?
'fraid your code also doesn't handle text (of any type) after the numbers; c.f. http://www.astro.gla.ac.uk/users/paulm/test_atoi.c
Thanks for the test suite, Paul.
But how come, not all Winetest parts misses this import (NTDLL.DLL:atoi)? Given the code:
| [s2@katleriai wine]$ grep -A16 int.*main( include/wine/test.h | int main( int argc, char **argv ) | { | char *p; | | setvbuf (stdout, NULL, _IONBF, 0); | | winetest_argc = argc; | winetest_argv = argv; | | if ((p = getenv( "WINETEST_PLATFORM" ))) winetest_platform = p; | if ((p = getenv( "WINETEST_DEBUG" ))) winetest_debug = atoi(p); | if ((p = getenv( "WINETEST_INTERACTIVE" ))) winetest_interactive = atoi(p); | if ((p = getenv( "WINETEST_REPORT_SUCCESS"))) report_success = atoi(p); | if (!argv[1]) usage( argv[0] ); | | return run_test(argv[1]); | }
why isn't miss happening in every Winetest part?