*** empty log message ***

git-svn-id: svn://10.65.10.50/trunk@11843 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-03-12 15:18:14 +00:00
parent 3c2aaeeaea
commit 4127fc0dce
2 changed files with 57 additions and 38 deletions

View File

@ -7,14 +7,15 @@
// Ritorna TRUE se la stringa e' piena di zero // Ritorna TRUE se la stringa e' piena di zero
static bool zero_only(const TString& v) static bool zero_only(const TString& v)
{ {
for (int i = v.len()-1; i>=0 && v[i]=='0'; i--); int i;
for (i = v.len()-1; i>=0 && v[i]=='0'; i--);
return i<0; return i<0;
} }
//////////////////////////////////////// TTracciato_Campo //////////////////////////////////////// //////////////////////////////////////// TTracciato_Campo ////////////////////////////////////////
TTracciato_campo::TTracciato_campo(int position, int length, int decimal, const char align, const char filler) TTracciato_campo::TTracciato_campo(int position, int length, int decimal, const char align, const char filler)
: _position(position), _length(length), _decimal(decimal), : _datatype('S'), _position(position), _length(length),
_datatype('S'), _align(align), _filler(filler) _decimal(decimal), _align(align), _filler(filler)
{} {}
TObject* TTracciato_campo::dup() const TObject* TTracciato_campo::dup() const
@ -120,7 +121,9 @@ void TTracciato_record::add(TTracciato_campo* tc, int pos)
int TTracciato_record::get_pos(const char* name) const int TTracciato_record::get_pos(const char* name) const
{ {
for (int i = _tracciati_campo.last(); i >= 0; i = _tracciati_campo.pred(i)) int i;
for (i = _tracciati_campo.last(); i >= 0; i = _tracciati_campo.pred(i))
{ {
const TTracciato_campo& tc = get(i); const TTracciato_campo& tc = get(i);
if (tc.name() == name) if (tc.name() == name)
@ -164,9 +167,9 @@ TTracciato_record* TFile_text::t_rec(int mainfile, const char * tabname) const
if (tabname) if (tabname)
mainfile=(tabname[0] != '%') ? LF_TAB: LF_TABCOM; mainfile=(tabname[0] != '%') ? LF_TAB: LF_TABCOM;
TTracciato_record *trrd; TTracciato_record *trrd;
TAssoc_array &tr= ((TFile_text *)this)->_tracciati_record; TAssoc_array &tr = (((TFile_text *)this)->_tracciati_record);
tr.restart(); tr.restart();
while (trrd=(TTracciato_record *)tr.get()) while ((trrd=(TTracciato_record *)tr.get()))
{ {
if (trrd->relation() && trrd->relation()->lfile().num()==mainfile) if (trrd->relation() && trrd->relation()->lfile().num()==mainfile)
if (tabname) if (tabname)
@ -269,7 +272,7 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section)
} }
if (lavoro == "USE") // setta la relazione if (lavoro == "USE") // setta la relazione
{ {
CHECKS(tmprel==NULL,"Relazione già definita per il tracciato: %s",sectkey); CHECKS(tmprel == NULL,"Relazione già definita per il tracciato: %s", (const char *) sectkey);
if (atoi((const char *)obj)!=0) if (atoi((const char *)obj)!=0)
tmprel= new TRelation(atoi((const char *)obj)); tmprel= new TRelation(atoi((const char *)obj));
else else
@ -347,7 +350,7 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section)
} }
if (lavoro == "FTY") // field type if (lavoro == "FTY") // field type
{ {
CHECKS(_tipi.objptr(obj)!=NULL,"Riferimento a campo inesistente:%s",obj); CHECKS(_tipi.objptr(obj)!=NULL,"Riferimento a campo inesistente:%s", (const char *) obj);
tc.set_ftype(obj); tc.set_ftype(obj);
continue; continue;
} }
@ -570,7 +573,6 @@ int TFile_text::write(TRecord_text& rec)
const TString& type = rec.type(); const TString& type = rec.type();
TTracciato_record& tr = *t_rec(type); TTracciato_record& tr = *t_rec(type);
TArray& a_tc = tr.tracciati_campo();
const int items = rec.items(); const int items = rec.items();
if (_typepos>=0) if (_typepos>=0)
rec.add(type,_typepos); rec.add(type,_typepos);
@ -817,7 +819,7 @@ void TFile_text::add_field(TRecord_text& rec, const int ncampo, const char* val)
{ {
TTracciato_record* tr = t_rec(rec.type()); TTracciato_record* tr = t_rec(rec.type());
CHECKS(tr, "Tracciato inesistente ", (const char*)rec.type()); CHECKS(tr, "Tracciato inesistente ", (const char*)rec.type());
TTracciato_campo& tc = tr->get(ncampo); tr->get(ncampo);
rec.add(val, ncampo); rec.add(val, ncampo);
} }
@ -917,7 +919,8 @@ TString& TFile_text::format_textfield(const TTracciato_campo& tc, TString& campo
break; break;
case 'D': //data case 'D': //data
{ {
TFormatted_date tmp(TDate (campo),tc.picture()); TDate d(campo);
TFormatted_date tmp(d, tc.picture());
campo=tmp.string(); campo=tmp.string();
} }
break; break;
@ -994,7 +997,11 @@ int TFile_text::open(char mode)
if (_read_file) if (_read_file)
delete _read_file; delete _read_file;
#ifdef WIN32
_read_file = new ifstream(_name, ios::binary | ios::nocreate); _read_file = new ifstream(_name, ios::binary | ios::nocreate);
#else
_read_file = new ifstream(_name, ios::binary);
#endif
if (!ok_r()) if (!ok_r())
{ {
error_box("Impossibile aprire il file %s in lettura", (const char *)_name); error_box("Impossibile aprire il file %s in lettura", (const char *)_name);
@ -1011,7 +1018,8 @@ int TFile_text::open(char mode)
if (_recordsep.not_empty()) if (_recordsep.not_empty())
{ {
int s = _skiplines; int s = _skiplines;
for (int c = _read_file->get(); c != EOF; c = _read_file->get()) int c;
for (c = _read_file->get(); c != EOF; c = _read_file->get())
{ {
if (c == _recordsep[0]) if (c == _recordsep[0])
{ {

View File

@ -109,9 +109,9 @@ void TForm_flags::print_on(ostream& out) const
// TForm_item // TForm_item
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TForm_item::TForm_item(TPrint_section* section) TForm_item::TForm_item(TPrint_section* section)
: _section(section), _x(-1), _y(-1), _width(0), : _temp(FALSE), _section(section), _id(0), _x(-1), _y(-1),
_height(0),_effective_height(0), _id(0), _ofs(0), _width(0), _height(0), _effective_height(0),
_temp(FALSE) _ofs(0)
{} {}
void TForm_item::copy_to_form_item(TForm_item* fi) const void TForm_item::copy_to_form_item(TForm_item* fi) const
@ -611,7 +611,9 @@ bool TForm_item::update()
if (_prompt.right(1) == "#") if (_prompt.right(1) == "#")
{ {
TString prompt(_prompt); TString prompt(_prompt);
for (int i = prompt.len()-2; i >= 0; i--) int i;
for (i = prompt.len()-2; i >= 0; i--)
if (prompt[i] != '#') break; if (prompt[i] != '#') break;
prompt.cut(i+1); prompt.cut(i+1);
string_at(x(), _y, prompt); string_at(x(), _y, prompt);
@ -670,9 +672,10 @@ short TForm_item::x()
TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm) TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
: TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type()), : TForm_item(s), _title_section(NULL), _qtitle_section(NULL),
_file_id(-1), _name(nm), _condexpr(NULL), _ssec(&(s->form()), s->section_type(), s->page_type()),
_title_section(NULL),_qtitle_section(NULL),_title_type(type_notitle),_show_title(FALSE) _name(nm), _title_type(type_notitle),
_show_title(FALSE), _file_id(-1), _condexpr(NULL)
{ {
_ssec.set_subsection_above(this); _ssec.set_subsection_above(this);
} }
@ -909,7 +912,6 @@ bool TForm_subsection::print_body(sec_print_mode showfields)
bool at_newpage=(atnewpage() || printer().rows_left() < (word)minheight()); bool at_newpage=(atnewpage() || printer().rows_left() < (word)minheight());
bool ok = FALSE; bool ok = FALSE;
TCursor* cur = form().cursor(); TCursor* cur = form().cursor();
TRelation* rel = (TRelation* )form().relation();
set_effective_height(0); // resetta l'altezza della sottosezione al suo "minimo" set_effective_height(0); // resetta l'altezza della sottosezione al suo "minimo"
@ -1079,7 +1081,9 @@ void TForm_string::put_paragraph(const char* s)
lines = _prompt; lines = _prompt;
lines << s; lines << s;
TParagraph_string p(lines, width()); TParagraph_string p(lines, width());
for (int i=0; (s = p.get()) != NULL && i < h; i++) int i;
for (i = 0; (s = p.get()) != NULL && i < h; i++)
string_at(x(), _y+i, s); string_at(x(), _y+i, s);
_effective_height = i; _effective_height = i;
@ -1137,7 +1141,8 @@ void TForm_string::apply_format(TString& s) const
if (ld > 0) // Se il primo delimitatore e' valido ... if (ld > 0) // Se il primo delimitatore e' valido ...
{ {
for (int spc = 0;s[spc]==' ' ; spc++) ; int spc;
for (spc = 0;s[spc]==' ' ; spc++) ;
if (spc < ld) if (spc < ld)
{ {
TString16 spazi; TString16 spazi;
@ -1358,7 +1363,9 @@ void TForm_number::apply_format(TString& s) const
if (ld > 0) // Se il primo delimitatore e' valido ... if (ld > 0) // Se il primo delimitatore e' valido ...
{ {
for (int spc = 0;s[spc]==' ' ; spc++) ; int spc;
for (spc = 0;s[spc]==' ' ; spc++) ;
if (spc < ld) if (spc < ld)
{ {
TString16 spazi; TString16 spazi;
@ -1449,7 +1456,7 @@ const char* TForm_currency::get() const
TCurrency TForm_currency::get_currency() const TCurrency TForm_currency::get_currency() const
{ {
const TString& codval = _driver ? _driver->get() : form().get_curr_codval(); const char * codval = _driver ? _driver->get() : (const char *) form().get_curr_codval();
const real n(get()); const real n(get());
return TCurrency(n, codval, ZERO, _exchange_undefined, _flag.price != 0); return TCurrency(n, codval, ZERO, _exchange_undefined, _flag.price != 0);
} }
@ -1985,7 +1992,7 @@ bool TForm_picture::update()
const int pos = i.find('|'); const int pos = i.find('|');
if (pos >= 0) if (pos >= 0)
i.cut(pos); i.cut(pos);
if (stricmp(i.ext(), "bmp") == 0) if (xvt_str_compare_ignoring_case(i.ext(), "bmp") == 0)
{ {
i.replace('\\', '/'); i.replace('\\', '/');
i.trim(); i.trim();
@ -2149,9 +2156,9 @@ TExpression & TPrint_section::eval_expr(TExpression & expr,int defaultfile_id)
} }
TPrint_section::TPrint_section(TForm* f, char st, pagetype pt, TForm_subsection* father) TPrint_section::TPrint_section(TForm* f, char st, pagetype pt, TForm_subsection* father)
: _height(0), _form(f), _sec_type(st), _page_type(pt), _dirty(FALSE), : _height(0), _ofspc(0), _ofsvr(0), _nfld(0), _dirty(FALSE),
_upsection(father), _repeat_count(0), _ofspc(0), _ofsvr(0), _nfld(0), _temp(0), _columnwise(FALSE), _temp(0), _form(f), _sec_type(st), _page_type(pt),
_columnwise(FALSE) _upsection(father), _repeat_count(0)
{ {
reset_tabs(); reset_tabs();
} }
@ -2274,7 +2281,9 @@ int TPrint_section::tab(int col)
// compute column offset // compute column offset
_nfld = 0; _nfld = 0;
short maxcolreached = 0,mincolreached = MAXCOLUMNS+1; short maxcolreached = 0,mincolreached = MAXCOLUMNS+1;
for (word i = 0; i < fields(); i++) word i;
for (i = 0; i < fields(); i++)
{ {
const TForm_item& fi = field(i); const TForm_item& fi = field(i);
if (!fi.is_section() && fi.shown()) if (!fi.is_section() && fi.shown())
@ -2509,7 +2518,9 @@ TForm_item& TPrint_section::find_field(const char *sec_name) const
TForm_item *TPrint_section::find_field_everywhere(const char *sec_name,const TPrint_section *starting_section) const TForm_item *TPrint_section::find_field_everywhere(const char *sec_name,const TPrint_section *starting_section) const
{ {
// search here // search here
for (int j = 0; j < subsections(); j++) { int j;
for (j = 0; j < subsections(); j++) {
const char *n=subsection(j)->name(); const char *n=subsection(j)->name();
if (strcmp(n,sec_name)==0) if (strcmp(n,sec_name)==0)
return subsection(j); return subsection(j);
@ -2664,7 +2675,7 @@ bool TForm::parse_sortedjoin(TScanner& scanner)
TString16 subj(scanner.pop()); // File or table TString16 subj(scanner.pop()); // File or table
parse_join_param(scanner,sortrel,subj,atoi(j)); parse_join_param(scanner,sortrel,subj,atoi(j));
} else } else
yesnofatal_box("Token non riconosciuto in SORT:%s",scanner.key()); yesnofatal_box("Token non riconosciuto in SORT:%s", (const char *) scanner.key());
} }
int to = 0; int to = 0;
@ -2723,7 +2734,7 @@ TToken_string TForm::parse_sortexpr(TScanner& scanner)
TToken_string sortexp; TToken_string sortexp;
TToken_string se(scanner.line(),' '); TToken_string se(scanner.line(),' ');
const char * c; const char * c;
while (c=se.get()) while ((c=se.get()))
if (*c!='\0') if (*c!='\0')
sortexp.add(c); sortexp.add(c);
return sortexp; return sortexp;
@ -3185,7 +3196,7 @@ bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new
{ {
pr.formfeed(); pr.formfeed();
} }
int repeat_count=0; // numero di sottosezioni stampate o numero di stampe della stessa sottosezione
int last_hpos=0; int last_hpos=0;
for (word i = 0; i < fields(); i++) for (word i = 0; i < fields(); i++)
{ {
@ -3426,7 +3437,8 @@ bool TForm::genera_fincatura(
if (grs->field(k-1).temp()) if (grs->field(k-1).temp())
grs->destroy_field(k-1); grs->destroy_field(k-1);
for (int i = 0; i < (int)body->fields(); i++) int i;
for (i = 0; i < (int)body->fields(); i++)
{ {
TForm_item& f = body->field(i); TForm_item& f = body->field(i);
if (!f.shown() || f.is_section()) if (!f.shown() || f.is_section())
@ -3988,7 +4000,7 @@ bool TForm::validate(TForm_item &cf, TToken_string &s)
// <espressione input> è un'espressione del tipo <campo file>=<espressione campi form> // <espressione input> è un'espressione del tipo <campo file>=<espressione campi form>
// <espressione campi form> è un'espressione di costanti numeriche, stringhe e valori di campi della form (indicati con il loro numero preceduto da #) // <espressione campi form> è un'espressione di costanti numeriche, stringhe e valori di campi della form (indicati con il loro numero preceduto da #)
// <espressione output> è un'espressione del tipo <campo form o gruppo>=<campo file> (se è un gruppo deve essere seguito da @) oppure solo <campo file> (il campo della form è quello corrente) // <espressione output> è un'espressione del tipo <campo form o gruppo>=<campo file> (se è un gruppo deve essere seguito da @) oppure solo <campo file> (il campo della form è quello corrente)
int i, j, poseq, posrv, itms; int i, j, poseq, posrv = 0, itms;
pagetype pt; pagetype pt;
char sec; char sec;
TLocalisamfile *file; TLocalisamfile *file;
@ -4130,7 +4142,6 @@ bool TForm::validate(TForm_item &cf, TToken_string &s)
if (in[0]== '#') in.ltrim(1); if (in[0]== '#') in.ltrim(1);
TForm_item &fi= cf.find_field(in); TForm_item &fi= cf.find_field(in);
int i= 2;
for (const char * cmd = s.get(); cmd != NULL; cmd = s.get()) for (const char * cmd = s.get(); cmd != NULL; cmd = s.get())
{ // Calcola la nuova posizione { // Calcola la nuova posizione
TString align(cmd); TString align(cmd);