From 024fe5f5f35041444b0e62083d68242e456ccdf1 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 18 Nov 1994 17:39:45 +0000 Subject: [PATCH] Aggiunto meccanismo per le conversioni di dati piu' complesse git-svn-id: svn://10.65.10.50/trunk@669 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/isam.cpp | 50 +++++++++++++++++++++++++++++++++++++++++---- include/isam.h | 1 + include/makedue.mak | 2 +- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/include/isam.cpp b/include/isam.cpp index c0e6dd17c..6ebfcee5a 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #if XVT_OS==XVT_OS_SCOUNIX #include @@ -885,6 +887,40 @@ long TSystemisamfile::size(TRecnotype eox) } #ifndef FOXPRO +bool TSystemisamfile::exec_convapp(long flev, const bool before) + +{ + const char * const v = before ? "BCNV" : "ACNV"; + + if (flev == 0) flev = 199401; + else flev++; + for (long l = flev; l <= stdlevel; l++) + { + TString16 paragraph(format("%06ld", l)); + TConfig conv(CONFIG_FCONV, paragraph); + + if (!conv.new_paragraph() && conv.exist(v, num())) + { + int err = 0; + TString80 s(conv.get(v, NULL, num())); s << " " << main_app().get_firm(); + TExternal_app app(s); + + if (app.can_run()) + { + app.run(); + err = app.error(); + TMailbox mail; + TMessage* msg = mail.next(TRUE); + if (err == 0 && msg != NULL) + err = atoi(msg->body()); + } + else err = 16; + if (err) + return error_box("Non posso eseguire il programma di %sconversione\ndel livello %ld/%ld\nErrore n.ro %d", before ? "pre" : "post", l / 100, l % 100, err); + } + } + return TRUE; +} bool TSystemisamfile::getlcf(long flev) @@ -897,9 +933,8 @@ bool TSystemisamfile::getlcf(long flev) { TString16 paragraph(format("%06ld", l)); TConfig conv(CONFIG_FCONV, paragraph); - - if (!conv.new_paragraph()) + if (!conv.new_paragraph() && conv.exist("F", num())) { TToken_string exprline(conv.get("F", NULL, num())); @@ -952,9 +987,15 @@ int TSystemisamfile::update(TTrec& newrec, bool vis) TTrec oldrec; oldrec.get(num()); - const bool lcf = getlcf(prefhndl->filelevel()); + const long lev = prefhndl->filelevel(); + const bool lcf = getlcf(lev); + exec_convapp(lev, TRUE); - if (!lcf && newrec == oldrec) return NOERR; + if (!lcf && newrec == oldrec) + { + exec_convapp(lev, FALSE); + return NOERR; + } const TRecnotype nitems = dir.eod(); const unsigned int lenr = newrec.len(); @@ -1021,6 +1062,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis) dir.put(num(), _nordir, _sysdirop); newrec.put(num()); if (toconvert && dir.eox() > 0L) packindex(); + exec_convapp(lev, FALSE); return err; } diff --git a/include/isam.h b/include/isam.h index 1a2af2de7..88f475422 100755 --- a/include/isam.h +++ b/include/isam.h @@ -348,6 +348,7 @@ class TSystemisamfile : public TIsamfile TArray _exps; bool getlcf(long flev); + bool exec_convapp(long flev, const bool before); void makelc(TRectype& rec); public: diff --git a/include/makedue.mak b/include/makedue.mak index b6ae41f1d..f982ba8dc 100755 --- a/include/makedue.mak +++ b/include/makedue.mak @@ -60,7 +60,7 @@ $(LIB)(files.o): files.cpp $(I16) $(I28) $(I5) $(I10) $(I31) $(LIB)(form.o): form.cpp $(I24) $(I33) $(I51) $(I39) $(I40) $(I31) bagn003.h -$(LIB)(isam.o): isam.cpp $(I30) $(I28) $(I37) $(I48) $(I39) $(I56) $(I12) $(I5) $(I17) $(I31) +$(LIB)(isam.o): isam.cpp $(I24) $(I30) $(I28) $(I37) $(I48) $(I39) $(I56) $(I12) $(I5) $(I17) $(I31) $(I47) $(LIB)(mailbox.o): mailbox.cpp $(I24) $(I47) $(I31)