git-svn-id: svn://10.65.10.50/branches/R_10_00@23751 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									7fcdcc999f
								
							
						
					
					
						commit
						ae3ad3cfc2
					
				@ -1170,7 +1170,12 @@ bool TAlex_virtual_machine::execute(const TBytecode& bc)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
 | 
					bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					#ifdef LINUX
 | 
				
			||||||
 | 
						string s(cmd);
 | 
				
			||||||
 | 
					  istringstream instr(s);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
  istrstream instr((const char*)cmd, strlen(cmd));
 | 
					  istrstream instr((const char*)cmd, strlen(cmd));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
  return compile(instr, bc);
 | 
					  return compile(instr, bc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -296,12 +296,11 @@ void TApplication::stop_run()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  if (_savefirm) 
 | 
					  if (_savefirm) 
 | 
				
			||||||
		prefix().set_codditta(_savefirm);
 | 
							prefix().set_codditta(_savefirm);
 | 
				
			||||||
  terminate();
 | 
						terminate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  xvt_app_destroy();
 | 
					  xvt_app_destroy();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
bool TApplication::add_menu(TString_array& menu, MENU_TAG id)
 | 
					bool TApplication::add_menu(TString_array& menu, MENU_TAG id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TTemp_window tw(TASK_WIN);
 | 
					  TTemp_window tw(TASK_WIN);
 | 
				
			||||||
@ -316,11 +315,10 @@ bool TApplication::remove_menu(MENU_TAG id)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TApplication::TApplication()
 | 
					TApplication::TApplication()
 | 
				
			||||||
            : _god_vars(NULL),_savefirm(0), _running(FALSE), _create_ok(FALSE)
 | 
					            : _god_vars(NULL),_savefirm(0), _running(false), _create_ok(false), _force(false)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
TApplication::~TApplication()
 | 
					TApplication::~TApplication()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (_god_vars != NULL)
 | 
					  if (_god_vars != NULL)
 | 
				
			||||||
@ -341,7 +339,8 @@ void TApplication::terminate()
 | 
				
			|||||||
  if (_create_ok)
 | 
					  if (_create_ok)
 | 
				
			||||||
    destroy();                    // Distruzione files e maschere
 | 
					    destroy();                    // Distruzione files e maschere
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  do_events();
 | 
					  if(!_force)
 | 
				
			||||||
 | 
							do_events();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (use_files())
 | 
					  if (use_files())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -584,6 +583,7 @@ void TApplication::run(
 | 
				
			|||||||
  set_xvt_hooks();
 | 
					  set_xvt_hooks();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _running = TRUE;
 | 
					  _running = TRUE;
 | 
				
			||||||
 | 
						message_box("a");
 | 
				
			||||||
  xvt_app_create(argc, argv, 0L, task_eh, &cfg);
 | 
					  xvt_app_create(argc, argv, 0L, task_eh, &cfg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,214 +1,219 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#ifndef __APPLICATION_H
 | 
					#ifndef __APPLICATION_H
 | 
				
			||||||
#define __APPLICATION_H
 | 
					#define __APPLICATION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __DICTION_H
 | 
					#ifndef __DICTION_H
 | 
				
			||||||
#include <diction.h>
 | 
					#include <diction.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __CONFIG_H
 | 
					#ifndef __CONFIG_H
 | 
				
			||||||
#include <config.h>
 | 
					#include <config.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MSG_AI "AI"      // message auto_insert (relapp)
 | 
					#define MSG_AI "AI"      // message auto_insert (relapp)
 | 
				
			||||||
#define MSG_FS "FS"      // message filtered start (relapp)
 | 
					#define MSG_FS "FS"      // message filtered start (relapp)
 | 
				
			||||||
#define MSG_LN "LN"      // message link (printapp -> relapp)
 | 
					#define MSG_LN "LN"      // message link (printapp -> relapp)
 | 
				
			||||||
#define MSG_ED "ED"      // message edit (maskfld -> relapp)
 | 
					#define MSG_ED "ED"      // message edit (maskfld -> relapp)
 | 
				
			||||||
#define CHK_ALL -1       // all authorization checks
 | 
					#define CHK_ALL -1       // all authorization checks
 | 
				
			||||||
#define CHK_DONGLE 0     // dongle authorization checks
 | 
					#define CHK_DONGLE 0     // dongle authorization checks
 | 
				
			||||||
//#define CHK_USER 1       // user authorization checks
 | 
					//#define CHK_USER 1       // user authorization checks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @doc EXTERNAL
 | 
					// @doc EXTERNAL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @class TApplication | Classe per la gestione di tutte le applicazioni PRASSI
 | 
					// @class TApplication | Classe per la gestione di tutte le applicazioni PRASSI
 | 
				
			||||||
class TApplication
 | 
					class TApplication
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @author:(INTERNAL) Guido
 | 
					// @author:(INTERNAL) Guido
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @access:(INTERNAL) Private Member
 | 
					// @access:(INTERNAL) Private Member
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
//  // @cmember:(INTERNAL) Identificatore del menu' legato all'applicazione
 | 
					//  // @cmember:(INTERNAL) Identificatore del menu' legato all'applicazione
 | 
				
			||||||
//  int _bar;
 | 
					//  int _bar;
 | 
				
			||||||
  // @cmember:(INTERNAL) Numero di argomenti passati all'applicazione
 | 
					  // @cmember:(INTERNAL) Numero di argomenti passati all'applicazione
 | 
				
			||||||
  int _argc_;
 | 
					  int _argc_;
 | 
				
			||||||
  // @cmember:(INTERNAL) Array di argomenti passati all'applicazione
 | 
					  // @cmember:(INTERNAL) Array di argomenti passati all'applicazione
 | 
				
			||||||
  const char** _argv_;  
 | 
					  const char** _argv_;  
 | 
				
			||||||
  // @cmember:(INTERNAL) Ora di inizio utilizzo del programma (per versioni DEMO)
 | 
					  // @cmember:(INTERNAL) Ora di inizio utilizzo del programma (per versioni DEMO)
 | 
				
			||||||
  time_t _start_time;
 | 
					  time_t _start_time;
 | 
				
			||||||
  // @cmember:(INTERNAL) Array di autorizzazione concessa all'utente
 | 
					  // @cmember:(INTERNAL) Array di autorizzazione concessa all'utente
 | 
				
			||||||
  TBit_array _user_aut;
 | 
					  TBit_array _user_aut;
 | 
				
			||||||
  // @cmember:(INTERNAL) Array di valori dei modi speciali
 | 
					  // @cmember:(INTERNAL) Array di valori dei modi speciali
 | 
				
			||||||
  TAssoc_array * _god_vars;
 | 
					  TAssoc_array * _god_vars;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // @cmember:(INTERNAL) Codice dell'applicazione
 | 
					  // @cmember:(INTERNAL) Codice dell'applicazione
 | 
				
			||||||
  TString _name;
 | 
					  TString _name;
 | 
				
			||||||
  // @cmember:(INTERNAL) Nome della applicazione
 | 
					  // @cmember:(INTERNAL) Nome della applicazione
 | 
				
			||||||
  TString _title;
 | 
					  TString _title;
 | 
				
			||||||
  // @cmember:(INTERNAL) Nome del modulo principale applicazione
 | 
					  // @cmember:(INTERNAL) Nome del modulo principale applicazione
 | 
				
			||||||
  TString _module_name;
 | 
					  TString _module_name;
 | 
				
			||||||
  // @cmember:(INTERNAL) Elenco dei files
 | 
					  // @cmember:(INTERNAL) Elenco dei files
 | 
				
			||||||
  TArray _used_files;
 | 
					  TArray _used_files;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // @cmember:(INTERNAL) Codice della ditta
 | 
					  // @cmember:(INTERNAL) Codice della ditta
 | 
				
			||||||
  long _savefirm;
 | 
					  long _savefirm;
 | 
				
			||||||
 | 
						// @cmember:(INTERNAL) Chiusura forzata per programmi senza interfaccia
 | 
				
			||||||
  // @cmember:(INTERNAL) Indica se l'applicazione e' partita
 | 
					  bool _force;
 | 
				
			||||||
  bool _running;
 | 
					
 | 
				
			||||||
  // @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo
 | 
					
 | 
				
			||||||
  bool _create_ok;
 | 
					  // @cmember:(INTERNAL) Indica se l'applicazione e' partita
 | 
				
			||||||
 | 
					  bool _running;
 | 
				
			||||||
  // @cmember:(INTERNAL) Termine dell'applicazione  
 | 
					  // @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo
 | 
				
			||||||
  void terminate(); 
 | 
					  bool _create_ok;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @access Protected Member
 | 
					  // @cmember:(INTERNAL) Termine dell'applicazione  
 | 
				
			||||||
protected:
 | 
					  void terminate(); 
 | 
				
			||||||
  // @cmember Ritorna il nome del modulo dell'applicazione
 | 
					  
 | 
				
			||||||
  const char* get_module_name() const;
 | 
					// @access Protected Member
 | 
				
			||||||
  // @cmember Event handler della finestra principale del programma
 | 
					protected:
 | 
				
			||||||
  static long task_eh(WINDOW win, EVENT* ep);
 | 
					  // @cmember Ritorna il nome del modulo dell'applicazione
 | 
				
			||||||
 | 
					  const char* get_module_name() const;
 | 
				
			||||||
  // @cmember Handler degli eventi della finestra principale, chiamato da <mf TApplication::task_eh>
 | 
					  // @cmember Event handler della finestra principale del programma
 | 
				
			||||||
  virtual long handler(WINDOW win, EVENT* ep);
 | 
					  static long task_eh(WINDOW win, EVENT* ep);
 | 
				
			||||||
  // @cmember Estende il dialog box della set_firm
 | 
					
 | 
				
			||||||
  virtual bool extended_firm() const 
 | 
					  // @cmember Handler degli eventi della finestra principale, chiamato da <mf TApplication::task_eh>
 | 
				
			||||||
  { return false; }
 | 
					  virtual long handler(WINDOW win, EVENT* ep);
 | 
				
			||||||
  // @cmember Indica se si intendono usare i files DBF
 | 
					  // @cmember Estende il dialog box della set_firm
 | 
				
			||||||
  virtual bool use_files() const 
 | 
					  virtual bool extended_firm() const 
 | 
				
			||||||
  { return true; }
 | 
					  { return false; }
 | 
				
			||||||
  
 | 
					  // @cmember Indica se si intendono usare i files DBF
 | 
				
			||||||
  // @cmember Inizilizzazzioni di bassissimo livello
 | 
					  virtual bool use_files() const 
 | 
				
			||||||
  virtual bool pre_create() 
 | 
					  { return true; }
 | 
				
			||||||
  { return true; }
 | 
					  
 | 
				
			||||||
  // @cmember Crea la finestra principale
 | 
					  // @cmember Inizilizzazzioni di bassissimo livello
 | 
				
			||||||
  virtual bool create();
 | 
					  virtual bool pre_create() 
 | 
				
			||||||
  // @cmember Controlla il menu'
 | 
					  { return true; }
 | 
				
			||||||
  virtual bool menu(MENU_TAG) 
 | 
					  // @cmember Crea la finestra principale
 | 
				
			||||||
  { return true; }  
 | 
					  virtual bool create();
 | 
				
			||||||
  // @cmember Rimuove l'applicazione
 | 
					  // @cmember Controlla il menu'
 | 
				
			||||||
  virtual bool destroy();
 | 
					  virtual bool menu(MENU_TAG) 
 | 
				
			||||||
  
 | 
					  { return true; }  
 | 
				
			||||||
  // @cmember Chiamata ogni volta che l'utente usa il menu Cambia Parametri
 | 
					  // @cmember Rimuove l'applicazione
 | 
				
			||||||
  virtual void on_config_change();
 | 
					  virtual bool destroy();
 | 
				
			||||||
  // @cmember Chiamata ogni volta che l'utente cambia ditta
 | 
					  
 | 
				
			||||||
  virtual void on_firm_change();
 | 
					  // @cmember Chiamata ogni volta che l'utente usa il menu Cambia Parametri
 | 
				
			||||||
  
 | 
					  virtual void on_config_change();
 | 
				
			||||||
  virtual bool test_assistance_year(bool verbose) const;
 | 
					  // @cmember Chiamata ogni volta che l'utente cambia ditta
 | 
				
			||||||
 | 
					  virtual void on_firm_change();
 | 
				
			||||||
  // @cmember Setta i permessi di utilizzo dei moduli
 | 
					  
 | 
				
			||||||
  void set_perms();
 | 
					  virtual bool test_assistance_year(bool verbose) const;
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  // @cmember apre i files necessari
 | 
					  // @cmember Setta i permessi di utilizzo dei moduli
 | 
				
			||||||
  void open_files(int logicnum, ...);  
 | 
					  void set_perms();
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  // @cmember Percorso documenti archiviati
 | 
					  // @cmember apre i files necessari
 | 
				
			||||||
  bool get_spotlite_path(TFilename& path) const; 
 | 
					  void open_files(int logicnum, ...);  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // @access Public Member
 | 
					  // @cmember Percorso documenti archiviati
 | 
				
			||||||
public:
 | 
					  bool get_spotlite_path(TFilename& path) const; 
 | 
				
			||||||
  // @cmember Fa partire l'applicazione
 | 
					
 | 
				
			||||||
  void run(int argc, char* argv[], const char* name);
 | 
					  // @access Public Member
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
  // @cmember Ritorna l'identificatore della classe
 | 
					  // @cmember Fa partire l'applicazione
 | 
				
			||||||
  virtual word class_id() const 
 | 
					  void run(int argc, char* argv[], const char* name);
 | 
				
			||||||
  { return CLASS_APPLICATION; }
 | 
					
 | 
				
			||||||
 | 
					  // @cmember Ritorna l'identificatore della classe
 | 
				
			||||||
  // @cmember Controlla se il programa e' partito
 | 
					  virtual word class_id() const 
 | 
				
			||||||
  bool is_running() const { return _running; }
 | 
					  { return CLASS_APPLICATION; }
 | 
				
			||||||
  // @cmember Controlla se si tratta di una applicazione valida
 | 
					
 | 
				
			||||||
  virtual bool ok() const 
 | 
					  // @cmember Controlla se il programa e' partito
 | 
				
			||||||
  { return _create_ok; }
 | 
					  bool is_running() const { return _running; }
 | 
				
			||||||
  // @cmember Risposta alla selezione Stampa del menu File
 | 
					  // @cmember Controlla se si tratta di una applicazione valida
 | 
				
			||||||
  virtual void print();
 | 
					  virtual bool ok() const 
 | 
				
			||||||
  virtual void preview();
 | 
					  { return _create_ok; }
 | 
				
			||||||
  
 | 
					  // @cmember Risposta alla selezione Stampa del menu File
 | 
				
			||||||
  virtual bool get_next_pdf(int anno, long ditta, const char* codnum, long numdoc, long codcf, TFilename& pdf) const;
 | 
					  virtual void print();
 | 
				
			||||||
  virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, 
 | 
					  virtual void preview();
 | 
				
			||||||
                             TString& subj, TString& text, TToken_string& attach, short& flags) const;
 | 
					  
 | 
				
			||||||
 | 
					  virtual bool get_next_pdf(int anno, long ditta, const char* codnum, long numdoc, long codcf, TFilename& pdf) const;
 | 
				
			||||||
  // @cmember Controlla se al programma corrente e' concesso cambiare ditta da menu.
 | 
					  virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, 
 | 
				
			||||||
  virtual bool firm_change_enabled() const;
 | 
					                             TString& subj, TString& text, TToken_string& attach, short& flags) const;
 | 
				
			||||||
  // @cmember Ritorna la <c TToken_string> con la lista dei moduli cui appartiene il programma
 | 
					
 | 
				
			||||||
  virtual const char * extra_modules() const { return ""; }
 | 
					  // @cmember Controlla se al programma corrente e' concesso cambiare ditta da menu.
 | 
				
			||||||
  // @cmember Abilita la verifica del modulo cui appartiene il programma
 | 
					  virtual bool firm_change_enabled() const;
 | 
				
			||||||
  virtual bool check_autorization() const;
 | 
					  // @cmember Ritorna la <c TToken_string> con la lista dei moduli cui appartiene il programma
 | 
				
			||||||
  virtual void on_idle();
 | 
					  virtual const char * extra_modules() const { return ""; }
 | 
				
			||||||
                                    
 | 
					  // @cmember Abilita la verifica del modulo cui appartiene il programma
 | 
				
			||||||
  // @cmember Forza la chiusura dell'applicazione  
 | 
					  virtual bool check_autorization() const;
 | 
				
			||||||
  void stop_run();
 | 
					  virtual void on_idle();
 | 
				
			||||||
 | 
					                                    
 | 
				
			||||||
  // @cmember Mette il segno Check a fianco di una voce di menu
 | 
					  // @cmember Forza la chiusura dell'applicazione  
 | 
				
			||||||
  void check_menu_item(MENU_TAG item, bool on = true);
 | 
					  void stop_run();
 | 
				
			||||||
  // @cmember Toglie il segno Check a fianco di una voce di menu
 | 
						void TApplication::force_stop() {_force = true;}
 | 
				
			||||||
  void uncheck_menu_item(MENU_TAG item);
 | 
					
 | 
				
			||||||
  // @cmember Permette di abilitare/disabilitare una voce di menu'
 | 
					
 | 
				
			||||||
  void enable_menu_item(MENU_TAG item, bool on = true);
 | 
					  // @cmember Mette il segno Check a fianco di una voce di menu
 | 
				
			||||||
  // @cmember Permette di disabilitare una voce di menu' (chiama <mf TApplication::enable_menu_item>)
 | 
					  void check_menu_item(MENU_TAG item, bool on = true);
 | 
				
			||||||
  void disable_menu_item(MENU_TAG item) 
 | 
					  // @cmember Toglie il segno Check a fianco di una voce di menu
 | 
				
			||||||
  { enable_menu_item(item, false); }
 | 
					  void uncheck_menu_item(MENU_TAG item);
 | 
				
			||||||
  // @cmember Simula la selezione di una voce di menu
 | 
					  // @cmember Permette di abilitare/disabilitare una voce di menu'
 | 
				
			||||||
  void dispatch_e_menu(MENU_TAG item);
 | 
					  void enable_menu_item(MENU_TAG item, bool on = true);
 | 
				
			||||||
 | 
					  // @cmember Permette di disabilitare una voce di menu' (chiama <mf TApplication::enable_menu_item>)
 | 
				
			||||||
  // @cmember Ritorna il nome dell'applicazione
 | 
					  void disable_menu_item(MENU_TAG item) 
 | 
				
			||||||
  const TString& name()  const 
 | 
					  { enable_menu_item(item, false); }
 | 
				
			||||||
  { return _name; }
 | 
					  // @cmember Simula la selezione di una voce di menu
 | 
				
			||||||
  // @cmember Ritorna l'array di parametri da passare all'applicazione
 | 
					  void dispatch_e_menu(MENU_TAG item);
 | 
				
			||||||
  const char** argv() const  
 | 
					
 | 
				
			||||||
  { return _argv_; }
 | 
					  // @cmember Ritorna il nome dell'applicazione
 | 
				
			||||||
  // @cmember Ritroan il parametro <p i>-esimo da passare all'applicazione
 | 
					  const TString& name()  const 
 | 
				
			||||||
  const char* argv(int i) const  { return _argv_[i]; }
 | 
					  { return _name; }
 | 
				
			||||||
  // @cmember Ritorna il numero di paramentri da passare all'applicazione
 | 
					  // @cmember Ritorna l'array di parametri da passare all'applicazione
 | 
				
			||||||
  int argc() const  
 | 
					  const char** argv() const  
 | 
				
			||||||
  { return _argc_; }
 | 
					  { return _argv_; }
 | 
				
			||||||
 | 
					  // @cmember Ritroan il parametro <p i>-esimo da passare all'applicazione
 | 
				
			||||||
  // @cmember Setta il titolo da assegnare all'applicazione
 | 
					  const char* argv(int i) const  { return _argv_[i]; }
 | 
				
			||||||
  void set_title(const char* t);
 | 
					  // @cmember Ritorna il numero di paramentri da passare all'applicazione
 | 
				
			||||||
 | 
					  int argc() const  
 | 
				
			||||||
  // @cmember Ritorna il titolo da assegnare all'applicazione
 | 
					  { return _argc_; }
 | 
				
			||||||
  const TString& title() const 
 | 
					
 | 
				
			||||||
  { return _title; }
 | 
					  // @cmember Setta il titolo da assegnare all'applicazione
 | 
				
			||||||
 | 
					  void set_title(const char* t);
 | 
				
			||||||
  // @cmember static void | check_parameters | int & argc, char *argv[] |
 | 
					
 | 
				
			||||||
  //          Legge il parametro /uUTENTE e lo toglie dalla lista
 | 
					  // @cmember Ritorna il titolo da assegnare all'applicazione
 | 
				
			||||||
  static void check_parameters(int& argc, char *argv[]);
 | 
					  const TString& title() const 
 | 
				
			||||||
 | 
					  { return _title; }
 | 
				
			||||||
  // @cmember Ritorna i numeri della versione del programma  
 | 
					
 | 
				
			||||||
  static bool get_version_info(int& year, int& release, int& tag, int& patch);
 | 
					  // @cmember static void | check_parameters | int & argc, char *argv[] |
 | 
				
			||||||
  static int get_version();
 | 
					  //          Legge il parametro /uUTENTE e lo toglie dalla lista
 | 
				
			||||||
 | 
					  static void check_parameters(int& argc, char *argv[]);
 | 
				
			||||||
  // @cmember Controlla se il modulo <p module> ha l'autorizzazione all'esecuzione
 | 
					
 | 
				
			||||||
  bool has_module(int module, int checktype = CHK_ALL) const;
 | 
					  // @cmember Ritorna i numeri della versione del programma  
 | 
				
			||||||
  // @cmember Setta la ditta corrente (Ritorna se ce l'ha fatta)
 | 
					  static bool get_version_info(int& year, int& release, int& tag, int& patch);
 | 
				
			||||||
  bool set_firm(long cod = -1);
 | 
					  static int get_version();
 | 
				
			||||||
  // @cmember Ritorna la ditta corrente
 | 
					
 | 
				
			||||||
  long get_firm() const;
 | 
					  // @cmember Controlla se il modulo <p module> ha l'autorizzazione all'esecuzione
 | 
				
			||||||
  // @cmember Ritorna la directory in cui si trovano i dati della ditta corrente
 | 
					  bool has_module(int module, int checktype = CHK_ALL) const;
 | 
				
			||||||
  const char* get_firm_dir() const;
 | 
					  // @cmember Setta la ditta corrente (Ritorna se ce l'ha fatta)
 | 
				
			||||||
 | 
					  bool set_firm(long cod = -1);
 | 
				
			||||||
  // @cmember Interfaccia runtime del menu' della finestra principale???
 | 
					  // @cmember Ritorna la ditta corrente
 | 
				
			||||||
  bool add_menu(TString_array& menu, MENU_TAG id = 0);
 | 
					  long get_firm() const;
 | 
				
			||||||
  // @cmember Elimina il menu' <p id> (Ritorna se ce l'ha fatta???)
 | 
					  // @cmember Ritorna la directory in cui si trovano i dati della ditta corrente
 | 
				
			||||||
  bool remove_menu(MENU_TAG id);
 | 
					  const char* get_firm_dir() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // @cmember Costruttore
 | 
					  // @cmember Interfaccia runtime del menu' della finestra principale???
 | 
				
			||||||
  TApplication();
 | 
					  bool add_menu(TString_array& menu, MENU_TAG id = 0);
 | 
				
			||||||
  // @cmember Distruttore
 | 
					  // @cmember Elimina il menu' <p id> (Ritorna se ce l'ha fatta???)
 | 
				
			||||||
  virtual ~TApplication();
 | 
					  bool remove_menu(MENU_TAG id);
 | 
				
			||||||
};
 | 
					
 | 
				
			||||||
 | 
					  // @cmember Costruttore
 | 
				
			||||||
class TSkeleton_application : public TApplication
 | 
					  TApplication();
 | 
				
			||||||
{          
 | 
					  // @cmember Distruttore
 | 
				
			||||||
protected:
 | 
					  virtual ~TApplication();
 | 
				
			||||||
  virtual bool create();
 | 
					};
 | 
				
			||||||
  virtual bool menu(MENU_TAG);
 | 
					
 | 
				
			||||||
  
 | 
					class TSkeleton_application : public TApplication
 | 
				
			||||||
protected:
 | 
					{          
 | 
				
			||||||
  virtual void main_loop() pure;
 | 
					protected:
 | 
				
			||||||
 
 | 
					  virtual bool create();
 | 
				
			||||||
public: 
 | 
					  virtual bool menu(MENU_TAG);
 | 
				
			||||||
  TSkeleton_application() { }
 | 
					  
 | 
				
			||||||
  virtual ~TSkeleton_application() { }
 | 
					protected:
 | 
				
			||||||
};
 | 
					  virtual void main_loop() pure;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
TApplication& main_app();
 | 
					public: 
 | 
				
			||||||
 | 
					  TSkeleton_application() { }
 | 
				
			||||||
 | 
					  virtual ~TSkeleton_application() { }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TApplication& main_app();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __APPLICATION_H */
 | 
					#endif /* __APPLICATION_H */
 | 
				
			||||||
@ -29,5 +29,7 @@
 | 
				
			|||||||
#define CAU_CODCAUREG  "CODCAUREG"
 | 
					#define CAU_CODCAUREG  "CODCAUREG"
 | 
				
			||||||
#define CAU_REGSPIVA	 "REGSPIVA"
 | 
					#define CAU_REGSPIVA	 "REGSPIVA"
 | 
				
			||||||
#define CAU_MOVCGIND   "MOVCGIND"
 | 
					#define CAU_MOVCGIND   "MOVCGIND"
 | 
				
			||||||
 | 
					#define CAU_RILFTEMRI	 "RILFTEMRI"
 | 
				
			||||||
 | 
					#define CAU_DATAREGPR  "DATAREGPR"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
#include <strings.h>
 | 
					#include <strings.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum TDongleHardware { _dongle_unknown=0, _dongle_network=3, _dongle_ssa=4, _dongle_ssanet=5 };
 | 
					enum TDongleHardware { _dongle_unknown, _dongle_hardlock, _dongle_eutron, _dongle_network, _dongle_ssa, _dongle_ssanet,_dongle_software };
 | 
				
			||||||
enum TDongleType { _no_dongle, _user_dongle, _developer_dongle };
 | 
					enum TDongleType { _no_dongle, _user_dongle, _developer_dongle };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TDongle : public TObject
 | 
					class TDongle : public TObject
 | 
				
			||||||
 | 
				
			|||||||
@ -25,4 +25,6 @@ BEGIN
 | 
				
			|||||||
  PICTURE 0
 | 
					  PICTURE 0
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <navbar.h>
 | 
					#include <navbar.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
				
			|||||||
@ -122,7 +122,11 @@ void fraction::build_fraction (const char *s)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		n.strip(",.-+/[]");
 | 
							n.strip(",.-+/[]");
 | 
				
			||||||
 | 
					#ifdef WIN32
 | 
				
			||||||
	  sscanf_s(n, "%I64d", &_num);
 | 
						  sscanf_s(n, "%I64d", &_num);
 | 
				
			||||||
 | 
					#else	  
 | 
				
			||||||
 | 
						  sscanf_s(n, "%Ld", &_num);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		if (len_periodo > 0)
 | 
							if (len_periodo > 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			_den = 9;
 | 
								_den = 9;
 | 
				
			||||||
@ -174,6 +178,7 @@ fraction::fraction(const real& num, const real& den)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int fraction::sign() const
 | 
					int fraction::sign() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (_num == 0 || _den == 0)
 | 
						if (_num == 0 || _den == 0)
 | 
				
			||||||
 | 
				
			|||||||
@ -985,7 +985,7 @@ int TBaseisamfile::_rewrite(const TRectype& rec)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Forza l'uso della chiave principale (per chiavi duplicate?)
 | 
					  // Forza l'uso della chiave principale (per chiavi duplicate?)
 | 
				
			||||||
  const int fhnd = handle(1);
 | 
					  const int fhnd = handle(1);
 | 
				
			||||||
  _lasterr = cisread(fhnd, 1, save_rec, _isequal + _nolock, _recno); // Si Posiziona per sicurezza...
 | 
					  while ((_lasterr = cisread(fhnd, 1, save_rec, _isequal + _testandlock, _recno)) == _islocked) ;// Si Posiziona  e locca per sicurezza...
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (_lasterr == NOERR)
 | 
					  if (_lasterr == NOERR)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -1276,11 +1276,7 @@ int TBaseisamfile::is_valid(bool exclusive)
 | 
				
			|||||||
		  {
 | 
							  {
 | 
				
			||||||
		    const int dbfreclen = DB_reclen(fhnd);
 | 
							    const int dbfreclen = DB_reclen(fhnd);
 | 
				
			||||||
			  if (dbfreclen != trcreclen)
 | 
								  if (dbfreclen != trcreclen)
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
				  err = _istrcerr;
 | 
									  err = _istrcerr;
 | 
				
			||||||
          if (_logicnum == LF_CLIFO)
 | 
					 | 
				
			||||||
            error_box("Clifo trc=%d dbf=%d", trcreclen, dbfreclen);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
			}    
 | 
								}    
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
				
			|||||||
@ -198,3 +198,6 @@
 | 
				
			|||||||
#define CNF_DITTA   CNF_GENERAL + 2
 | 
					#define CNF_DITTA   CNF_GENERAL + 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // __LFFILES_H
 | 
					#endif  // __LFFILES_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -32,3 +32,5 @@ BEGIN
 | 
				
			|||||||
  MESSAGE EXIT,K_END
 | 
					  MESSAGE EXIT,K_END
 | 
				
			||||||
	PICTURE TOOL_LASTREC
 | 
						PICTURE TOOL_LASTREC
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
				
			|||||||
@ -368,7 +368,12 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
 | 
				
			|||||||
			TSocketClient socket;
 | 
								TSocketClient socket;
 | 
				
			||||||
			char * buf = new char[1024 * 256];
 | 
								char * buf = new char[1024 * 256];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef WIN32  
 | 
				
			||||||
      ostrstream stream(buf, 1024 * 256);
 | 
					      ostrstream stream(buf, 1024 * 256);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					      ostringstream stream(buf);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			bool ok = true;
 | 
								bool ok = true;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			item.SetTag("m:CampoTransaction");
 | 
								item.SetTag("m:CampoTransaction");
 | 
				
			||||||
 | 
				
			|||||||
@ -495,7 +495,7 @@ const TFilename& TFile_info::load_filedes()
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    _dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
 | 
					    _dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
 | 
				
			||||||
    _name = CAddPref(_filedes.SysName);
 | 
					    _name = CAddPref(_filedes.SysName);
 | 
				
			||||||
    strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
 | 
					    strncpy_s(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    _name.cut(0);
 | 
					    _name.cut(0);
 | 
				
			||||||
@ -534,7 +534,7 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
 | 
				
			|||||||
      int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
 | 
					      int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
 | 
				
			||||||
      if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
 | 
					      if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        strncpy(_filedes.SysName, _name, sizeof(_filedes.SysName));
 | 
					        strncpy_s(_filedes.SysName, _name, sizeof(_filedes.SysName));
 | 
				
			||||||
        _filedes.SysName[41] = '\0';
 | 
					        _filedes.SysName[41] = '\0';
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
@ -1036,7 +1036,7 @@ void TPrefix::set(
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      const TString saved_prf = __ptprf;  // Salvo __ptprf che viene cambiato da CGetPref
 | 
					      const TString saved_prf = __ptprf;  // Salvo __ptprf che viene cambiato da CGetPref
 | 
				
			||||||
      char* prfx = (char*)CGetPref();     // Safe non const cast for StPath cprefix
 | 
					      char* prfx = (char*)CGetPref();     // Safe non const cast for StPath cprefix
 | 
				
			||||||
      strcpy(__ptprf, saved_prf);
 | 
					      strcpy_s(__ptprf, saved_prf);
 | 
				
			||||||
      xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
 | 
					      xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
				
			|||||||
@ -891,11 +891,7 @@ void TPrint_application::set_row (
 | 
				
			|||||||
        if (ch == 't' || ch == 'a')
 | 
					        if (ch == 't' || ch == 'a')
 | 
				
			||||||
          formato << 's';
 | 
					          formato << 's';
 | 
				
			||||||
        else if (ch == 'r')
 | 
					        else if (ch == 'r')
 | 
				
			||||||
#ifdef __LONGDOUBLE__
 | 
					 | 
				
			||||||
          formato << "Lf";
 | 
					 | 
				
			||||||
#else        
 | 
					 | 
				
			||||||
          formato << 't';
 | 
					          formato << 't';
 | 
				
			||||||
#endif          
 | 
					 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          formato << ch;
 | 
					          formato << ch;
 | 
				
			||||||
        if (ccc == '%')
 | 
					        if (ccc == '%')
 | 
				
			||||||
@ -954,13 +950,7 @@ void TPrint_application::set_row (
 | 
				
			|||||||
                    q = rrr.string(_picture);
 | 
					                    q = rrr.string(_picture);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {   
 | 
					 | 
				
			||||||
#ifdef __LONGDOUBLE__ 
 | 
					 | 
				
			||||||
                  q.format(formato, (long double)rrr);
 | 
					 | 
				
			||||||
#else        
 | 
					 | 
				
			||||||
                  q = rrr.format(formato);
 | 
					                  q = rrr.format(formato);
 | 
				
			||||||
#endif          
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (rrr.is_zero () && !_print_zero)
 | 
					                if (rrr.is_zero () && !_print_zero)
 | 
				
			||||||
                  q.fill (' ', q.len());
 | 
					                  q.fill (' ', q.len());
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
@ -1481,13 +1471,7 @@ bool TPrint_application::print_one (
 | 
				
			|||||||
            ps = rrr.string(_picture);
 | 
					            ps = rrr.string(_picture);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {       
 | 
						        ps = rrr.format(fff);
 | 
				
			||||||
#ifdef __LONGDOUBLE__      
 | 
					 | 
				
			||||||
          ps.format(fff, (long double)rrr);
 | 
					 | 
				
			||||||
#else            
 | 
					 | 
				
			||||||
          ps = rrr.format(fff);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (rrr.is_zero () && !_print_zero)
 | 
					        if (rrr.is_zero () && !_print_zero)
 | 
				
			||||||
          ps.fill (' ', ps.len());
 | 
					          ps.fill (' ', ps.len());
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -47,6 +47,11 @@
 | 
				
			|||||||
#define RDOC_MOVMAG         "MOVMAG"
 | 
					#define RDOC_MOVMAG         "MOVMAG"
 | 
				
			||||||
#define RDOC_CODMAGC        "CODMAGC"
 | 
					#define RDOC_CODMAGC        "CODMAGC"
 | 
				
			||||||
#define RDOC_DATACONS       "DATACONS"
 | 
					#define RDOC_DATACONS       "DATACONS"
 | 
				
			||||||
 | 
					#define RDOC_QTAGG1         "QTAGG1"
 | 
				
			||||||
 | 
					#define RDOC_QTAGG2         "QTAGG2"
 | 
				
			||||||
 | 
					#define RDOC_QTAGG3         "QTAGG3"
 | 
				
			||||||
 | 
					#define RDOC_QTAGG4         "QTAGG4"
 | 
				
			||||||
 | 
					#define RDOC_QTAGG5         "QTAGG5"
 | 
				
			||||||
#define RDOC_IMPIANTO       "IMPIANTO"
 | 
					#define RDOC_IMPIANTO       "IMPIANTO"
 | 
				
			||||||
#define RDOC_LINEA          "LINEA"
 | 
					#define RDOC_LINEA          "LINEA"
 | 
				
			||||||
#define RDOC_IDRIGA         "IDRIGA"
 | 
					#define RDOC_IDRIGA         "IDRIGA"
 | 
				
			||||||
 | 
				
			|||||||
@ -3,381 +3,40 @@
 | 
				
			|||||||
#include <strings.h>
 | 
					#include <strings.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const real ZERO(0.0);
 | 
					const real ZERO(0.0);
 | 
				
			||||||
 | 
					const real PUNTO_UNO(UNO/DIECI);
 | 
				
			||||||
 | 
					const real PUNTO_DUE(DUE/DIECI);
 | 
				
			||||||
 | 
					const real PUNTO_TRE(TRE/DIECI);
 | 
				
			||||||
 | 
					const real PUNTO_QUATTRO(DUE/CINQUE);
 | 
				
			||||||
 | 
					const real MEZZO(UNO/DUE);
 | 
				
			||||||
 | 
					const real PUNTO_SEI(TRE/CINQUE);
 | 
				
			||||||
 | 
					const real PUNTO_SETTE(SETTE/DIECI);
 | 
				
			||||||
 | 
					const real PUNTO_OTTO(QUATTRO/CINQUE);
 | 
				
			||||||
 | 
					const real PUNTO_NOVE(NOVE/DIECI);
 | 
				
			||||||
const real UNO(1.0);
 | 
					const real UNO(1.0);
 | 
				
			||||||
const real DUE(2.0);
 | 
					const real DUE(2.0);
 | 
				
			||||||
const real TRE(3.0);
 | 
					const real TRE(3.0);
 | 
				
			||||||
 | 
					const real QUATTRO(4.0);
 | 
				
			||||||
 | 
					const real CINQUE(5.0);
 | 
				
			||||||
 | 
					const real SEI(6.0);
 | 
				
			||||||
 | 
					const real SETTE(7.0);
 | 
				
			||||||
 | 
					const real OTTO(8.0);
 | 
				
			||||||
 | 
					const real NOVE(9.0);
 | 
				
			||||||
 | 
					const real DIECI(10.0);
 | 
				
			||||||
 | 
					const real UNDICI(11.0);
 | 
				
			||||||
 | 
					const real DODICI(12.0);
 | 
				
			||||||
 | 
					const real TREDICI(13.0);
 | 
				
			||||||
 | 
					const real QUATTORDICI(14.0);
 | 
				
			||||||
 | 
					const real QUINDICI(15.0);
 | 
				
			||||||
 | 
					const real SEDICI(16.0);
 | 
				
			||||||
 | 
					const real DICIASSETTE(17.0);
 | 
				
			||||||
 | 
					const real DICIOTTO(18.0);
 | 
				
			||||||
 | 
					const real DICIANNOVE(19.0);
 | 
				
			||||||
 | 
					const real VENTI(20.0);
 | 
				
			||||||
 | 
					const real VENTUNO(21.0);
 | 
				
			||||||
 | 
					const real VENTIDUE(22.0);
 | 
				
			||||||
 | 
					const real CINQUANTA(50.0);
 | 
				
			||||||
const real CENTO(100.0);
 | 
					const real CENTO(100.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __LONGDOUBLE__
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef WIN32
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
inline long double _atold(const char* str)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  long double num = 0.0;
 | 
					 | 
				
			||||||
  sscanf(str, "%Lf", &num);
 | 
					 | 
				
			||||||
  return num;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real::real () : _dec(0.0)
 | 
					 | 
				
			||||||
{ }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real::real (const real& b) : _dec(b._dec)
 | 
					 | 
				
			||||||
{ }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real::real (long double a) : _dec(a)
 | 
					 | 
				
			||||||
{ }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void real::set_int64(__int64 b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	_dec = (long double)b;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool real::is_real (const char *s)
 | 
					 | 
				
			||||||
{             
 | 
					 | 
				
			||||||
  if (s && *s)
 | 
					 | 
				
			||||||
  {  
 | 
					 | 
				
			||||||
    const long double n = _atold(s);
 | 
					 | 
				
			||||||
    if (n == 0.0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      for(; *s; s++) 
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        if (strchr("0. ", *s) == NULL)
 | 
					 | 
				
			||||||
          return false;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }    
 | 
					 | 
				
			||||||
  }  
 | 
					 | 
				
			||||||
  return true;
 | 
					 | 
				
			||||||
}               
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real::real (const char *s)
 | 
					 | 
				
			||||||
{                        
 | 
					 | 
				
			||||||
  _dec = (s && *s) ? _atold(s) : 0.0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator = (const real& b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  _dec = b._dec;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator = (long double b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  _dec = b;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator += (long double b)
 | 
					 | 
				
			||||||
{     
 | 
					 | 
				
			||||||
  _dec += b;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator -= (long double b)
 | 
					 | 
				
			||||||
{     
 | 
					 | 
				
			||||||
  _dec -= b;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator *= (long double b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  _dec *= b;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::operator /= (long double b)
 | 
					 | 
				
			||||||
{ 
 | 
					 | 
				
			||||||
  CHECK(b != 0.0, "Division by zero");
 | 
					 | 
				
			||||||
  _dec /= b;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @doc EXTERNAL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @mfunc Ritorna il segno del reale                       
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// @rdesc Ritorna i seguenti valori:
 | 
					 | 
				
			||||||
// 
 | 
					 | 
				
			||||||
// @flag <lt> 0 | Se il numero e' minore di 0
 | 
					 | 
				
			||||||
// @flag = 0 | Se il numero e' uguale a 0
 | 
					 | 
				
			||||||
// @flag <gt> 0 | Se il numero e' maggiore di 0
 | 
					 | 
				
			||||||
int real::sign () const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  const int s = _dec > 0.0 ? +1 : (_dec < 0.0 ? -1 : 0);
 | 
					 | 
				
			||||||
  return s;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real real::operator - () const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  real n(-_dec);
 | 
					 | 
				
			||||||
  return n;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long real::integer () const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return (long)floorl(_dec);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Certified 91%
 | 
					 | 
				
			||||||
// @doc EXTERNAL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @mfunc Trasforma un reale in stringa
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// @rdesc Ritorna la stringa nella lunghezza richiesta
 | 
					 | 
				
			||||||
const char *real::string (
 | 
					 | 
				
			||||||
  int len,        // @parm Lunghezza della stringa (compreso decimali)
 | 
					 | 
				
			||||||
  int dec,        // @parm Numero di decimali (default UNDEFINED)
 | 
					 | 
				
			||||||
  char pad) const // @parm Carattere di riempimento (default ' ')
 | 
					 | 
				
			||||||
  // @parm char * | picture | Formato della stringa
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @syntax string (int len, int dec, char pad);
 | 
					 | 
				
			||||||
  // @syntax string (const char *picture);
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // @comm Nel primo caso ritorna una stringa lunga <p len> con <p dec> decimali e
 | 
					 | 
				
			||||||
  //       inserisce nella stringa stessa il carattere <p pad> nel caso la
 | 
					 | 
				
			||||||
  //       lunghezza richiesta sia maggiore di quella che risulterebbe per la
 | 
					 | 
				
			||||||
  //       completa rappresentazione del reale.
 | 
					 | 
				
			||||||
  //       <nl>Nel secondo caso ritorna la stringa con il formato stabilito in
 | 
					 | 
				
			||||||
  //       <p picture>.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  TString16 fmt("%");
 | 
					 | 
				
			||||||
  if (pad != ' ') fmt << '0';
 | 
					 | 
				
			||||||
  if (len != 0) fmt << len;
 | 
					 | 
				
			||||||
  if (dec != UNDEFINED) fmt << '.' << dec;
 | 
					 | 
				
			||||||
  fmt << "Lf";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  TString& tmp = get_tmp_string();
 | 
					 | 
				
			||||||
	char* __string = tmp.get_buffer(len);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  sprintf(__string, fmt, _dec);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (len == 0 && dec == UNDEFINED && strchr(__string, '.') != NULL)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    int cut = strlen (__string);
 | 
					 | 
				
			||||||
    for (int i = cut-1; i >= 0; i--)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      if (__string[i] == '0')
 | 
					 | 
				
			||||||
        cut--;
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        if(__string[i] == '.')
 | 
					 | 
				
			||||||
          cut--;
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    __string[cut] = '\0';
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return __string;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Childish algorithm faster and more accurate than powl(10.0, pow)
 | 
					 | 
				
			||||||
HIDDEN void ipow10(int pow, double& m, double& d)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  m = d = 1.0;
 | 
					 | 
				
			||||||
  if (pow > 0)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    for (int i = pow; i > 0; i--)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      m *= 10.0;
 | 
					 | 
				
			||||||
      d *= 0.1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    for (int i = pow; i < 0; i++)   
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      m *= 0.1;
 | 
					 | 
				
			||||||
      d *= 10.0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }        
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int real::precision() const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  const TFixed_string s(string());
 | 
					 | 
				
			||||||
  const int d = s.find('.');
 | 
					 | 
				
			||||||
  const int p = d < 0 ? 0 : (s.len()-d-1);
 | 
					 | 
				
			||||||
  return p;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @doc EXTERNAL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @mfunc real& | real | round | Arrotonda al numero di decimali passati
 | 
					 | 
				
			||||||
real& real::round (
 | 
					 | 
				
			||||||
  int prec)  // @parm Numero di decimali a cui arrotondare il numero (default 0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @comm Nel caso <p prec> sia:    
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // @flag <gt> 0 | Arrotonda al decimale
 | 
					 | 
				
			||||||
  // @flag = 0 | Arrotonda all'intero
 | 
					 | 
				
			||||||
  // @flag <lt> 0  | Arrotonda al valore passato (es. -3 arrotonda alle mille)
 | 
					 | 
				
			||||||
{    
 | 
					 | 
				
			||||||
  if (abs(prec) < 20)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    double m, d;
 | 
					 | 
				
			||||||
    if (prec != 0)
 | 
					 | 
				
			||||||
    {                  
 | 
					 | 
				
			||||||
      ipow10(prec, m, d);
 | 
					 | 
				
			||||||
      if (prec < 0)
 | 
					 | 
				
			||||||
        _dec /= d;
 | 
					 | 
				
			||||||
      else  
 | 
					 | 
				
			||||||
        _dec *= m;
 | 
					 | 
				
			||||||
    }  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (_dec >= 0.0)
 | 
					 | 
				
			||||||
      _dec = floorl(_dec + 0.5);
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      _dec = ceill(_dec - 0.5);  
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if (prec != 0)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
      if (prec < 0)
 | 
					 | 
				
			||||||
        _dec *= d;
 | 
					 | 
				
			||||||
      else  
 | 
					 | 
				
			||||||
        _dec /= m;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
  }  
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::ceil (int prec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  double m, d;
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    ipow10(prec, m, d);
 | 
					 | 
				
			||||||
    _dec *= m;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  _dec = ceill(_dec);
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
//      _dec *= d;   Risulta stranamente molto impreciso!
 | 
					 | 
				
			||||||
    _dec /= m;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::floor (int prec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  double m, d;
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    ipow10(prec, m, d);
 | 
					 | 
				
			||||||
    _dec *= m;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  _dec = floorl(_dec);
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
//      _dec *= d;   Risulta stranamente molto impreciso!
 | 
					 | 
				
			||||||
    _dec /= m;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real& real::trunc(int prec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  double m, d;
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    ipow10(prec, m, d);
 | 
					 | 
				
			||||||
    _dec *= m;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  _dec = floorl(_dec);
 | 
					 | 
				
			||||||
  if (prec != 0)
 | 
					 | 
				
			||||||
//      _dec *= d;   Risulta stranamente molto impreciso!
 | 
					 | 
				
			||||||
    _dec /= m;
 | 
					 | 
				
			||||||
  return *this;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @doc EXTERNAL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @func Scambia il numero reale <p a> con il numero real <p b>
 | 
					 | 
				
			||||||
void swap (
 | 
					 | 
				
			||||||
  real& a,  // @parm Primo numero da scambiare
 | 
					 | 
				
			||||||
  real& b)  // @parm Secondo numero da scambiare
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  const real n = a;
 | 
					 | 
				
			||||||
  a = b;
 | 
					 | 
				
			||||||
  b = n;
 | 
					 | 
				
			||||||
}           
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double operator%(const real& a, const real& b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  const long double times = floorl(a / b);
 | 
					 | 
				
			||||||
  const long double resto = (double)a - (double)b * times;
 | 
					 | 
				
			||||||
  return resto;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double sqr(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return a*a;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double exp10(long double a) 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return powl(10.0, a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if _MSC_VER < 1300
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double sqrt(long double a) 
 | 
					 | 
				
			||||||
{  
 | 
					 | 
				
			||||||
  return sqrtl(a); 
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double pow(long double a, long double b)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return powl(a, b);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double exp(long double a) 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return expl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double log10(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return log10l(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double log(long double a)
 | 
					 | 
				
			||||||
{                             
 | 
					 | 
				
			||||||
  return logl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double sin(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return sinl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double cos(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return cosl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double tan(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return tanl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double abs(long double a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return fabsl(a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <gm.h>
 | 
					#include <gm.h>
 | 
				
			||||||
//#include <ctype.h>
 | 
					//#include <ctype.h>
 | 
				
			||||||
//#include <stdlib.h>
 | 
					//#include <stdlib.h>
 | 
				
			||||||
@ -1254,8 +913,6 @@ const char* real::format(const char *picture) const
 | 
				
			|||||||
  return (const char *) f;
 | 
					  return (const char *) f;
 | 
				
			||||||
}                 
 | 
					}                 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Funzioni comuni dei due real
 | 
					// Funzioni comuni dei due real
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TObject* real::dup () const
 | 
					TObject* real::dup () const
 | 
				
			||||||
@ -1511,6 +1168,15 @@ HIDDEN int get_picture_decimals (const TString& picture, char& decsep)
 | 
				
			|||||||
  return decimali;
 | 
					  return decimali;
 | 
				
			||||||
}           
 | 
					}           
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					long double real::ld() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						TString20 str = string();
 | 
				
			||||||
 | 
						long double num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  sscanf(str, "%Lf", &num);
 | 
				
			||||||
 | 
					  return num;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* real::string(const char *picture) const
 | 
					const char* real::string(const char *picture) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (*picture == '\0')
 | 
					  if (*picture == '\0')
 | 
				
			||||||
@ -1868,12 +1534,3 @@ int TImporto::compare(const TSortable& s) const
 | 
				
			|||||||
  const int res = d.sign();
 | 
					  const int res = d.sign();
 | 
				
			||||||
  return res;
 | 
					  return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
bool TImporto::is_zero() const
 | 
					 | 
				
			||||||
{ 
 | 
					 | 
				
			||||||
#ifdef __LONGDOUBLE__
 | 
					 | 
				
			||||||
  return fabsl(_valore) < 0.00001;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
  return _valore.is_zero(); 
 | 
					 | 
				
			||||||
#endif  
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -12,168 +12,40 @@
 | 
				
			|||||||
class real;
 | 
					class real;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const real ZERO;
 | 
					extern const real ZERO;
 | 
				
			||||||
 | 
					extern const real PUNTO_UNO;
 | 
				
			||||||
 | 
					extern const real PUNTO_DUE;
 | 
				
			||||||
 | 
					extern const real PUNTO_TRE;
 | 
				
			||||||
 | 
					extern const real PUNTO_QUATTRO;
 | 
				
			||||||
 | 
					extern const real MEZZO;
 | 
				
			||||||
 | 
					extern const real PUNTO_SEI;
 | 
				
			||||||
 | 
					extern const real PUNTO_SETTE;
 | 
				
			||||||
 | 
					extern const real PUNTO_OTTO;
 | 
				
			||||||
 | 
					extern const real PUNTO_NOVE;
 | 
				
			||||||
extern const real UNO;
 | 
					extern const real UNO;
 | 
				
			||||||
extern const real DUE;
 | 
					extern const real DUE;
 | 
				
			||||||
extern const real TRE;
 | 
					extern const real TRE;
 | 
				
			||||||
 | 
					extern const real QUATTRO;
 | 
				
			||||||
 | 
					extern const real CINQUE;
 | 
				
			||||||
 | 
					extern const real SEI;
 | 
				
			||||||
 | 
					extern const real SETTE;
 | 
				
			||||||
 | 
					extern const real OTTO;
 | 
				
			||||||
 | 
					extern const real NOVE;
 | 
				
			||||||
 | 
					extern const real DIECI;
 | 
				
			||||||
 | 
					extern const real UNDICI;
 | 
				
			||||||
 | 
					extern const real DODICI;
 | 
				
			||||||
 | 
					extern const real TREDICI;
 | 
				
			||||||
 | 
					extern const real QUATTORDICI;
 | 
				
			||||||
 | 
					extern const real QUINDICI;
 | 
				
			||||||
 | 
					extern const real SEDICI;
 | 
				
			||||||
 | 
					extern const real DICIASSETTE;
 | 
				
			||||||
 | 
					extern const real DICIOTTO;
 | 
				
			||||||
 | 
					extern const real DICIANNOVE;
 | 
				
			||||||
 | 
					extern const real VENTI;
 | 
				
			||||||
 | 
					extern const real VENTUNO;
 | 
				
			||||||
 | 
					extern const real VENTIDUE;
 | 
				
			||||||
 | 
					extern const real CINQUANTA;
 | 
				
			||||||
extern const real CENTO;
 | 
					extern const real CENTO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __LONGDOUBLE__
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @doc EXTERNAL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @class real | Classe per la gestione dei numeri reali
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// @base public | TObject
 | 
					 | 
				
			||||||
class real : public TObject
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @comm Questa classe utilizza i long double definiti per Visual C++. Esiste un'altra classe
 | 
					 | 
				
			||||||
//     real: per accedere scegliere il tasto successivo (<gt><gt>) dalla barra dei bottoni
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// @author:(INTERNAL) Guido
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  // @access:(INTERNAL) Private Member
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @cmember:(INTERNAL) Numero reale
 | 
					 | 
				
			||||||
  long double _dec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @access Protected Member
 | 
					 | 
				
			||||||
protected:                             
 | 
					 | 
				
			||||||
  // @cmember Permette di stampare l'oggetto
 | 
					 | 
				
			||||||
  virtual void print_on(ostream& out) const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @cmember Duplica il numero reale (vedi classe <c TObject>)
 | 
					 | 
				
			||||||
  virtual TObject* dup() const;
 | 
					 | 
				
			||||||
  // @cmember Traduce in lettere il numero reale
 | 
					 | 
				
			||||||
  const char* literals() const;
 | 
					 | 
				
			||||||
  // @cmember Inserisce i punti separatori delle migliaia e riempe i decimali
 | 
					 | 
				
			||||||
  //          alla lunghezza passata (es: 3.000,20)
 | 
					 | 
				
			||||||
  const char* points(int decimals = 0) const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @access Public Member
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
  // @cmember long double | operator long double | | Ritorna il numero reale
 | 
					 | 
				
			||||||
  operator long double () const
 | 
					 | 
				
			||||||
  { return _dec; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @cmember Trasforma un numero dal formato inglese (decimali con punto) in
 | 
					 | 
				
			||||||
  //          formato italiano (decimali con virgola)
 | 
					 | 
				
			||||||
  static const char* eng2ita(char* s);
 | 
					 | 
				
			||||||
  // @cmember Trasforma un numero dal formato italiano (decimali con virgola) in
 | 
					 | 
				
			||||||
  //          formato inglese (decimali con punto)
 | 
					 | 
				
			||||||
  static const char* ita2eng(const char* s);
 | 
					 | 
				
			||||||
  // @cmember Controlla se si tratta di un numero reale (TRUE se vero)
 | 
					 | 
				
			||||||
  static bool is_real(const char* n);
 | 
					 | 
				
			||||||
  // @cmember Controlla se si tratta di un numero naturale (TRUE se vero)
 | 
					 | 
				
			||||||
  static bool is_natural(const char* n);
 | 
					 | 
				
			||||||
  // @cmember Controlla se si tratta di uno zero (TRUE se vero)
 | 
					 | 
				
			||||||
  static bool is_null(const char* n);
 | 
					 | 
				
			||||||
  // @cmember Trasforma un reale in stringa
 | 
					 | 
				
			||||||
  const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
 | 
					 | 
				
			||||||
  // @cmember Trasforma un reale in stringa (chiama <mf real::string>), 
 | 
					 | 
				
			||||||
  //           ma ritorna il formato italiano
 | 
					 | 
				
			||||||
  const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
 | 
					 | 
				
			||||||
  // @cmember Trasforma un reale in stringa (chiama <mf real::string>), 
 | 
					 | 
				
			||||||
  //          ma ritorna il formato atteso da Excel
 | 
					 | 
				
			||||||
  const char* stringe(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
 | 
					 | 
				
			||||||
  // @cmember Ritorna la stringa con il formato passato
 | 
					 | 
				
			||||||
  const char* string(const char* picture) const;
 | 
					 | 
				
			||||||
  // @cmember Ritorna la stringa con il formato passato
 | 
					 | 
				
			||||||
  const char* format(const char *picture) const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @cmember Ritorna la precisione del reale (numero di decimali)
 | 
					 | 
				
			||||||
  int precision() const;
 | 
					 | 
				
			||||||
  // @cmember Controlla se si tratta di un reale uguale a 0
 | 
					 | 
				
			||||||
  bool is_zero() const { return _dec == ZERO; }
 | 
					 | 
				
			||||||
  // @cmember Controlla se si tratta di un reale diverso da 0
 | 
					 | 
				
			||||||
	bool not_zero() const { return !is_zero();}
 | 
					 | 
				
			||||||
  // @cmember Ritorna il segno del reale
 | 
					 | 
				
			||||||
  int sign() const;
 | 
					 | 
				
			||||||
  // @cmember Trasforma il reale in intero (operator int era troppo pericoloso)
 | 
					 | 
				
			||||||
  long integer() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // @cmember Arrotonda al numero di decimali passati
 | 
					 | 
				
			||||||
  real& round(int prec = 0) ;
 | 
					 | 
				
			||||||
  // @cmember Tronca al numero di decimali passati (default 0)
 | 
					 | 
				
			||||||
  real& trunc(int prec = 0) ;
 | 
					 | 
				
			||||||
  // @cmember Arrotonda al numero successivo (della precisione passata)
 | 
					 | 
				
			||||||
  real& ceil(int prec = 0);
 | 
					 | 
				
			||||||
  // @cmember Arrotonda al numero precedente (della precisione passata)
 | 
					 | 
				
			||||||
  real& floor(int prec = 0);
 | 
					 | 
				
			||||||
  // @cmember Assegna un reale
 | 
					 | 
				
			||||||
  real& operator = (const real& a);
 | 
					 | 
				
			||||||
  // @cmember Assegna un reale
 | 
					 | 
				
			||||||
  real& operator =(long double a);
 | 
					 | 
				
			||||||
  // @cmember Assegna un __int64 ad un reale
 | 
					 | 
				
			||||||
  void set_int64(__int64 b);
 | 
					 | 
				
			||||||
  // @cmember Aggiunge ad un reale il valore passato (passato per indirizzo)
 | 
					 | 
				
			||||||
  real& operator +=(long double a);
 | 
					 | 
				
			||||||
  // @cmember Sottrae ad un reale il valore passato (passato per indirizzo)
 | 
					 | 
				
			||||||
  real& operator -=(long double b);
 | 
					 | 
				
			||||||
  // @cmember Moltiplica un reale per il valore passato (passato per indirizzo)
 | 
					 | 
				
			||||||
  real& operator *=(long double b);
 | 
					 | 
				
			||||||
  // @cmember Divide un reale per il valore passato (passato per indirizzo)
 | 
					 | 
				
			||||||
  real& operator /=(long double b);
 | 
					 | 
				
			||||||
  // @cmember Ritorna la negazione di un reale (TRUE se 0, altrimenti FALSE)
 | 
					 | 
				
			||||||
  bool operator !() const
 | 
					 | 
				
			||||||
  { return _dec == ZERO; }
 | 
					 | 
				
			||||||
  // @cmember Ritorna il risultato della differenza tra due reali
 | 
					 | 
				
			||||||
  real operator -() const;
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  // @cmember Costruttore
 | 
					 | 
				
			||||||
  real();
 | 
					 | 
				
			||||||
  // @cmember Costruttore
 | 
					 | 
				
			||||||
  real(const real& b);
 | 
					 | 
				
			||||||
  // @cmember Costruttore
 | 
					 | 
				
			||||||
  real(long double a);
 | 
					 | 
				
			||||||
  // @cmember Costruttore
 | 
					 | 
				
			||||||
  real(const char* s);
 | 
					 | 
				
			||||||
  // @cmember Distruttore
 | 
					 | 
				
			||||||
  virtual ~real()
 | 
					 | 
				
			||||||
  {}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
inline long double fnc_min(long double a, long double b){ return a < b ? a : b; }
 | 
					 | 
				
			||||||
inline long double fnc_max(long double a, long double b) { return a > b ? a : b; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
inline bool operator <(const real& a, const real& b) {return (double)a < (double)b;}
 | 
					 | 
				
			||||||
inline bool operator <(double a, const real& b) {return a < (double)b;}
 | 
					 | 
				
			||||||
inline bool operator >(const real& a, const real& b) {return (double)a > (double)b;}
 | 
					 | 
				
			||||||
inline bool operator >(double a, const real& b) {return a > (double)b;}
 | 
					 | 
				
			||||||
inline bool operator <=(const real& a, const real& b) {return (double)a <= (double)b;}
 | 
					 | 
				
			||||||
inline bool operator <=(double a, const real& b) {return a <= (double)b;}
 | 
					 | 
				
			||||||
inline bool operator >=(const real& a, const real& b) {return (double)a >= (double)b;}
 | 
					 | 
				
			||||||
inline bool operator >=(double a, const real& b) {return a >= (double)b;}
 | 
					 | 
				
			||||||
inline bool operator ==(const real& a, const real& b) {return (double)a == (double)b;}
 | 
					 | 
				
			||||||
inline bool operator ==(double a, const real& b) {return a == (double)b;}
 | 
					 | 
				
			||||||
inline bool operator !=(const real& a, const real& b) {return (double)a != (double)b;}
 | 
					 | 
				
			||||||
inline bool operator !=(double a, const real& b) {return a != (double)b;}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
inline real operator +(const real& a, const real& b) {return (double)a + (double)b;}
 | 
					 | 
				
			||||||
inline real operator -(const real& a, const real& b) {return (double)a - (double)b;}
 | 
					 | 
				
			||||||
inline real operator *(const real& a, const real& b) {return (double)a * (double)b;}
 | 
					 | 
				
			||||||
inline real operator /(const real& a, const real& b) {return (double)a / (double)b;}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
long double operator%(const real& a, const real& b);
 | 
					 | 
				
			||||||
void swap(real& a, real& b) ;
 | 
					 | 
				
			||||||
long double sqr(long double) ;
 | 
					 | 
				
			||||||
long double exp10(long double) ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if _MSC_VER < 1300
 | 
					 | 
				
			||||||
long double sqrt(long double) ;
 | 
					 | 
				
			||||||
long double pow(long double, long double) ;
 | 
					 | 
				
			||||||
long double exp(long double a) ;
 | 
					 | 
				
			||||||
long double log10(long double a) ;
 | 
					 | 
				
			||||||
long double log(long double a) ;
 | 
					 | 
				
			||||||
long double sin(long double a) ;
 | 
					 | 
				
			||||||
long double cos(long double a) ;
 | 
					 | 
				
			||||||
long double tan(long double a) ;
 | 
					 | 
				
			||||||
long double abs(long double a) ;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef INCSTR_H
 | 
					#ifndef INCSTR_H
 | 
				
			||||||
#include <incstr.h>
 | 
					#include <incstr.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -236,6 +108,8 @@ public:
 | 
				
			|||||||
  // @cmember Ritorna l'indirizzo del numero reale
 | 
					  // @cmember Ritorna l'indirizzo del numero reale
 | 
				
			||||||
  DEC* ptr() const
 | 
					  DEC* ptr() const
 | 
				
			||||||
  { return (DEC*)&_dec; }
 | 
					  { return (DEC*)&_dec; }
 | 
				
			||||||
 | 
						 // @cmember Ritorna il numero reale convetito in long double
 | 
				
			||||||
 | 
						long double ld() const;
 | 
				
			||||||
  // @cmember Trasforma un reale in stringa
 | 
					  // @cmember Trasforma un reale in stringa
 | 
				
			||||||
  const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
 | 
					  const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
 | 
				
			||||||
  // @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
 | 
					  // @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
 | 
				
			||||||
@ -359,8 +233,6 @@ real cos(const real& a) ;
 | 
				
			|||||||
real tan(const real& a) ;
 | 
					real tan(const real& a) ;
 | 
				
			||||||
real abs(const real& a) ;
 | 
					real abs(const real& a) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class TDistrib : public TObject
 | 
					class TDistrib : public TObject
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @author:(INTERNAL) Villa
 | 
					// @author:(INTERNAL) Villa
 | 
				
			||||||
@ -515,7 +387,7 @@ public:
 | 
				
			|||||||
  { return _valore; }
 | 
					  { return _valore; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // @cmember Controlla se l'importo e' 0 (in qualsiasi sezione, TRUE se 0)
 | 
					  // @cmember Controlla se l'importo e' 0 (in qualsiasi sezione, TRUE se 0)
 | 
				
			||||||
  bool is_zero() const;
 | 
						bool is_zero() const { return _valore.is_zero(); } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // @cmember Assegna l'importo passato
 | 
					  // @cmember Assegna l'importo passato
 | 
				
			||||||
  const TImporto& operator=(const TImporto& i)
 | 
					  const TImporto& operator=(const TImporto& i)
 | 
				
			||||||
 | 
				
			|||||||
@ -1558,8 +1558,12 @@ TCursor* TISAM_recordset::cursor() const
 | 
				
			|||||||
    TParagraph_string msg(use, 64);
 | 
					    TParagraph_string msg(use, 64);
 | 
				
			||||||
    TPerformance_profiler prof(msg.get(0));
 | 
					    TPerformance_profiler prof(msg.get(0));
 | 
				
			||||||
    TISAM_recordset* my = (TISAM_recordset*)this;
 | 
					    TISAM_recordset* my = (TISAM_recordset*)this;
 | 
				
			||||||
 | 
					#ifdef LINUX
 | 
				
			||||||
 | 
							string s(use.get_buffer());
 | 
				
			||||||
 | 
					    istringstream instr(s);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
    istrstream instr(use.get_buffer(), use.len()+1);  //"barata" x aggiungere il carattere finale
 | 
					    istrstream instr(use.get_buffer(), use.len()+1);  //"barata" x aggiungere il carattere finale
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    TCursor_parser parser(instr, my->_column);
 | 
					    TCursor_parser parser(instr, my->_column);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    my->_relation = parser.get_relation();
 | 
					    my->_relation = parser.get_relation();
 | 
				
			||||||
 | 
				
			|||||||
@ -1,2 +1,4 @@
 | 
				
			|||||||
#include <filebar.h>
 | 
					#include <filebar.h>
 | 
				
			||||||
#include <cancelbar.h>
 | 
					#include <cancelbar.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -79,6 +79,9 @@ public:
 | 
				
			|||||||
  virtual const TVariant& get(unsigned int column) const;
 | 
					  virtual const TVariant& get(unsigned int column) const;
 | 
				
			||||||
  virtual TRecnotype new_rec(const char* buf = NULL);
 | 
					  virtual TRecnotype new_rec(const char* buf = NULL);
 | 
				
			||||||
  virtual bool set(unsigned int fld, const TVariant& var);
 | 
					  virtual bool set(unsigned int fld, const TVariant& var);
 | 
				
			||||||
 | 
					  virtual bool set(const char* fld, const TVariant& var) { return TText_recordset::set(fld, var); }
 | 
				
			||||||
 | 
					  virtual bool set(const char* fld, const char * s) { const TVariant var(s); return TText_recordset::set(fld, var); }
 | 
				
			||||||
 | 
					  virtual bool set(const char* fld, const TString & s) { const TVariant var(s); return TText_recordset::set(fld, var); }
 | 
				
			||||||
	virtual void destroy_column(const int ncol = -1, bool pack = true) { _trc.destroy(ncol, pack); }
 | 
						virtual void destroy_column(const int ncol = -1, bool pack = true) { _trc.destroy(ncol, pack); }
 | 
				
			||||||
	virtual void create_column(const char * name, TFieldtypes type = _alfafld);
 | 
						virtual void create_column(const char * name, TFieldtypes type = _alfafld);
 | 
				
			||||||
  virtual bool load_file(const TFilename& n);
 | 
					  virtual bool load_file(const TFilename& n);
 | 
				
			||||||
 | 
				
			|||||||
@ -53,3 +53,6 @@
 | 
				
			|||||||
#define VALIDATE        VA
 | 
					#define VALIDATE        VA
 | 
				
			||||||
#define WARNING         WA
 | 
					#define WARNING         WA
 | 
				
			||||||
#define ZOOM            ZO
 | 
					#define ZOOM            ZO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,3 +8,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#undef min
 | 
					#undef min
 | 
				
			||||||
#undef max
 | 
					#undef max
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
				
			|||||||
@ -209,4 +209,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* @END */
 | 
					// leave a newline at the end
 | 
				
			||||||
 | 
				
			|||||||
@ -518,7 +518,11 @@ void TXmlItem::AsString(TString& str) const
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	  char* buf = str.get_buffer(nSize); 
 | 
						  char* buf = str.get_buffer(nSize); 
 | 
				
			||||||
		memset(buf, 0, nSize);
 | 
							memset(buf, 0, nSize);
 | 
				
			||||||
 | 
					#ifdef WIN32
 | 
				
			||||||
		ostrstream outf(buf, nSize);
 | 
							ostrstream outf(buf, nSize);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							ostringstream outf(buf);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Write(outf, 0);
 | 
							Write(outf, 0);
 | 
				
			||||||
		if (buf[nSize-1] == '\0')
 | 
							if (buf[nSize-1] == '\0')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user