diff --git a/include/ccommon.h b/include/ccommon.h index d96b60913..c935225c2 100755 --- a/include/ccommon.h +++ b/include/ccommon.h @@ -40,9 +40,6 @@ #define ELLIPSES ... -#define CHR(c) (c) -#define ORD(c) (c) -#define ODD(c) (((c) % 2) != 0) #ifdef WIN32 /* @(!) 2.3.01.316 modif. #define TMPFNAME(p,n) sprintf(p, "\\tmp\\%s.tmp", (n)); */ #define TMPFNAME(p,n) tmpfname((p),(n)) @@ -61,12 +58,6 @@ #define STRCMP(s1,op,s2) (strcmp(s1,s2) op 0) #define CSTR(n,s) sprintf((s), "%-d", (n)) #define CSTR4(n,s) sprintf((s), "%-ld", (n)) -//#define MAXDATA cpackdata("31-12-50") -//#define MINDATA cpackdata("01-01-51") -//#define EMPTYDATA cpackdata(" - - ") -//#define MONTHNAME(i) months[(i) - 1] -//#define CCONVINT(s) atoi(s) -//#define CONVLONG(s) atol(s) #define BADR(x) ((x) - 1) #define WINHND(hw) warr[(hw)].w /* @(!) 2.3.01.69 */ diff --git a/include/cfiles.c b/include/cfiles.c index 260838692..65523214a 100755 --- a/include/cfiles.c +++ b/include/cfiles.c @@ -1,6 +1,5 @@ #define __CFILES_C /* fv */ -#include #include #include "cfiles.h" @@ -361,6 +360,41 @@ void CPutRec(logicname,recd,dirflg) CWrite(&rdir[dirflg],(RecType) recd,(long) logicname, NoLock); } +int CGetCampoStpValue(const char* name, char* value, int valsize) +{ + BOOLEAN bFound = FALSE; +#ifdef WIN32 + const char* stpfile = "c:/campo.stp"; + int p; + DIRECTORY dir; + char exedir[_MAX_PATH], path[_MAX_PATH]; + xvt_fsys_get_default_dir(&dir); + xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir)); + + for (p = 1; ; p++) + { + int len = 0; + char para[4]; sprintf(para, "%d", p); + len = xvt_sys_get_profile_string(stpfile, para, "Program", "", path, sizeof(path)); + if (len <= 0) + break; + if (path[len-1] == '\\' || path[len-1] == '/') + { + len--; + path[len] = '\0'; + } + if (xvt_str_compare_ignoring_case(path, exedir) == 0) + { + xvt_sys_get_profile_string(stpfile, para, name, "", value, valsize); + bFound = *value > ' '; + break; + } + } +#endif + + return bFound; +} + /* @($) CGetCampoIni FILES @@ -379,35 +413,16 @@ const char* CGetCampoIni(void) static char* prawin = NULL; if (prawin == NULL) { - char exedir[_MAX_PATH], path[_MAX_PATH]; - DIRECTORY dir; BOOLEAN bFound = FALSE; - xvt_fsys_get_dir(&dir); - xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir)); #ifdef WIN32 // Nelle installazioni sfigate con programmi in rete cerca di stabilire il percorso locale di Campo.ini + DIRECTORY dir; + char exedir[_MAX_PATH], path[_MAX_PATH]; + xvt_fsys_get_default_dir(&dir); + xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir)); if (xvt_fsys_is_network_drive(exedir)) { - int p; - for (p = 1; ; p++) - { - int len = 0; - char para[4]; sprintf(para, "%d", p); - len = xvt_sys_get_profile_string("c:/campo.stp", para, "Program", "", path, sizeof(path)); - if (len <= 0) - break; - if (path[len-1] == '\\' || path[len-1] == '/') - { - len--; - path[len] = '\0'; - } - if (xvt_str_compare_ignoring_case(path, exedir) == 0) - { - xvt_sys_get_profile_string("c:/campo.stp", para, "CampoIni", "", path, sizeof(path)); - bFound = *path > ' '; - break; - } - } + bFound = CGetCampoStpValue("CampoIni", path, sizeof(path)); if (!bFound) { const char* pp = getenv("PREFPATH"); @@ -439,7 +454,7 @@ const char* CGetCampoIni(void) HIDDEN BOOLEAN CGetFirmDir() { const char* prawin = CGetCampoIni(); - BOOLEAN good = _access(prawin, 0x00) == 0; + BOOLEAN good = xvt_fsys_file_exists(prawin); if (good) { const int len = xvt_sys_get_profile_string(prawin, "Main", "Study", "", __ptprf, sizeof(__ptprf)); @@ -458,7 +473,7 @@ HIDDEN BOOLEAN CGetFirmDir() xvt_sys_get_profile_string(prawin, "Main", "Firm", "COM", firm, sizeof(firm)); ditta = atol(firm); if (ditta > 0) sprintf(firm, "%05ldA", ditta); - _makepath(cprefix, NULL, __ptprf, firm, NULL); + xvt_fsys_build_pathname(cprefix, NULL, __ptprf, firm, NULL, NULL); } } @@ -606,7 +621,7 @@ char *CInsPref(name,dirflg) if (*cprefix == '\0') strcpy(s, name); else - _makepath(s, NULL, cprefix, name, NULL); + xvt_fsys_build_pathname(s, NULL, cprefix, name, NULL, NULL); } else sprintf(s,"%scom%c%s", __ptprf, DIRSEP, name); diff --git a/include/cfiles.h b/include/cfiles.h index 382182b22..f3d13a886 100755 --- a/include/cfiles.h +++ b/include/cfiles.h @@ -106,6 +106,7 @@ extern "C" { /* @(!) 2.3.01.144 */ char *CInsPref(char *, int); + int CGetCampoStpValue(const char* name, char* value, int valsize); const char* CGetCampoIni(void); #ifdef __cplusplus diff --git a/include/dongle.cpp b/include/dongle.cpp index 295a28843..7445099b5 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -70,7 +70,7 @@ unsigned long TEutronFooter::checksum(bool set) unsigned long cs = 0; for (word i = 0; i < len; i++, ptr++) - cs += *ptr | ~(*ptr << 8); + cs += *ptr | ~(short(*ptr << 8)); if (set) _checksum = cs; return cs; } @@ -225,7 +225,7 @@ bool TDongle::already_programmed() const unsigned long cs = 0; for (byte* ptr = (byte*)_eprom; ptr < (byte*)&eh->_checksum; ptr++) - cs += *ptr | ~(*ptr << 8); + cs += *ptr | ~(short(*ptr << 8)); if (eh->_checksum != cs) return FALSE; // Malicious programming! } @@ -717,7 +717,7 @@ bool TDongle::burn_eutron() unsigned long cs = 0; for (byte* ptr = (byte*)_eprom; ptr < (byte*)&eh->_checksum; ptr++) - cs += *ptr | ~(*ptr << 8); + cs += *ptr | ~(short(*ptr << 8)); eh->_checksum = cs; const word otb = sizeof(TEutronHeader) / 2; diff --git a/include/form.cpp b/include/form.cpp index 331e507eb..867955a1e 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -2353,7 +2353,10 @@ void TPrint_section::offset(int& x, int& y) TForm_item* TPrint_section::parse_item(const TString& s) { TForm_item* f = create_item(s); - CHECKS(f, "Campo non ammesso per la sezione di stampa:", (const char*)s); +#ifdef DBG + if (f == NULL) + yesno_fatal_box("Tipo di campo del form non riconosciuto: '%s'", (const char*)s); +#endif return f; } diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 96f64f671..d2b14a56f 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -2329,12 +2329,12 @@ bool TBrowse::do_link(bool insert) if (insert) { TConfig ini(msg, "Transaction"); - ini.set("Action", "RUN"); + ini.set("Action", TRANSACTION_RUN); } else { TConfig ini(msg, "Transaction"); - ini.set("Action", "MODIFY"); + ini.set("Action", TRANSACTION_LINK); TString8 paragraph; paragraph << _cursor->file().num(); ini.set_paragraph(paragraph); diff --git a/include/relapp.cpp b/include/relapp.cpp index 706de20a2..859478cef 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -968,19 +968,30 @@ bool TRelation_application::save(bool check_dirty) { if (annulla) { - TString w(80); - if (_mask->field(dirty).is_edit()) - w = _mask->efield(dirty).get_warning(); - if (w.empty()) - w = "Campo inconsistente: "; + TString w; + TMask_field& df = _mask->field(dirty); + if (df.is_edit()) + w = ((TEdit_field&)df).get_warning(); + if (w.blank()) + { + w = df.prompt(); + if (!w.blank()) + { + w.trim(); + w << ' ' << TR("inconsistente."); + } + } + if (w.blank()) + w = TR("Campo inconsistente."); + w << '\n'; switch (last) { case K_ESC: - w << TR("si desidera annullare?"); break; + w << TR("Si desidera annullare?"); break; case K_QUIT: - w << TR("si desidera uscire?"); break; + w << TR("Si desidera uscire?"); break; default: - w << TR("si desidera continuare?"); break; + w << TR("Si desidera continuare?"); break; } k = yesno_box(w) ? K_NO : K_ESC; if (k == K_ESC) @@ -1386,6 +1397,7 @@ void TRelation_application::main_loop() if (autoins_caller().not_empty() && _recins >= 0) { + NFCHECK("Obsolete LINK message calling convention"); TString16 num; num.format("%ld", _recins); TMessage msg(autoins_caller(), _lnflag ? MSG_LN : MSG_AI, num); @@ -1631,7 +1643,6 @@ bool TRelation_application::load_transaction() _curr_trans_from = cnf.get("From"); const long firm = cnf.get_long("Firm"); if (firm > 0) - { bool ok = set_firm(firm); if (ok) diff --git a/include/relapp.h b/include/relapp.h index daa5a6009..3dc5fff02 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -17,10 +17,11 @@ #include #endif -#define TRANSACTION_RUN "RUN" -#define TRANSACTION_INSERT "INSERT" -#define TRANSACTION_MODIFY "MODIFY" -#define TRANSACTION_DELETE "DELETE" +#define TRANSACTION_RUN "RUN" // Run application (eventually sets firm) +#define TRANSACTION_INSERT "INSERT" // Create a new record and fill it +#define TRANSACTION_MODIFY "MODIFY" // Load and modify an existing record +#define TRANSACTION_DELETE "DELETE" // Delete an existing record +#define TRANSACTION_LINK "LINK" // Load an existing record and interactively edit it #define TM_INTERACTIVE 'I' #define TM_AUTOMATIC 'A' // @doc EXTERNAL