locale.h and gnuplot
Jakson Aquino
jaksonaquino at yahoo.com.br
Fri Feb 18 22:46:59 CET 2005
Hello All!
StatistX macro solved the problem with gnuplot. I
always called the macros inside the condition #ifndef
NO_GETTEXT. I deleted the following lines from the
macro, but only because they seems to be written in
Objective C and I don't know how to translate them.
if (SX_saved_locale == NULL) { \
[NSException raise: NSMallocException \
format: @"set locale: Not enough memory."]; \
} \
I'm sending the patch against the cvs version of
Statist with all changes that I made since February 4.
I'm not a professional programmer, and I'm not the
owner of Statist, thus, although my version of Statist
is running properly, you might find it better to make
some changes to improve the code or to make it more
consistent with Statist "philosophy".
The initial idea of simply deleting rows with missing
values before calculations would be good enough for
social scientists, but other people might have
different problems. Now there are three ways of
calling the function alloc_cols() (and, thus,
getcols(), which calls alloc_cols()):
- TRUE: delete rows with missing values.
- FALSE: delete missing values, but not the
entire row if we have more than one row.
- 3: let the column as it is. That is, let
it with its missing values.
I used the following rule to decide whether to use
getcols(i, TRUE, FALSE or 3):
- If in the original source code getcols was
followed by "if ((!empty) && (equal_rows(2)))",
I used TRUE.
- I also used TRUE if only one column was being
read from tempfile (In this case the result is
the same as FALSE).
- If getcols was followed only by "if (!empty)",
I used FALSE
- for <DATA MANAGEMENT | List data of one column>
and almost the entire menu DATA MANIPULATION,
I used "3" (don't delete missing values).
In order to "Read another file" with column labels, I
turned the variable n_alias into global, and this
created a bug. Every time Statist was automatically
creating a new column (like the "resi" after a
regression, or out_ after deleting outliers etc...)
the number of columns (ncol) was updated, but not the
number of column labels (n_alias). Then, if we tried
to read a new file without deleting the old data, bug!
However, I soved the problem adding a lot of n_alias++
to many functions.
Another problem, already present in the cvs version of
statist, happened when I tried to open a file with 4
columns (two with 10 rows and two with 12 rows). The
file was created by Statist with the option "save
columns in ASCII file". But Statist couldn't
understand " . " as a valid number. I fixed this
problem. Now, Statist writes 'M's to complete the
smaller rows.
I ran practically all Statist menu entries, and
everything seems to be OK. The only segmentation fault
that I got was due to an error in my pt_BR.po.
Sometimes I also ran Statist simultaneously in
Portuguese and English, to compare results and
graphics.
One doubt that I have is whether defining missing
value as (-DBL_MAX) can cause problems in functions
that already use the value REAL_MIN, defined in
statist.h, and that also is (-DBL_MAX). My attempt of
defining missing values as (-DBL_MAX + 1) didn't
really changed the value of -DBL_MAX.
I wrote a draft of an future English documentation.
It's incomplete, and the English is not very good, but
at least someone who can read English will understand
it. I used a translator to get an idea of what Dirk
Melcher wrote in the German documentation.
I have a lot of work for the next days. Thus, this is
my last contribution for the next days (or weeks).
If anyone has any doubt about any of the changes I
made, please tell me. Some of the changes were
explained in previous emails.
Best regards,
Jakson
--- Andreas Beyer <beyer at imb-jena.de> escreveu:
>
> I think I had the same problem with StatistX. If I
> remember correctly,
> my solution was to set the locale to the default
> C-locale before passing
> anything to gnuplot. Afterwards I set it back to the
> previous setting.
>
> Andreas
>
> Bernhard Reiter schrieb:
> > On Thu, Feb 10, 2005 at 09:37:47AM -0300, Jakson
> Aquino wrote:
> >
> >>When trying to see a boxplot I got the following
> >>gnuplot error:
> >>
> >>Spalte fuer Variable 1: TVHOURS
> >>
> >>Erstelle gnuplot-Graphik ...
> >>
> >>
> >>0 vermutliche Ausreisser gefunden
> >>
> >> --- Bitte mit ENTER fortfahren ... ---
> >>gnuplot> plot [0,8:5,2][9:13]
> >>'/home/jakson/stat_gpl.dat' with lines
> >> ^
> >> line 0: ':' or keyword 'to' expected
> >>
> >>
> >>The problem is that, in many languages (among
> them:
> >>German, French, Spanish, Italian, and Portuguese),
> the
> >>decimal separator is not a "."; it's a ",".
> However,
> >>the culprit is <locale.h>. With locale.h, the
> printf
> >>function becomes very smart. It's good to see the
> >>results of calculations printed with the correct
> >>decimal separator, but, while writing a file to
> >>gnuplot, locale.h is a problem.
> >>
> >>Another --far less important-- side effect of
> locale.h
> >>is that if we save columns in an ascii file
> running
> >>Statist in a language other than English, it will
> not
> >>be possible to open the file running Statist in
> >>English. We would have, for example, 1,30000e+01
> >>instead of 1.30000e+01. Since this side effect
> isn't
> >>properly a bug of Statist, I think that it will be
> >>enough to document it. And the solution is very
> >>simple: use some tool to replace all "," with ".".
> >>
> >>Is there any easy way of fixing the problem with
> >>gnuplot?
> >
> >
> > We probably need to ignore
> > the locale settings for files and gnuplot.
> > This is possible, I only have to look up how.
> >
> >
> >
> >
>
------------------------------------------------------------------------
> >
> > _______________________________________________
> > Statist-list mailing list
> > Statist-list at intevation.de
> >
> https://intevation.de/mailman/listinfo/statist-list
>
> --
> --------------------------------------
> Dr. Andreas Beyer - beyer at imb-jena.de
> http://www.imb-jena.de/~beyer
> --------------------------------------
>
__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: statist_patch_0213.zip
Type: application/x-zip-compressed
Size: 20961 bytes
Desc: statist_patch_0213.zip
Url : http://www.intevation.de/pipermail/statist-list/attachments/20050218/7b67a825/statist_patch_0213.zip
More information about the Statist-list
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)