diff --git a/include/applicat.cpp b/include/applicat.cpp index 1fc623357..b77ecd0e2 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -393,8 +393,7 @@ const char* TApplication::get_module_name() const void TApplication::set_perms() -{ - CGetAut(1); +{ _dongle_aut.set(0, TRUE); for (int i = 1 ; i < ENDAUT; i++) { @@ -485,18 +484,18 @@ void TApplication::run( addbar = 0; _name = cmd2name(argv[0]); } - - const int sn = get_serial_number(); - if (sn < 0) - { - error_box("Perhaps you forgot to connect the dongle"); - return; - } - + if (use_files()) init_global_vars(); else - CGetPref(); + CGetPref(); + + const int sn = get_serial_number(firm_change_enabled() ? _name : "ba0100"); + if (sn < 0) + { + error_box("Perhaps you forgot to connect the dongle"); + return; + } set_perms(); diff --git a/include/codeb.c b/include/codeb.c index 4cbf55d75..47344bd76 100755 --- a/include/codeb.c +++ b/include/codeb.c @@ -360,10 +360,12 @@ int DB_bof(int handle) /*------------------------------------------------------------------------- legge un record per numero record --------------------------------------------------------------------------*/ -int DB_go(int handle,long int recno) +int DB_go(int handle,long recno) { - if(dbdata[handle]==0) return(-1); - return(x4go(&xdb[handle],recno)); + if (dbdata[handle] == 0) + return(-1); +// return x4go(&xdb[handle],recno); + return d4go(dbdata[handle], recno); } /*------------------------------------------------------------------------- @@ -567,8 +569,11 @@ HIDDEN void do_key(char *fname, RecDes *r, TAG4INFO *tag_info, int n_keys) { int i,j; char tiname[9]; /* Tag name, max 8 characters long! */ + char* dot; strcpy(tiname,fname); + dot = strchr(tiname, '.'); + if (dot) *dot = '\0'; CUpString(tiname); for (i=0; ((i < MaxKeys) && (i < n_keys)); i++) { diff --git a/include/isam.h b/include/isam.h index f85fd7a15..9bc0dd4f2 100755 --- a/include/isam.h +++ b/include/isam.h @@ -213,6 +213,12 @@ public: void put(const char* fieldname, TTextfile& txt); // @cmember Setta il contenuto del campo

(non tipizzata) void put(const char* fieldname, const char* val) { put_str(fieldname, val); } +#endif + +#ifdef __LONGDOUBLE__ + // @cmember Setta il contenuto del campo

in formato reale + void put(const char* fieldname, long double val) + { put(fieldname, real(val)); } #endif // @cmember Vuota il campo puntato da

@@ -510,6 +516,12 @@ public: // @cmember Ritorna una stringa con il contenuto del campo

const char* get_str(const char* fieldname) const { return (const char *) curr().get_str(fieldname);} +#endif + +#ifdef __LONGDOUBLE__ + // @cmember Setta il contenuto del campo

in formato reale + void put(const char* fieldname, long double val) + { curr().put(fieldname, real(val)); } #endif // @cmember Setta il contenuto del campo

(non tipizzata) diff --git a/include/relation.cpp b/include/relation.cpp index a5f9fb514..595514afd 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -849,16 +849,17 @@ int TRelation::rewrite(bool force) for (int i = 0; i < _reldefs.items(); i++) { - TRelationdef& rd = reldef(i); + TRelationdef& rd = reldef(i); TLocalisamfile& lf = file(rd.num()); if (!rd.write_enable() || lf.curr().empty()) continue; int res = lf.rewrite(); - if (force && res == _iskeynotfound) + if (force && (res == _iskeynotfound || res == _iseof || res == _isemptyfile)) res = lf.write(); - if (_errors == NOERR) _errors = res; + if (_errors == NOERR) + _errors = res; } return _errors; diff --git a/include/stack.cpp b/include/stack.cpp index 9f7f16c80..01613a91b 100755 --- a/include/stack.cpp +++ b/include/stack.cpp @@ -1,26 +1,31 @@ #include -TStack::TStack(int size) : TArray(size), _sp(0) +TStack::TStack(int size) : _data(size), _sp(0) {} void TStack::push(const TObject& o) { - add(o, _sp++); + _data.add(o, _sp++); } void TStack::push(TObject* o) { - add(o, _sp++); + _data.add(o, _sp++); } TObject& TStack::pop() { CHECK(_sp > 0, "Stack underflow!"); - return (*this)[--_sp]; + return _data[--_sp]; } TObject& TStack::peek(int depth) const { CHECKD(depth >= 0 && depth < _sp, "Stack depth error: ", depth); - return (*this)[_sp-depth-1]; + return _data[_sp-depth-1]; +} + +bool TStack::destroy_base() +{ + return _data.destroy(0, TRUE); } diff --git a/include/stack.h b/include/stack.h index 9e628e437..d14872c52 100755 --- a/include/stack.h +++ b/include/stack.h @@ -9,13 +9,15 @@ // @class TStack | Classe per la gestione dello stack a basso livello // -// @base public | TArray -class TStack : private TArray +// @base public | TObject +class TStack : public TObject // @author:(INTERNAL) Alex // @access:(INTERNAL) Private Member -{ +{ + // @cmember:(INTERNAL) Dati dello stack + TArray _data; // @cmember:(INTERNAL) Puntatore alla cima dello stack int _sp; @@ -31,7 +33,9 @@ public: // @cmember Ritorna il primo oggetto sulla cima dello stack TObject& pop(); // @cmember Ritorna l'oggetto ad una data profondita' nello stack - TObject& peek(int depth = 0) const; + TObject& peek(int depth = 0) const; + // @cmember Distrugge l'oggetto alla base dello stack + bool destroy_base(); // @cmember Costruttore. Chiama il costruttore di TStack(int size = 16); // @cmember Distruttore. Chiama il distruttore di diff --git a/include/stdtypes.cpp b/include/stdtypes.cpp index 8c12a7f54..eb67339c8 100755 --- a/include/stdtypes.cpp +++ b/include/stdtypes.cpp @@ -6,13 +6,14 @@ #include #include #include +#include #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 #include #include #endif -#include +#include #include #include #include @@ -28,17 +29,51 @@ long get_std_level() // @doc INTERNAL +static int _login_status = 0; + // @func Ritorna il numero di serie della chiave // // @rdesc Numero di serie della chiave -int get_serial_number() -{ -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY); - if (status != STATUS_OK) - return -1; -#endif - return getser(); +int get_serial_number(const char* appname) +{ + if (_login_status == 0) + { + if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK) + { + _login_status = 1; + getser(); + } + } + if (_login_status != 1) + { + if (_login_status == 2) + { + rpc_UserLogout(); + SerNo = 0xFFFF; + } + + TConfig ini(CONFIG_STUDIO, "Server"); + const char* server = ini.get("Name"); + const char* guest = "******"; + const char* utente = (!xvt_running() && !stricmp(appname, "ba0100")) ? guest : user(); + + if (rpc_UserLogin(server, utente, guest, appname)) + { + _login_status = 2; + SerNo = rpc_DongleNumber(); + } + else + _login_status = 0; + } + + switch(_login_status) + { + case 1 : CGetAut(1) != 0; break; + case 2 : rpc_DongleModules(_int_tab0); break; + default: memset(_int_tab0, 0, sizeof(_int_tab0)); break; + } + + return SerNo; } // @doc INTERNAL @@ -70,11 +105,6 @@ void init_global_vars() openrec[i] = NULL; } -#if XVT_OS == XVT_OS_SCOUNIX - const bool muflag = CGetAut(MUAUT); - if (SerNo && !muflag) - fatal_box("Abnormal termination: check protection or serial number\n"); -#endif DB_init(); } // @doc INTERNAL @@ -83,8 +113,12 @@ void init_global_vars() void free_global_vars() { #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - HL_LOGOUT(); + if (_login_status == 2) + rpc_UserLogout(); + else + HL_LOGOUT(); #endif + if (openf != NULL) { delete openf; diff --git a/include/stdtypes.h b/include/stdtypes.h index 4f132dc20..a8e24ce19 100755 --- a/include/stdtypes.h +++ b/include/stdtypes.h @@ -29,7 +29,7 @@ typedef unsigned char UINT8; // @doc EXTERNAL // @type UINT16 | Altro nome di assegnazione per gli unsigned short (se compilato a 32bit) -// oppure unsigned int (se non definito M_I386) +// oppure unsigned int (se non definito M_I386) typedef unsigned short UINT16; #else typedef unsigned int UINT16; @@ -44,7 +44,7 @@ typedef unsigned long UINT32; typedef char INT8; #ifdef M_I386 // @type INT16 | Altro nome di assegnazione per gli short (se compilato a 32bit) -// oppure int (se non definito M_I386) +// oppure int (se non definito M_I386) typedef short INT16; #else typedef int INT16; @@ -56,7 +56,7 @@ typedef long INT32; // @doc EXTERNAL // @type bool | Tipo booleano che puo' assumere i valori TRUE (definito come 1) -// e FALSE (definito come 0). +// e FALSE (definito come 0). typedef UINT8 bool; // @doc EXTERNAL @@ -73,14 +73,15 @@ typedef UINT8 byte; // @doc EXTERNAL // @type KEY | Tipo per la definizione di variabili destinati a contenere i caratteri -// immessi da tastiera +// immessi da tastiera typedef UINT16 KEY; #define UNDEFINED -32767 #undef _SVID -int get_serial_number(); +int get_serial_number(const char* appname); + long get_std_level(); void init_global_vars(); void free_global_vars();