<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">OK, super!!!<br><br><br>--- On <b>Fri, 10/3/08, Tommi Hassinen <i><Tommi.Hassinen@uku.fi></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Tommi Hassinen <Tommi.Hassinen@uku.fi><br>Subject: Re: [ghemical-devel] Bug report and pt_BR Translation of Ghemical<br>To: "Jean Bréfort" <jean.brefort@normalesup.org><br>Cc:
"Ronoaldo JLP" <ronoaldo@fluxsoftwares.com>,
"ghemical-devel@bioinformatics.org"
<ghemical-devel@bioinformatics.org><br>Date: Friday, October 3, 2008, 6:10 AM<br><br><pre>From: Jean Bréfort [jean.brefort@normalesup.org]<br>Sent: Thursday, October 02, 2008 11:40 PM<br>To: Tommi Hassinen<br>Cc: Ronoaldo JLP; ghemical-devel@bioinformatics.org<br>Subject: Re: [ghemical-devel] Bug report and pt_BR Translation of Ghemical<br><br>OK, found the issue: the numeric locale should be set to "C" in both<br>project::Import and project::Export.<br><br>Cheers,<br>Jean<br><br><br>Yes, that's true. And it explains why everything works if the numeric<br>locale already is "C"...<br><br>Here in the end of this message is how I modified project::ImportFile() and<br>project::ExportFile() methods in src/project.cpp file.<br>Regards,<br><br>Tommi<br><br><br>##########################################################################################<br><br>bool project::ImportFile(const char * filename, int index)<br>{<br> ifstream ifile;<br>
ostringstream intermed;<br> file_trans translator;<br><br> // store the current (numeric) locale into my_num_locale,<br> // and switch into the "C" numeric locale...<br><br> static char my_num_locale[32] = "C";<br> strcpy(my_num_locale, setlocale(LC_NUMERIC, NULL));<br> setlocale(LC_NUMERIC, "C");<br><br> if (index == 0) // Automatic detection<br> {<br> if (!translator.CanImport(filename))<br> {<br> ErrorMessage("Cannot import that file<br>type.");<br> return false;<br> }<br><br> ifile.open(filename, ios::in);<br> translator.Import(filename, ifile, intermed);<br> ifile.close();<br> }<br> else // By type picked by the user<br> {<br> ifile.open(filename, ios::in);<br>
translator.Import(filename, index - 1, ifile, intermed);<br> ifile.close();<br> }<br><br> istringstream interInput(intermed.str());<br> bool retval = ReadGPR((* this), interInput, false);<br><br> // change the original locale back...<br> // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> setlocale(LC_NUMERIC, my_num_locale);<br><br> return retval;<br>}<br><br>bool project::ExportFile(const char * filename, int index)<br>{<br> ofstream ofile;<br> stringstream intermed;<br> file_trans translator;<br><br> // store the current (numeric) locale into my_num_locale,<br> // and switch into the "C" numeric locale...<br><br> static char my_num_locale[32] = "C";<br> strcpy(my_num_locale, setlocale(LC_NUMERIC, NULL));<br> setlocale(LC_NUMERIC, "C");<br><br> WriteGPR_v100((* this), intermed); // this is for<br>openbabel-1.100.2<br>
istringstream interInput(intermed.str());<br><br> if (index == 0) // Automatic detection<br> {<br> if (!translator.CanExport(filename))<br> {<br> ErrorMessage("Cannot export that file<br>type.");<br> return false;<br> }<br><br> ofile.open(filename, ios::out);<br> translator.Export(filename, interInput, ofile);<br> ofile.close();<br> }<br> else // By type picked by the user<br> {<br> ofile.open(filename, ios::out);<br> translator.Export(filename, index - 1, interInput, ofile);<br> ofile.close();<br> }<br><br> // change the original locale back...<br> // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> setlocale(LC_NUMERIC, my_num_locale);<br><br> return
true;<br>}<br><br><br>_______________________________________________<br>ghemical-devel mailing list<br>ghemical-devel@bioinformatics.org<br>http://www.bioinformatics.org/mailman/listinfo/ghemical-devel<br></pre></blockquote>ertions compiled in the Official Debian distros.<br><br>We will recompile the last CVS version in order to introduce the correct package <br>in the ProLinux Distro.<br><br>Well done.<br><br>Ulisses<br><br><br><br><br>--- On <b>Fri, 10/3/08, Tommi Hassinen <i><Tommi.Hassinen@uku.fi></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Tommi Hassinen <Tommi.Hassinen@uku.fi><br>Subject: Re: [ghemical-devel] Bug report and pt_BR Translation of Ghemical<br>To: "Jean Bréfort" <jean.brefort@normalesup.org><br>Cc: "Ronoaldo JLP" <ronoaldo@fluxsoftwares.com>, "ghemical-devel@bioinformatics.org" <ghemical-devel@bioinformatics.org><br>Date:
Friday, October 3, 2008, 6:10 AM<br><br><pre>From: Jean Bréfort [jean.brefort@normalesup.org]<br>Sent: Thursday, October 02, 2008 11:40 PM<br>To: Tommi Hassinen<br>Cc: Ronoaldo JLP; ghemical-devel@bioinformatics.org<br>Subject: Re: [ghemical-devel] Bug report and pt_BR Translation of Ghemical<br><br>OK, found the issue: the numeric locale should be set to "C" in both<br>project::Import and project::Export.<br><br>Cheers,<br>Jean<br><br><br>Yes, that's true. And it explains why everything works if the numeric<br>locale already is "C"...<br><br>Here in the end of this message is how I modified project::ImportFile() and<br>project::ExportFile() methods in src/project.cpp file.<br>Regards,<br><br>Tommi<br><br><br>##########################################################################################<br><br>bool project::ImportFile(const char * filename, int index)<br>{<br> ifstream ifile;<br> ostringstream intermed;<br> file_trans
translator;<br><br> // store the current (numeric) locale into my_num_locale,<br> // and switch into the "C" numeric locale...<br><br> static char my_num_locale[32] = "C";<br> strcpy(my_num_locale, setlocale(LC_NUMERIC, NULL));<br> setlocale(LC_NUMERIC, "C");<br><br> if (index == 0) // Automatic detection<br> {<br> if (!translator.CanImport(filename))<br> {<br> ErrorMessage("Cannot import that file<br>type.");<br> return false;<br> }<br><br> ifile.open(filename, ios::in);<br> translator.Import(filename, ifile, intermed);<br> ifile.close();<br> }<br> else // By type picked by the user<br> {<br> ifile.open(filename, ios::in);<br> translator.Import(filename, index - 1, ifile, intermed);<br>
ifile.close();<br> }<br><br> istringstream interInput(intermed.str());<br> bool retval = ReadGPR((* this), interInput, false);<br><br> // change the original locale back...<br> // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> setlocale(LC_NUMERIC, my_num_locale);<br><br> return retval;<br>}<br><br>bool project::ExportFile(const char * filename, int index)<br>{<br> ofstream ofile;<br> stringstream intermed;<br> file_trans translator;<br><br> // store the current (numeric) locale into my_num_locale,<br> // and switch into the "C" numeric locale...<br><br> static char my_num_locale[32] = "C";<br> strcpy(my_num_locale, setlocale(LC_NUMERIC, NULL));<br> setlocale(LC_NUMERIC, "C");<br><br> WriteGPR_v100((* this), intermed); // this is for<br>openbabel-1.100.2<br> istringstream interInput(intermed.str());<br><br> if (index
== 0) // Automatic detection<br> {<br> if (!translator.CanExport(filename))<br> {<br> ErrorMessage("Cannot export that file<br>type.");<br> return false;<br> }<br><br> ofile.open(filename, ios::out);<br> translator.Export(filename, interInput, ofile);<br> ofile.close();<br> }<br> else // By type picked by the user<br> {<br> ofile.open(filename, ios::out);<br> translator.Export(filename, index - 1, interInput, ofile);<br> ofile.close();<br> }<br><br> // change the original locale back...<br> // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> setlocale(LC_NUMERIC, my_num_locale);<br><br> return true;<br>}<br><br><br>_______________________________________________<br>ghemical-devel mailing
list<br>ghemical-devel@bioinformatics.org<br>http://www.bioinformatics.org/mailman/listinfo/ghemical-devel<br></pre></blockquote></td></tr></table><br>