From 65e62eda30e84fd6174a097875df05be3958b8a2 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 17 Aug 1994 09:56:27 +0000 Subject: [PATCH] Aggiunto ba1200.cpp. Programma per testare la lettura sequenziale dei file. git-svn-id: svn://10.65.10.50/trunk@21 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba1.cpp | 17 +++++++++++++---- ba/ba1.h | 31 +++++++++++++++--------------- ba/ba1100.cpp | 2 +- ba/ba1200.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ ba/makefile | 6 ++++-- 5 files changed, 85 insertions(+), 23 deletions(-) create mode 100755 ba/ba1200.cpp diff --git a/ba/ba1.cpp b/ba/ba1.cpp index be3aee023..af9d1b658 100755 --- a/ba/ba1.cpp +++ b/ba/ba1.cpp @@ -5,15 +5,24 @@ #include "ba1.h" -#define usage "Errore - uso : ba1" +#define usage "Errore - uso : ba1 [-{0|1}]" int main(int argc,char** argv) { int rt = 0 ; - if (argc!=1) fatal_box(usage); - - rt = ba1100(argc,argv,FALSE) ; + if (argc == 1) rt = ba1100(argc,argv); + else + if (argc == 2) + { + switch (argv[1][1]) + { + case '0': rt = ba1100(argc,argv); break; + case '1': rt = ba1200(argc,argv); break; + default: fatal_box(usage); break; + } + } + else fatal_box(usage); return rt; } diff --git a/ba/ba1.h b/ba/ba1.h index 5651386fd..c6c574628 100755 --- a/ba/ba1.h +++ b/ba/ba1.h @@ -1,16 +1,15 @@ -#ifndef __BA1_H -#define __BA1_H - -#ifdef MAIN -#define extern -#endif - -#ifdef MAIN -#undef extern -#endif - -#endif // __BA1_H - -int ba1100(int argc, char* argv[], bool insmode); -int ba1200(int argc, char* argv[], bool insmode); -int ba1300(int argc, char* argv[], bool insmode); +#ifndef __BA1_H +#define __BA1_H + +#ifdef MAIN +#define extern +#endif + +#ifdef MAIN +#undef extern +#endif + +#endif // __BA1_H + +int ba1100(int argc, char* argv[]); +int ba1200(int argc, char* argv[]); diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index cb712fcf2..c5435ac0c 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -466,7 +466,7 @@ while (!done) return TRUE; } -int ba1100(int argc, char* argv[], bool insmode) +int ba1100(int argc, char* argv[]) { BA1100_application a; diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp new file mode 100755 index 000000000..9ddc74bad --- /dev/null +++ b/ba/ba1200.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include + +/////////////////////////////////////////////////////////// +// Testfil +/////////////////////////////////////////////////////////// + +class TTest_application : public TApplication +{ + +protected: + bool create() { dispatch_e_menu(BAR_ITEM(1)); return TRUE; } + bool destroy() { return TRUE; } + bool menu(MENU_TAG); + +public: + TTest_application() {} +}; + +bool TTest_application::menu(MENU_TAG) +{ + TLocalisamfile tab(LF_TABCOM); + const TRecnotype n = tab.items(); + TProgind p(n, "Lettura file tabelle comuni", TRUE, TRUE, 32); + + const time_t start = time(NULL); + TRecnotype r = 1; + + TString80 msg; + for (tab.first(); tab.good(); tab.next(), r++) + { + msg.format("%ld rec : %ld sec", r, time(NULL) - start); + p.addstatus(1); + p.set_text(msg); + if (p.iscancelled()) break; + } + + return TRUE; +} + +/////////////////////////////////////////////////////////// + + +int ba1200(int argc, char** argv) +{ + TTest_application a; + a.run(argc, argv, "Test File"); + return 0; +} + diff --git a/ba/makefile b/ba/makefile index 06215ba20..c0d9cd570 100755 --- a/ba/makefile +++ b/ba/makefile @@ -36,8 +36,10 @@ $(O)/ba1100.o: ba1100.cpp ba1.h $(BA1100H) $(I10) $(I12) $(I23) $(I24) $(I31) $( $(O)/ba1102.o: ba1102.cpp ba1.h $(BA1100H) $(I33) $(I37) $(I39) $(I40) $(I43) -$(EP)ba1: $(O)/ba1.o $(O)/ba1100.o $(O)/ba1101.o $(O)/ba1102.o $(LIBD1) $(EP)ba1.frl - $(LINK) $(LFLAGSD1) $@ $(O)/ba1.o $(O)/ba1100.o $(O)/ba1101.o $(O)/ba1102.o +$(O)/ba1200.o: ba1200.cpp $(I24) $(I30) $(I37) + +$(EP)ba1: $(O)/ba1.o $(O)/ba1100.o $(O)/ba1101.o $(O)/ba1102.o $(O)/ba1200.o $(LIBD1) $(EP)ba1.frl + $(LINK) $(LFLAGSD1) $@ $(O)/ba1.o $(O)/ba1100.o $(O)/ba1101.o $(O)/ba1102.o $(O)/ba1200.o $(EP)ba1.frl: ba1.url $(U1) $(RCOMP) ba1 -l $(EP)ba1