Patch level : 10.0

Files correlati     : lv0
Ricompilazione Demo : [ ]
Commento            :
Corretta valutazione BETWEEN nelle espressioni.
Ora gestisce correttamente anche limiti del tipo "000"


git-svn-id: svn://10.65.10.50/trunk@17346 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-10-03 09:08:10 +00:00
parent f1ab3282b3
commit 4f5788f438
2 changed files with 21 additions and 18 deletions

View File

@ -361,6 +361,14 @@ static bool str2date(const TString& s, TDate& d)
return false; return false;
} }
static bool all_zeroes(const TString& str)
{
bool yes = str.not_empty();
for (const char* s = str; *s && yes; s++)
yes = (*s == '0') || isspace(*s);
return yes;
}
void TExpression::eval() void TExpression::eval()
{ {
TEval_stack evalstack; TEval_stack evalstack;
@ -763,8 +771,10 @@ void TExpression::eval()
break; break;
case _between: case _between:
{ {
const TString& s3 = evalstack.pop_string(); TString& s3 = evalstack.pop_string();
const TString& s2 = evalstack.pop_string(); if (all_zeroes(s3)) s3.cut(0); // Svuota una stringa finale di soli zeri
TString& s2 = evalstack.pop_string();
if (all_zeroes(s2)) s2.cut(0); // Svuota una stringa iniziale di soli zeri
const TString& s1 = evalstack.pop_string(); const TString& s1 = evalstack.pop_string();
bool good = true; bool good = true;
if (s2.full() || s3.full()) if (s2.full() || s3.full())

View File

@ -1337,17 +1337,11 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
{ {
TSheet& s = (TSheet&)f.mask(); TSheet& s = (TSheet&)f.mask();
TString cap; s.get_caption(cap); TString cap; s.get_caption(cap);
if (cap.blank())
cap = "export";
TFilename name; TFilename name;
name.tempdir(); name.tempdir(); name.add(cap); name.ext("xls");
name.add(cap); if (name.full()) // Dummy test
name.ext("xls");
/* Non vogliono pedere tempo a Milano!
FILE_SPEC fs;
xvt_fsys_convert_str_to_fspec(name, &fs);
if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione")) == FL_OK)
{
xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size());
*/
{ {
ofstream xls(name); ofstream xls(name);
const char sep = '\t'; const char sep = '\t';
@ -1364,11 +1358,10 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
} }
xls << tab << endl; xls << tab << endl;
for (long n = 0; n < s.items(); n++) for (long i = 0; i < s.items(); i++)
{ {
const TToken_string& r = s.row(n); tab = s.row(i);
tab = r; tab.replace('|', sep);
tab.replace(r.separator(), sep);
tab.separator(sep); tab.separator(sep);
for (int c = 0; c < columns; c++) for (int c = 0; c < columns; c++)
{ {
@ -1382,9 +1375,9 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
} }
xls << tab << endl; xls << tab << endl;
} }
xls.close();
xvt_sys_goto_url(name, "open");
} }
if (name.exist())
xvt_sys_goto_url(name, "open");
} }
return true; return true;
} }