ba4*.* Aggiustato ordine di creazione/distruzione di maschere e files

baformed.cpp  Aggiusata indentazione
ba883.cpp     Modificato test di velocita' isam


git-svn-id: svn://10.65.10.50/trunk@6461 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-03-30 14:14:03 +00:00
parent ca9bf04c98
commit 5c71880761
9 changed files with 61 additions and 86 deletions

View File

@ -1,36 +1,26 @@
#include <xvt.h>
#include <strings.h>
#include <checks.h>
#include "ba4.h"
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
int main(int argc,char** argv)
{
int rt = -1 ;
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
const int r = (argc > 1) ? argv[1][1]-'0' : 0;
switch (r)
{
case 0:
rt = ba4100(argc,argv) ; break;
case 1:
rt = ba4200(argc,argv) ; break;
ba4200(argc,argv) ; break;
case 2:
rt = ba4300(argc,argv) ; break;
ba4300(argc,argv) ; break;
case 3:
rt = ba4400(argc,argv) ; break;
ba4400(argc,argv) ; break;
case 4:
rt = ba4500(argc,argv) ; break;
ba4500(argc,argv) ; break;
case 5:
rt = ba4600(argc,argv) ; break;
ba4600(argc,argv) ; break;
default:
error_box(usage, argv[0]) ;
exit(1);
ba4100(argc,argv) ; break;
break;
}
return rt;
return 0;
}

View File

@ -1,19 +1,11 @@
#ifndef __BA4_H
#define __BA4_H
#ifdef MAIN
#define extern
#endif
#ifdef MAIN
#undef extern
#endif
#endif // __BA4_H
int ba4100(int argc, char* argv[]);
int ba4200(int argc, char* argv[]);
int ba4300(int argc, char* argv[]);
int ba4400(int argc, char* argv[]);
int ba4500(int argc, char* argv[]);
int ba4600(int argc, char* argv[]);
#endif

View File

@ -8,18 +8,19 @@ class TComuni_app : public TRelation_application
TMask * _msk;
TRelation * _rel;
protected:
virtual bool user_create() ;
virtual bool user_destroy() ;
virtual void init_query_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual void init_insert_mode(TMask& m) { init_modify_mode(m);}
virtual void init_query_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual void init_insert_mode(TMask& m) { init_modify_mode(m);}
virtual bool changing_mask(int mode) { return FALSE;}
virtual TRelation* get_relation() const { return _rel;}
virtual TMask* get_mask(int mode) { return _msk;}
public:
virtual TMask* get_mask(int mode) { return _msk;}
TComuni_app() {}
virtual ~TComuni_app() {}
TComuni_app() : _msk(NULL), _rel(NULL) { }
virtual ~TComuni_app() { }
};
void TComuni_app::init_query_mode(TMask& m)
@ -36,8 +37,8 @@ TComuni_app & app() { return (TComuni_app &) main_app(); }
bool TComuni_app::user_create()
{
_msk = new TMask("ba4100a") ;
_rel = new TRelation(LF_COMUNI);
_msk = new TMask("ba4100a") ;
return TRUE;
}

View File

@ -1,9 +1,8 @@
#include <defmask.h>
#include <execp.h>
#include <golem.h>
#include <mailbox.h>
#include <relapp.h>
#include <utility.h>
#include <urldefid.h>
#include <validate.h>
#include "ba4.h"
@ -13,7 +12,6 @@
#define FLD_GD1_CODANAGR 127
#define FLD_GD1_CODDITTAH 627
class TPersone_app : public TRelation_application
{
char _tip_ana;
@ -21,6 +19,7 @@ class TPersone_app : public TRelation_application
char _next_ana;
bool _reset_codreg;
TString16 _cod_ana ;
TString16 _next_key;
TMask* _msk[2] ;
TRelation* _rel[2];
TLocalisamfile* _comuni;
@ -75,9 +74,10 @@ bool TPersone_app::ba4200_handler(TMask& m, KEY k)
m.stop_run(K_ESC);
return FALSE;
}
if (k != K_F5 || m.mode() != MODE_MOD) return TRUE;
TToken_string body(16);
if (k != K_F5 || m.mode() != MODE_MOD)
return TRUE;
TToken_string body;
body.add(FLD_GD1_CODDITTAH);
body.add(FLD_GD1_TIPOA);
@ -86,7 +86,7 @@ bool TPersone_app::ba4200_handler(TMask& m, KEY k)
body.add(FLD_GD1_CODANAGR);
body << '=' << app.cod_ana();
const TString16 cmd("ba4 -2");
const char* const cmd = "ba4 -2";
TMessage msg(cmd, MSG_FS, body);
msg.send();
TExternal_app a(cmd);
@ -155,7 +155,7 @@ void TPersone_app::init_query_mode(TMask& m)
const char* TPersone_app::get_next_key()
{
TLocalisamfile& anag = get_relation()->lfile() ;
TLocalisamfile& anag = get_relation()->lfile() ;
long cod_anagr = 1;
if (!anag.empty() )
@ -183,7 +183,8 @@ const char* TPersone_app::get_next_key()
}
}
_cod_ana.format("%ld", cod_anagr);
return format("%d|%ld", FLD_CODANAGR, cod_anagr);
_next_key.format("%d|%ld", FLD_CODANAGR, cod_anagr);
return _next_key;
}
@ -577,15 +578,14 @@ TMask* TPersone_app::get_mask(int mode)
}
bool TPersone_app::user_create()
{
_msk[MSKF] = NULL;
_rel[MSKF] = new TRelation(LF_ANAG);
_rel[MSKF]->add(LF_ANAGFIS, "CODANAGR=CODANAGR", 1, 0, 0);
_rel[MSKF]->add(LF_ANAGFIS, "CODANAGR=CODANAGR", 1);
_msk[MSKG] = NULL;
_rel[MSKG] = new TRelation(LF_ANAG);
_rel[MSKG]->add(LF_ANAGGIU, "CODANAGR=CODANAGR", 1, 0, 0);
_rel[MSKG]->add(LF_ANAGGIU, "CODANAGR=CODANAGR", 1);
_comuni = new TLocalisamfile(LF_COMUNI) ;
_tabcom = new TLocalisamfile(LF_TABCOM) ;
@ -602,7 +602,6 @@ bool TPersone_app::user_create()
}
void TPersone_app::write_enable(bool on)
{
_rel[MSKF]->write_enable(0, on);
_rel[MSKG]->write_enable(0, on);
@ -610,13 +609,13 @@ void TPersone_app::write_enable(bool on)
bool TPersone_app::user_destroy()
{
for ( int j = 0 ; j < 2 ; j++ )
for (int j = 1; j >= 0; j--)
{
if (_msk[j]) delete _msk[j] ;
if (_rel[j]) delete _rel[j] ;
}
delete _comuni;
delete _tabcom;
delete _comuni;
return TRUE;
}

View File

@ -194,17 +194,18 @@ bool TDitte_application::fax_handler(TMask_field& f, KEY k)
bool TDitte_application::user_create() // initvar e arrmask
{
_msk = new TMask("ba4300a") ;
_msk->set_handler(DLG_FAX, fax_handler);
_msk->set_handler(ba4300_handler);
_rel = new TRelation(LF_NDITTE);
_anag = new TLocalisamfile(LF_ANAG);
_unloc = new TLocalisamfile(LF_UNLOC);
_attiv = new TLocalisamfile(LF_ATTIV);
_tabcom = new TLocalisamfile(LF_TABCOM);
_cespiti = has_module(CEAUT);
_msk = new TMask("ba4300a") ;
_msk->set_handler(DLG_FAX, fax_handler);
_msk->set_handler(ba4300_handler);
set_search_field(FLD_GD1_CODDITTA);
if (argc() > 2)
{
get_mask(MODE_QUERY);

View File

@ -45,19 +45,19 @@ HIDDEN bool clear_cap(TMask_field& f, KEY key)
bool BA4400_application::user_create()
{
_msk = new TMask("ba4400a") ;
_msk->set_handler(FLD_UL1_COMULC, clear_cap);
_msk->set_handler(FLD_UL2_COMTRIB, clear_cap);
_rel = new TRelation(LF_UNLOC) ;
_anag = new TLocalisamfile(LF_ANAG) ;
_ditte = new TLocalisamfile(LF_NDITTE) ;
_msk = new TMask("ba4400a") ;
_msk->set_handler(FLD_UL1_COMULC, clear_cap);
_msk->set_handler(FLD_UL2_COMTRIB, clear_cap);
set_search_field(FLD_UL1_CODULC);
return TRUE;
}
bool BA4400_application::user_destroy()
{
delete _msk;
delete _msk;
delete _rel;
delete _anag;
delete _ditte;

View File

@ -113,19 +113,18 @@ HIDDEN bool clear_cap(TMask_field& f, KEY key)
bool TAttivita_application::user_create()
{
_msk = new TMask("ba4500a") ;
_msk->set_handler(FLD_AT2_CODANGRDS, gest_res);
_msk->set_handler(FLD_AT2_COMCS, clear_cap);
_rel = new TRelation(LF_ATTIV) ;
_anag = new TLocalisamfile(LF_ANAG) ;
_ditte = new TLocalisamfile(LF_NDITTE) ;
_comuni = new TLocalisamfile(LF_COMUNI) ;
_msk = new TMask("ba4500a") ;
_msk->set_handler(FLD_AT2_CODANGRDS, gest_res);
_msk->set_handler(FLD_AT2_COMCS, clear_cap);
set_search_field(FLD_AT1_CODATTH);
return TRUE;
}
void TAttivita_application::init_query_mode(TMask& m)
{
m.show(FLD_AT1_CODATTH);
m.hide(FLD_AT1_CODATT);
@ -134,7 +133,6 @@ void TAttivita_application::init_query_mode(TMask& m)
void TAttivita_application::init_query_insert_mode(TMask& m)
{
m.show(FLD_AT1_CODATT);
m.hide(FLD_AT1_CODATTH);

View File

@ -212,10 +212,10 @@ void TTest_application::fill_trees(TMask& msk)
st->add_rbrother("son 2");
st->add_son("child 1");
st->add_rbrother("child 2");
// st->expand_all();
st->expand_all();
TTree_field& tf = (TTree_field&)msk.fld(f);
tf.set_tree(st);
tf.hide_leaves();
// tf.hide_leaves();
tf.set_handler(tree_handler);
}
}
@ -323,24 +323,23 @@ void TBenchmark_application::update_bar(long rec)
void TBenchmark_application::test_file_scan()
{
int found = 0;
initializing();
TLocalisamfile comuni(LF_COMUNI);
TSystemisamfile comuni(LF_COMUNI);
int err = comuni.open(_excllock);
start_test("Scansione file COMUNI di Reggio Emilia");
comuni.first();
for (TRecnotype rec = 0; !comuni.eof(); rec++)
if (err == NOERR)
{
if (comuni.get("PROVCOM") == "RE")
found++;
comuni.next();
update_bar(rec);
}
stop_test();
start_test("Scansione file COMUNI in modo esclusivo");
comuni.first();
for (TRecnotype rec = 0; comuni.good(); rec++)
{
comuni.next();
update_bar(rec);
}
comuni.close();
stop_test();
}
}
@ -363,7 +362,6 @@ void TBenchmark_application::test_relation_scan()
void TBenchmark_application::test_cursor_scan()
{
int found = 0;
initializing();
TRelation comuni(LF_COMUNI);
@ -377,8 +375,6 @@ void TBenchmark_application::test_cursor_scan()
cur = 0L;
for (TRecnotype c = 0; c < tot; c++)
{
if (comuni.curr().get("PROVCOM") == "RE")
found++;
++cur;
update_bar(c);
}

View File

@ -430,11 +430,10 @@ bool TForm_editor::edit_formato_data()
d.set_format(fmt);
m.set(F_DEXAMPLE, d.string());
if (dirty = (m.run() == K_ENTER))
dirty = m.run() == K_ENTER;
if (dirty)
{
char format[6];
format[0] = m.get(F_DFORMAT)[0];
format[1] = m.get(F_DDAY )[0];
format[2] = m.get(F_DMONTH )[0];
@ -445,7 +444,6 @@ bool TForm_editor::edit_formato_data()
_form->change_date_format(format);
}
return dirty;
}
bool TForm_editor::edit_relation()