Dave ha scritto:
> Peter Wehrfritz ha scritto:
>
>> Gustavo Sverzut Barbieri schrieb:
>>
>>
>>> On Nov 23, 2007 3:45 AM, Dave <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>>> Hi all,
>>>> I recently have a strange bug in the editor that prevent from saving all
>>>> the file.
>>>> The problem is that engrave write out an edc with all the floating numbers
>>>> having the wrong separator-char ( 0,0 instead of 0.0 ).
>>>> The strange think is that engrave_test seems to work well
>>>> Someone else have this error?
>>>> To try simply create a new group,a new rectangle and save the file.
>>>> I have this error:
>>>>
>>>> Executing: edje_cc -v /tmp/edje_editor_tmp.edc-pQu69c "/home/dave/as"
>>>> edje_cc: Error. parse error :22. , marker before ; marker
>>>> Error in edje_cc, exit code: 25
>>>>
>>>> and in fact the tmp file have ( , ) instead of ( . ) in numbers
>>>>
>>>>
>>>> The tmp file is generated by engrave_edc_output() that write the value
>>>> with this function:
>>>>
>>>> static void
>>>> engrave_out_data(FILE *out, char *name, char *fmt, ...)
>>>> {
>>>> va_list ap;
>>>> char *fmt_new = (char *)calloc(strlen(fmt) + strlen(name) + level +
>>>> 5, sizeof(char));
>>>> char *buf = engrave_output_mk_tabs();
>>>>
>>>> sprintf(fmt_new, "%s%s: %s;\n", buf, name, fmt);
>>>> va_start(ap, fmt);
>>>> vfprintf(out, fmt_new, ap);
>>>> va_end(ap);
>>>> FREE(fmt_new);
>>>> FREE(buf);
>>>> }
>>>>
>>>>
>>>> So seems that vfprintf() write the %.2f param wrong. Is this possible?
>>>> is vfprintf() l18n?
>>>>
>>>>
>>>>
>>> yes, it is. I'm not sure how to disable it just for some functions
>>> tough. A quick look at its man page says that every format would use
>>> the locale to format, but maybe there is some that I missed.
>>>
>>>
>>>
>> Don't think there is a really nice way to do this. The only way I know
>> is this:
>> char prev[128];
>>
>> strncpy(prev, setlocale(LC_NUMERIC, NULL), sizeof(prev));
>>
>> setlocale(LC_NUMERIC, "C");
>> printf("%f\n", 123.3);
>> setlocale(LC_NUMERIC, prev);
>>
>>
>>
> Yes thanks, this works !!
> This is the patch for engrave, can I commit it?(my editor is badly broken
> without) or someone know a better way?
>
>
The same problem appear also in the loading of the edc files.
Here's the second patch (not including the first)
None seems contrary so I will commit the change to cvs. we can always
keep back ;)
Dave
Index: src/lib/engrave_parse.c
===================================================================
RCS file: /cvs/e/e17/libs/engrave/src/lib/engrave_parse.c,v
retrieving revision 1.24
diff -u -r1.24 engrave_parse.c
--- src/lib/engrave_parse.c 21 Aug 2007 05:42:29 -0000 1.24
+++ src/lib/engrave_parse.c 26 Nov 2007 02:17:56 -0000
@@ -1,4 +1,5 @@
#include "engrave_private.h"
+#include <locale.h>
#include <Engrave.h>
static Engrave_File *engrave_file = 0;
@@ -9,14 +10,22 @@
engrave_parse(const char *file, const char *imdir, const char *fontdir)
{
int ret;
+ char locale[128];
engrave_file = engrave_file_new();
engrave_file_image_dir_set(engrave_file, imdir);
engrave_file_font_dir_set(engrave_file, fontdir);
+ /* set locale posix compliant*/
+ strncpy(locale, setlocale(LC_NUMERIC, NULL), sizeof(locale));
+ setlocale(LC_NUMERIC, "C");
+
yyin = fopen(file, "r");
ret = yyparse();
fclose(yyin);
+ /* reset locale to system default*/
+ setlocale(LC_NUMERIC, locale);
+
if (ret == 0)
return (engrave_file);
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel