Aggiustate cazzatelle in isam.cpp
git-svn-id: svn://10.65.10.50/trunk@295 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0dbd85e23c
commit
4777de77d9
@ -18,15 +18,15 @@ bool TConfig_application::create()
|
||||
{
|
||||
arg = argv(i);
|
||||
if (arg == "-c")
|
||||
_which_config = atoi(argv(++i));
|
||||
_which_config = atoi(argv(++i));
|
||||
else
|
||||
if (arg[0] == '-')
|
||||
continue;
|
||||
else
|
||||
{
|
||||
TString* argp = new TString(arg);
|
||||
_paragraphs.add(argp);
|
||||
}
|
||||
if (arg[0] == '-')
|
||||
continue;
|
||||
else
|
||||
{
|
||||
TString* argp = new TString(arg);
|
||||
_paragraphs.add(argp);
|
||||
}
|
||||
}
|
||||
|
||||
user_create();
|
||||
@ -45,83 +45,83 @@ bool TConfig_application::menu(MENU_TAG m)
|
||||
{
|
||||
// funziona da se' fino a 20 voci della menubar
|
||||
if (m >= BAR_ITEM(1) && m <= BAR_ITEM(20))
|
||||
{
|
||||
_last_choice = m;
|
||||
do_config((m - BAR_ITEM(0))/100);
|
||||
}
|
||||
{
|
||||
_last_choice = m;
|
||||
do_config((m - BAR_ITEM(0))/100);
|
||||
}
|
||||
return xvt_test_menu_tag(BAR_ITEM(2));
|
||||
}
|
||||
|
||||
|
||||
void TConfig_application::do_config(int m)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
TString par = name();
|
||||
if (m < _paragraphs.items())
|
||||
par = (TString&)_paragraphs[m];
|
||||
else par.cut(2);
|
||||
|
||||
TConfig cnf(_which_config, par);
|
||||
|
||||
TString maskname(cnf.get("EdMask"));
|
||||
if (!maskname.empty())
|
||||
{
|
||||
TString par = name();
|
||||
if (m < _paragraphs.items())
|
||||
par = (TString&)_paragraphs[m];
|
||||
else par.cut(2);
|
||||
TMask m(maskname);
|
||||
|
||||
// carica campi
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
if (fname != NULL)
|
||||
{
|
||||
TString& oldvl = cnf.get(fname);
|
||||
if (!oldvl.empty())
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run mask
|
||||
if (!preprocess_config(m,cnf))
|
||||
break;
|
||||
|
||||
TConfig cnf(_which_config, par);
|
||||
|
||||
TString maskname(cnf.get("EdMask"));
|
||||
if (!maskname.empty())
|
||||
{
|
||||
TMask m(maskname);
|
||||
|
||||
// carica campi
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
if (fname != NULL)
|
||||
{
|
||||
TString& oldvl = cnf.get(fname);
|
||||
if (!oldvl.empty())
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run mask
|
||||
if (!preprocess_config(m,cnf))
|
||||
break;
|
||||
int k = m.run();
|
||||
if (!postprocess_config(m,cnf))
|
||||
break;
|
||||
|
||||
int k = m.run();
|
||||
if (!postprocess_config(m,cnf))
|
||||
break;
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
// aggiusta campi
|
||||
for (i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.dirty())
|
||||
{
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
if (postprocess_config_changed(par,fname,
|
||||
oldvl,value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
else
|
||||
{
|
||||
warning_box("Nessun parametro da configurare");
|
||||
break;
|
||||
}
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
// aggiusta campi
|
||||
for (i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.dirty())
|
||||
{
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
if (postprocess_config_changed(par,fname,
|
||||
oldvl,value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
else
|
||||
{
|
||||
warning_box("Nessun parametro da configurare");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TConfig_application::preprocess_config (TMask& mask, TConfig& config)
|
||||
@ -135,9 +135,9 @@ bool TConfig_application::postprocess_config (TMask& mask, TConfig& config)
|
||||
}
|
||||
|
||||
bool TConfig_application::postprocess_config_changed(const char* par,
|
||||
const char* var,
|
||||
const char* oldv,
|
||||
const char* newv)
|
||||
const char* var,
|
||||
const char* oldv,
|
||||
const char* newv)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class TConfig_application : public TApplication
|
||||
{
|
||||
|
||||
TArray _paragraphs;
|
||||
int _which_config;
|
||||
int _which_config;
|
||||
MENU_TAG _last_choice;
|
||||
|
||||
virtual bool create();
|
||||
@ -44,7 +44,7 @@ class TConfig_application : public TApplication
|
||||
|
||||
void do_config(int m);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
virtual bool user_create() { return TRUE; }
|
||||
virtual bool user_destroy() { return TRUE; }
|
||||
@ -54,23 +54,23 @@ class TConfig_application : public TApplication
|
||||
virtual bool preprocess_config (TMask& mask, TConfig& config);
|
||||
// questa viene chiamata dopo e blocca tutto se FALSE
|
||||
virtual bool postprocess_config (TMask& mask, TConfig& config);
|
||||
|
||||
|
||||
// questa e' come la change_config di application ma viene usata
|
||||
// dalla maschera principale; le viene passato in piu' il paragrafo
|
||||
// in corso di editing. E' chiamata per ogni parametro modificato
|
||||
// Se ritorna FALSE la modifica non viene accettata; default ritorna
|
||||
// TRUE e non rompe i bal
|
||||
virtual bool postprocess_config_changed (const char* par, const char* var,
|
||||
const char* oldv, const char* newv);
|
||||
const char* oldv, const char* newv);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
TConfig_application(int which_config = CONFIG_GENERAL)
|
||||
: _which_config(which_config)
|
||||
: _which_config(which_config)
|
||||
{}
|
||||
virtual ~TConfig_application()
|
||||
{}
|
||||
{}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define __DEFMASK_H
|
||||
|
||||
/* @M
|
||||
Identificativi predefiniti dei controlli di XVT
|
||||
*/
|
||||
Identificativi predefiniti dei controlli di XVT
|
||||
*/
|
||||
#define DLG_NULL -1
|
||||
#define DLG_OK 1 /* TAG del bottone <Conferma> */
|
||||
#define DLG_CANCEL 2 /* TAG del bottone <Annulla> */
|
||||
@ -30,31 +30,31 @@ Identificativi predefiniti dei controlli di XVT
|
||||
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
||||
|
||||
/* @M
|
||||
Funzioni di libreria per i validate delle maschere
|
||||
Nome descrizione Parametri
|
||||
NUM_EXPR espressione numerica espressione
|
||||
STR_EXPR espressione stringa espressione
|
||||
NOT_EMPTY_FUNC campo non vuoto
|
||||
FIXLEN_FUNC lunghezza fissa lunghezza
|
||||
EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto
|
||||
DATE_CMP_FUNC compara due date operatore,id.campo con l'altra
|
||||
data
|
||||
PI_FUNC controllo part.IVA ????
|
||||
XTPI_FUNC controllo esteso
|
||||
part.IVA ????
|
||||
XTZPI_FUNC controllo esteso
|
||||
part.IVA anche vuota ????
|
||||
CF_FUNC controllo cod.fisc. ????
|
||||
XTCF_FUNC controllo esteso
|
||||
cod.fisc. ????
|
||||
XTZCF_FUNC controllo esteso
|
||||
cod.fisc.anche vuoto ????
|
||||
MTCHECK_FUNC mese corretto per
|
||||
ditta mensile o
|
||||
trimestrale
|
||||
REQIF_FUNC richiesto se immesso
|
||||
un campo della lista n.ro di campi lista di campi...
|
||||
*/
|
||||
Funzioni di libreria per i validate delle maschere
|
||||
Nome descrizione Parametri
|
||||
NUM_EXPR espressione numerica espressione
|
||||
STR_EXPR espressione stringa espressione
|
||||
NOT_EMPTY_FUNC campo non vuoto
|
||||
FIXLEN_FUNC lunghezza fissa lunghezza
|
||||
EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto
|
||||
DATE_CMP_FUNC compara due date operatore,id.campo con l'altra
|
||||
data
|
||||
PI_FUNC controllo part.IVA ????
|
||||
XTPI_FUNC controllo esteso
|
||||
part.IVA ????
|
||||
XTZPI_FUNC controllo esteso
|
||||
part.IVA anche vuota ????
|
||||
CF_FUNC controllo cod.fisc. ????
|
||||
XTCF_FUNC controllo esteso
|
||||
cod.fisc. ????
|
||||
XTZCF_FUNC controllo esteso
|
||||
cod.fisc.anche vuoto ????
|
||||
MTCHECK_FUNC mese corretto per
|
||||
ditta mensile o
|
||||
trimestrale
|
||||
REQIF_FUNC richiesto se immesso
|
||||
un campo della lista n.ro di campi lista di campi...
|
||||
*/
|
||||
|
||||
#define EXPR_FUNC 0 2
|
||||
#define EMPTYCOPY_FUNC 1 1
|
||||
|
@ -17,9 +17,9 @@
|
||||
class TExternal_app : public TObject
|
||||
{
|
||||
const char* _path; // app name (must be allocated by user)
|
||||
int _error; // last error (errno code)
|
||||
int _exitcode; // last exit code
|
||||
int _count; // count of calls
|
||||
int _error; // last error (errno code)
|
||||
int _exitcode; // last exit code
|
||||
int _count; // count of calls
|
||||
|
||||
public:
|
||||
|
||||
|
282
include/expr.h
282
include/expr.h
@ -18,42 +18,42 @@
|
||||
// @T
|
||||
|
||||
enum TCodesym { _invalid, _endsym, _comma, _lpar, _rpar, _variable,
|
||||
_number, _string, _plus, _minus, _multiply, _divide,
|
||||
_chgs, _and, _or, _not, _equal, _match, _noteq, _lt, _gt,
|
||||
_lteq, _gteq, _sqrt, _sqr, _exp10, _exp, _log10, _log,
|
||||
_sin, _cos, _tan, _left, _right, _pow, _min, _max, _mid,
|
||||
_upper } ;
|
||||
_number, _string, _plus, _minus, _multiply, _divide,
|
||||
_chgs, _and, _or, _not, _equal, _match, _noteq, _lt, _gt,
|
||||
_lteq, _gteq, _sqrt, _sqr, _exp10, _exp, _log10, _log,
|
||||
_sin, _cos, _tan, _left, _right, _pow, _min, _max, _mid,
|
||||
_upper } ;
|
||||
|
||||
// @DES I tipi di espressioni definiti
|
||||
// @T
|
||||
enum TTypeexp { _numexpr, _strexpr } ;
|
||||
// @END
|
||||
// @DES I tipi di espressioni definiti
|
||||
// @T
|
||||
enum TTypeexp { _numexpr, _strexpr } ;
|
||||
// @END
|
||||
|
||||
// @C
|
||||
// Classe TValue : public TObject
|
||||
// @END
|
||||
// @C
|
||||
// Classe TValue : public TObject
|
||||
// @END
|
||||
|
||||
class TValue : public TObject
|
||||
class TValue : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
real _r; // Valore real
|
||||
TString _s; // Valore in formato stringa
|
||||
// @DPRIV
|
||||
real _r; // Valore real
|
||||
TString _s; // Valore in formato stringa
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
public:
|
||||
// @FPUB
|
||||
|
||||
TValue& operator =(const TValue& val) { _s = val._s; _r = val._r; return *this;} // Operatore = tra oggetti TValue
|
||||
const real& number() const { return _r;} // Ritorna il valore numerico
|
||||
const char* string() const { return (const char*) _s;} // Ritorna il valore come stringa
|
||||
void set(const real& val) { _r = val; _s = val.string();} // Real
|
||||
void set(const char* val) { _s = val; _r = real(val);} // Stringa
|
||||
TValue& operator =(const TValue& val) { _s = val._s; _r = val._r; return *this;} // Operatore = tra oggetti TValue
|
||||
const real& number() const { return _r;} // Ritorna il valore numerico
|
||||
const char* string() const { return (const char*) _s;} // Ritorna il valore come stringa
|
||||
void set(const real& val) { _r = val; _s = val.string();} // Real
|
||||
void set(const char* val) { _s = val; _r = real(val);} // Stringa
|
||||
|
||||
// @DES Costruttori. Inizializzano TValue con vari oggetti
|
||||
// @FPUB
|
||||
TValue(const real& val) { _r = val; _s = val.string();} // Real
|
||||
TValue(const char* val) { _s = val; _r = real(val);} // Stringa
|
||||
TValue(const TValue& val) { *this = val; } // Altro TValue
|
||||
TValue() { _r = 0.00; _s = ""; } // 0,0 e ""
|
||||
// @DES Costruttori. Inizializzano TValue con vari oggetti
|
||||
// @FPUB
|
||||
TValue(const real& val) { _r = val; _s = val.string();} // Real
|
||||
TValue(const char* val) { _s = val; _r = real(val);} // Stringa
|
||||
TValue(const TValue& val) { *this = val; } // Altro TValue
|
||||
TValue() { _r = 0.00; _s = ""; } // 0,0 e ""
|
||||
};
|
||||
|
||||
|
||||
@ -73,20 +73,20 @@ extern TValue nulltvalue;
|
||||
|
||||
class TCode : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
TCodesym _sym; // Simbolo-istruzione-codice
|
||||
TValue _val; // Valore
|
||||
// @DPRIV
|
||||
TCodesym _sym; // Simbolo-istruzione-codice
|
||||
TValue _val; // Valore
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
TCode& operator =(const TCode& b);
|
||||
void set(TCodesym sym, const TValue& val = nulltvalue) { _sym = sym; _val = val; } // Inizializza simbolo = sym e valore = val
|
||||
TCodesym getsym() const { return _sym;} // Ritorna il simbolo _sym
|
||||
const real& number() const { return _val.number();} // Ritorna il valore _val come real
|
||||
const char* string() const { return _val.string();} // Ritorna il valore _val come stringa
|
||||
public:
|
||||
// @FPUB
|
||||
TCode& operator =(const TCode& b);
|
||||
void set(TCodesym sym, const TValue& val = nulltvalue) { _sym = sym; _val = val; } // Inizializza simbolo = sym e valore = val
|
||||
TCodesym getsym() const { return _sym;} // Ritorna il simbolo _sym
|
||||
const real& number() const { return _val.number();} // Ritorna il valore _val come real
|
||||
const char* string() const { return _val.string();} // Ritorna il valore _val come stringa
|
||||
|
||||
TCode() {set(_invalid);} // Costruttore, inizializza simbolo con "invalid", valore a nullvalue
|
||||
TCode(TCodesym sym, const TValue& val = nulltvalue) { set(sym, val);} // Costruttore, inizializza simbolo con sym e valore con val
|
||||
TCode() {set(_invalid);} // Costruttore, inizializza simbolo con "invalid", valore a nullvalue
|
||||
TCode(TCodesym sym, const TValue& val = nulltvalue) { set(sym, val);} // Costruttore, inizializza simbolo con sym e valore con val
|
||||
};
|
||||
|
||||
// @C
|
||||
@ -98,21 +98,21 @@ class TCode : public TObject
|
||||
|
||||
class TCodearray : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
int _last; // Numero di istruzioni
|
||||
int _ip; // Puntatore all'istruzione corrente (Istruction pointer)
|
||||
TArray _rpn; // Array
|
||||
// @END
|
||||
// @DPRIV
|
||||
int _last; // Numero di istruzioni
|
||||
int _ip; // Puntatore all'istruzione corrente (Istruction pointer)
|
||||
TArray _rpn; // Array
|
||||
// @END
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
void clear(); // Cancella contenuto array
|
||||
void add(TCodesym sym, const TValue& val = nulltvalue); // Aggiunge un'istruzione all'array
|
||||
void begin() { _ip = 0;} // Mette all'inizio il puntatore all'istruzione corrente
|
||||
TCode& step() { return (TCode&) _rpn[end() ? _ip : _ip++];} // Incrementa istruction pointer
|
||||
bool end() const { return ((TCode&) _rpn[_ip]).getsym() == _endsym;} // Ritorna vero se _ip ha raggiunto il simbolo di fine codice
|
||||
void backtrace(int step = 1) { _ip > step ? _ip -= step : begin(); }
|
||||
TCodearray(int size = 50); // Il costruttore crea un array di 10 elementi
|
||||
public:
|
||||
// @FPUB
|
||||
void clear(); // Cancella contenuto array
|
||||
void add(TCodesym sym, const TValue& val = nulltvalue); // Aggiunge un'istruzione all'array
|
||||
void begin() { _ip = 0;} // Mette all'inizio il puntatore all'istruzione corrente
|
||||
TCode& step() { return (TCode&) _rpn[end() ? _ip : _ip++];} // Incrementa istruction pointer
|
||||
bool end() const { return ((TCode&) _rpn[_ip]).getsym() == _endsym;} // Ritorna vero se _ip ha raggiunto il simbolo di fine codice
|
||||
void backtrace(int step = 1) { _ip > step ? _ip -= step : begin(); }
|
||||
TCodearray(int size = 50); // Il costruttore crea un array di 10 elementi
|
||||
};
|
||||
|
||||
// @C
|
||||
@ -121,31 +121,31 @@ class TCodearray : public TObject
|
||||
|
||||
class TVar : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
TString _name; // Nome variabile
|
||||
TValue _val; // Valore
|
||||
// @DPRIV
|
||||
TString _name; // Nome variabile
|
||||
TValue _val; // Valore
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
// @DES Operatore = tra vari oggetti
|
||||
// @FPUB
|
||||
const char* operator =(const char* val) { _val.set(val); return val;}
|
||||
const real& operator =(const real& val) { _val.set(val); return val;}
|
||||
TVar& operator =(const TValue& val) { _val = val; return *this;}
|
||||
TVar& operator =(const TVar& var) { _name = var._name ; _val = var._val; return *this;}
|
||||
void set(const char* name, const TValue& val = nulltvalue) { _name = name ; _val = val;}
|
||||
void setname(const char* name) { _name = name;} // Setta a name il nome della variabile
|
||||
const char* getname() const { return _name;} // Ritorna il nome della variabile
|
||||
// @DES Operatore = tra vari oggetti
|
||||
// @FPUB
|
||||
const char* operator =(const char* val) { _val.set(val); return val;}
|
||||
const real& operator =(const real& val) { _val.set(val); return val;}
|
||||
TVar& operator =(const TValue& val) { _val = val; return *this;}
|
||||
TVar& operator =(const TVar& var) { _name = var._name ; _val = var._val; return *this;}
|
||||
void set(const char* name, const TValue& val = nulltvalue) { _name = name ; _val = val;}
|
||||
void setname(const char* name) { _name = name;} // Setta a name il nome della variabile
|
||||
const char* getname() const { return _name;} // Ritorna il nome della variabile
|
||||
|
||||
operator TValue&() { return _val;} // Ritorna _val (un TValue)
|
||||
const real& number() const { return _val.number();} // Ritorna il valore real della variabile
|
||||
const char* string() const { return _val.string();} // Ritorna il valore stringa della variabile
|
||||
operator TValue&() { return _val;} // Ritorna _val (un TValue)
|
||||
const real& number() const { return _val.number();} // Ritorna il valore real della variabile
|
||||
const char* string() const { return _val.string();} // Ritorna il valore stringa della variabile
|
||||
|
||||
// @DES Costruttori
|
||||
// @FPUB
|
||||
TVar() { _name = ""; _val = nulltvalue;}
|
||||
TVar(const char* name, const TValue& val = nulltvalue) { _name = name; _val = val;}
|
||||
TVar(TVar& v) { _name = v._name; _val = v._val;}
|
||||
// @DES Costruttori
|
||||
// @FPUB
|
||||
TVar() { _name = ""; _val = nulltvalue;}
|
||||
TVar(const char* name, const TValue& val = nulltvalue) { _name = name; _val = val;}
|
||||
TVar(TVar& v) { _name = v._name; _val = v._val;}
|
||||
};
|
||||
|
||||
// @C
|
||||
@ -154,35 +154,35 @@ class TVar : public TObject
|
||||
|
||||
class TVararray : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
int _last; // Numero di variabili
|
||||
TArray _array; // Array
|
||||
// @END
|
||||
// @DPRIV
|
||||
int _last; // Numero di variabili
|
||||
TArray _array; // Array
|
||||
// @END
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
void clear() { _last = 0; } // Cancella contenuto array
|
||||
void add(const TVar& var); // Aggiunge un oggetto TVar
|
||||
void add(const char* name, const TValue& val = nulltvalue); // Aggiunge un nome di variabile e il suo valore
|
||||
const char* varname(int varnum) const { return varnum < _array.items() ? ((TVar&) _array[varnum]).getname() : "";} // Ritorna il nome della variabile di posto varnum
|
||||
public:
|
||||
// @FPUB
|
||||
void clear() { _last = 0; } // Cancella contenuto array
|
||||
void add(const TVar& var); // Aggiunge un oggetto TVar
|
||||
void add(const char* name, const TValue& val = nulltvalue); // Aggiunge un nome di variabile e il suo valore
|
||||
const char* varname(int varnum) const { return varnum < _array.items() ? ((TVar&) _array[varnum]).getname() : "";} // Ritorna il nome della variabile di posto varnum
|
||||
|
||||
// @DES Metodi di inizializzazione
|
||||
// @FPUB
|
||||
void set(const char* varname, const real& val);
|
||||
void set(const char* varname, const char* val);
|
||||
void set(int varnum, const real& val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
|
||||
void set(int varnum, const char* val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
|
||||
// @DES Metodi di inizializzazione
|
||||
// @FPUB
|
||||
void set(const char* varname, const real& val);
|
||||
void set(const char* varname, const char* val);
|
||||
void set(int varnum, const real& val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
|
||||
void set(int varnum, const char* val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
|
||||
|
||||
// @DES Metodi di interrogazione
|
||||
// @FPUB
|
||||
const real& getnum(const char* varname);
|
||||
const real& getnum(int varnum);
|
||||
const char* getstring(const char* varname);
|
||||
const char* getstring(int varnum);
|
||||
// @DES Metodi di interrogazione
|
||||
// @FPUB
|
||||
const real& getnum(const char* varname);
|
||||
const real& getnum(int varnum);
|
||||
const char* getstring(const char* varname);
|
||||
const char* getstring(int varnum);
|
||||
|
||||
int numvar() const { return _last;} // Ritorna il numero di variabili utilizzate
|
||||
int numvar() const { return _last;} // Ritorna il numero di variabili utilizzate
|
||||
|
||||
TVararray(int size = 10);
|
||||
TVararray(int size = 10);
|
||||
};
|
||||
|
||||
// @C
|
||||
@ -191,52 +191,52 @@ class TVararray : public TObject
|
||||
|
||||
class TExpression : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
TCodearray _code; // Array di codice
|
||||
TVararray _var; // Array di variabili
|
||||
TValue _val; // Valore dell'espressione
|
||||
bool _dirty; // Vero se l'espressione e' stata modificata
|
||||
TTypeexp _type; // Tipo dell'espressione
|
||||
TString _original; // stringa originale
|
||||
// @DPRIV
|
||||
TCodearray _code; // Array di codice
|
||||
TVararray _var; // Array di variabili
|
||||
TValue _val; // Valore dell'espressione
|
||||
bool _dirty; // Vero se l'espressione e' stata modificata
|
||||
TTypeexp _type; // Tipo dell'espressione
|
||||
TString _original; // stringa originale
|
||||
|
||||
// @END
|
||||
// @END
|
||||
|
||||
// @FPROT
|
||||
protected:
|
||||
void eval(); // Valuta l'espressione
|
||||
TCodesym __gettoken(bool reduct = FALSE);
|
||||
TCodesym __factor(TCodesym startsym);
|
||||
TCodesym __term(TCodesym startsym);
|
||||
TCodesym __expression(TCodesym startsym);
|
||||
virtual void print_on(ostream& out) const ;
|
||||
bool compile(const char* expression, TTypeexp type); // Compila l'espressione
|
||||
// @FPROT
|
||||
protected:
|
||||
void eval(); // Valuta l'espressione
|
||||
TCodesym __gettoken(bool reduct = FALSE);
|
||||
TCodesym __factor(TCodesym startsym);
|
||||
TCodesym __term(TCodesym startsym);
|
||||
TCodesym __expression(TCodesym startsym);
|
||||
virtual void print_on(ostream& out) const ;
|
||||
bool compile(const char* expression, TTypeexp type); // Compila l'espressione
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
operator const real&(); // Ritorna il valore real dell'espressione
|
||||
operator const char*(); // Ritorna il valore come stringa
|
||||
operator bool(); // Ritorna il valore come booleano
|
||||
// @DES Metodi di interrogazione
|
||||
// @FPUB
|
||||
// Ritorna il nome della variabile di posto varnum
|
||||
const char* varname(int varnum) const { return _var.varname(varnum); }
|
||||
// Ritorna il numero di variabili nell'espressione
|
||||
int numvar() const { return _var.numvar(); }
|
||||
const TTypeexp type() const { return _type; }
|
||||
TCodearray& code() const { return (TCodearray&)_code; }
|
||||
const TVararray& vars() const { return _var; }
|
||||
public:
|
||||
// @FPUB
|
||||
operator const real&(); // Ritorna il valore real dell'espressione
|
||||
operator const char*(); // Ritorna il valore come stringa
|
||||
operator bool(); // Ritorna il valore come booleano
|
||||
// @DES Metodi di interrogazione
|
||||
// @FPUB
|
||||
// Ritorna il nome della variabile di posto varnum
|
||||
const char* varname(int varnum) const { return _var.varname(varnum); }
|
||||
// Ritorna il numero di variabili nell'espressione
|
||||
int numvar() const { return _var.numvar(); }
|
||||
const TTypeexp type() const { return _type; }
|
||||
TCodearray& code() const { return (TCodearray&)_code; }
|
||||
const TVararray& vars() const { return _var; }
|
||||
|
||||
// @DES Metodi di inizializzazione
|
||||
// @FPUB
|
||||
void setvar(const char* varname, const real& val);
|
||||
void setvar(int varnum, const real& val);
|
||||
void setvar(const char* varname, const char* val);
|
||||
void setvar(int varnum, const char* val);
|
||||
void set_type(const TTypeexp type) { _type = type; }
|
||||
// @DES Metodi di inizializzazione
|
||||
// @FPUB
|
||||
void setvar(const char* varname, const real& val);
|
||||
void setvar(int varnum, const real& val);
|
||||
void setvar(const char* varname, const char* val);
|
||||
void setvar(int varnum, const char* val);
|
||||
void set_type(const TTypeexp type) { _type = type; }
|
||||
|
||||
bool set(const char* expression, TTypeexp type = _numexpr);
|
||||
TExpression(const char* expression, TTypeexp type = _numexpr);
|
||||
TExpression(TTypeexp type = _numexpr);
|
||||
bool set(const char* expression, TTypeexp type = _numexpr);
|
||||
TExpression(const char* expression, TTypeexp type = _numexpr);
|
||||
TExpression(TTypeexp type = _numexpr);
|
||||
};
|
||||
|
||||
#endif // __EXPR_H
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __EXTCTYPE_H
|
||||
#define __EXTCTYPE_H
|
||||
|
||||
|
||||
|
||||
#ifndef __STDTTYPES_H
|
||||
#include <stdtypes.h>
|
||||
#endif
|
||||
@ -131,7 +131,7 @@ typedef struct
|
||||
INT16 KeyLen __PACKED__ ;
|
||||
bool DupKeys __PACKED__ ;
|
||||
#ifdef __PACK_1__
|
||||
byte junk;
|
||||
byte junk;
|
||||
#endif
|
||||
INT16 NKNode __PACKED__ ;
|
||||
INT16 MaxKNode __PACKED__ ;
|
||||
@ -146,7 +146,7 @@ typedef struct
|
||||
{
|
||||
byte TPage __PACKED__ ;
|
||||
#ifdef __PACK_1__
|
||||
byte junk;
|
||||
byte junk;
|
||||
#endif
|
||||
INT16 PathNumber __PACKED__ ;
|
||||
INT16 Flags __PACKED__ ;
|
||||
|
@ -798,7 +798,7 @@ long TSystemisamfile::size(TRecnotype eox)
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
||||
bool TSystemisamfile::getlcf(int flev)
|
||||
bool TSystemisamfile::getlcf(long flev)
|
||||
|
||||
{
|
||||
_flds.destroy();
|
||||
|
@ -346,7 +346,7 @@ class TSystemisamfile : public TIsamfile
|
||||
TArray _flds;
|
||||
TArray _exps;
|
||||
|
||||
bool getlcf(int flev);
|
||||
bool getlcf(long flev);
|
||||
void makelc(TRectype& rec);
|
||||
|
||||
public:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: mailbox.cpp,v 1.2 1994-09-19 09:49:41 villa Exp $
|
||||
// $Id: mailbox.cpp,v 1.3 1994-09-28 10:35:45 villa Exp $
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fstream.h>
|
||||
@ -17,44 +17,44 @@
|
||||
#define MAX_TXT_LEN 200
|
||||
|
||||
TMessage::TMessage(const char* to, const char* sub, const char* text,
|
||||
const char* from)
|
||||
const char* from)
|
||||
{
|
||||
_to = to; _subject = sub;
|
||||
_text = text;
|
||||
_from = (from == NULL ? MainApp()->name() : from);
|
||||
_flags = 0x00; _number = -1;
|
||||
_to = to; _subject = sub;
|
||||
_text = text;
|
||||
_from = (from == NULL ? MainApp()->name() : from);
|
||||
_flags = 0x00; _number = -1;
|
||||
}
|
||||
|
||||
void TMessage::send()
|
||||
{
|
||||
TMailbox mail;
|
||||
mail.send(*this);
|
||||
TMailbox mail;
|
||||
mail.send(*this);
|
||||
}
|
||||
|
||||
|
||||
void TMailbox::reread()
|
||||
// reads new messages from mailbox;
|
||||
// create messages, put messages in _msgs array in cronological order
|
||||
// reads new messages from mailbox;
|
||||
// create messages, put messages in _msgs array in cronological order
|
||||
{
|
||||
char buf[MAX_TXT_LEN];
|
||||
char buf[MAX_TXT_LEN];
|
||||
|
||||
ifstream mbox(_path);
|
||||
ifstream mbox(_path);
|
||||
|
||||
// skip read messages
|
||||
mbox.seekg(_lastpos);
|
||||
while (mbox.getline(buf, MAX_TXT_LEN -1) != NULL)
|
||||
{
|
||||
// process new message
|
||||
TMessage* tmnew = new TMessage (NULL, NULL, NULL, buf);
|
||||
// lines are <from> <subject> <body>
|
||||
mbox.getline(buf, MAX_TXT_LEN -1);
|
||||
tmnew->subject(buf);
|
||||
mbox.getline(buf, MAX_TXT_LEN -1);
|
||||
tmnew->body(buf);
|
||||
_msgs.add(tmnew);
|
||||
tmnew->number(_msgs.items());
|
||||
n_new++;
|
||||
}
|
||||
// skip read messages
|
||||
mbox.seekg(_lastpos);
|
||||
while (mbox.getline(buf, MAX_TXT_LEN -1) != NULL)
|
||||
{
|
||||
// process new message
|
||||
TMessage* tmnew = new TMessage (NULL, NULL, NULL, buf);
|
||||
// lines are <from> <subject> <body>
|
||||
mbox.getline(buf, MAX_TXT_LEN -1);
|
||||
tmnew->subject(buf);
|
||||
mbox.getline(buf, MAX_TXT_LEN -1);
|
||||
tmnew->body(buf);
|
||||
_msgs.add(tmnew);
|
||||
tmnew->number(_msgs.items());
|
||||
n_new++;
|
||||
}
|
||||
_lastpos = mbox.tellg();
|
||||
}
|
||||
|
||||
@ -64,13 +64,13 @@ TMessage* TMailbox::next_unread()
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
while(this->get(_cnt)->isread())
|
||||
{
|
||||
_cnt++;
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
_cnt++;
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
}
|
||||
n_new --;
|
||||
return this->get(_lastread = _cnt);
|
||||
return this->get(_lastread = _cnt);
|
||||
}
|
||||
|
||||
TMessage* TMailbox::next_read()
|
||||
@ -79,7 +79,7 @@ TMessage* TMailbox::next_read()
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
if (!(this->get(_cnt)->isread()))
|
||||
n_new--;
|
||||
n_new--;
|
||||
return this->get(_cnt++);
|
||||
}
|
||||
|
||||
@ -96,20 +96,20 @@ TMessage* TMailbox::next(bool read)
|
||||
TMessage* TMailbox::next_s(char* s, bool read)
|
||||
{
|
||||
// next message with matching subject
|
||||
for (;;)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
if (strcmp(this->get(_cnt)->subject(), s) == 0)
|
||||
{
|
||||
if (read) break;
|
||||
else
|
||||
{
|
||||
if (!(this->get(_cnt)->isread())) break;
|
||||
}
|
||||
}
|
||||
_cnt++;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
if (strcmp(this->get(_cnt)->subject(), s) == 0)
|
||||
{
|
||||
if (read) break;
|
||||
else
|
||||
{
|
||||
if (!(this->get(_cnt)->isread())) break;
|
||||
}
|
||||
}
|
||||
_cnt++;
|
||||
}
|
||||
this->get(_cnt)->setread();
|
||||
if (!read) n_new--;
|
||||
return this->get(_cnt);
|
||||
@ -119,85 +119,85 @@ TMessage* TMailbox::next_f(char* f, bool read)
|
||||
{
|
||||
// next message with matching sender
|
||||
for (;;)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
if (strcmp(this->get(_cnt)->from(), f) == 0)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
return NULL;
|
||||
if (strcmp(this->get(_cnt)->from(), f) == 0)
|
||||
{
|
||||
if (read) break;
|
||||
else { if (!(this->get(_cnt)->isread())) break; }
|
||||
}
|
||||
_cnt++;
|
||||
}
|
||||
this->get(_cnt)->setread();
|
||||
if (!read) n_new--;
|
||||
return this->get(_cnt);
|
||||
if (read) break;
|
||||
else { if (!(this->get(_cnt)->isread())) break; }
|
||||
}
|
||||
_cnt++;
|
||||
}
|
||||
this->get(_cnt)->setread();
|
||||
if (!read) n_new--;
|
||||
return this->get(_cnt);
|
||||
}
|
||||
|
||||
void TMailbox::send(TMessage& m)
|
||||
{
|
||||
|
||||
CHECK(m.from() != NULL && m.to() != NULL &&
|
||||
(m.subject() != NULL || m.body() != NULL),
|
||||
"can't send partially empty message");
|
||||
CHECK(m.from() != NULL && m.to() != NULL &&
|
||||
(m.subject() != NULL || m.body() != NULL),
|
||||
"can't send partially empty message");
|
||||
|
||||
// strcpy(to_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
|
||||
TFilename to_path; to_path.tempdir();
|
||||
to_path << "/" << m.to() << ".mbx";
|
||||
// strcpy(to_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
|
||||
TFilename to_path; to_path.tempdir();
|
||||
to_path << "/" << m.to() << ".mbx";
|
||||
|
||||
ofstream fto(to_path, ios::app);
|
||||
CHECK(fto.good(),"send: trouble opening mailbox file");
|
||||
fto << m.from() << '\n'
|
||||
<< m.subject() << '\n'
|
||||
<< m.body() << '\n';
|
||||
fto.close();
|
||||
ofstream fto(to_path, ios::app);
|
||||
CHECK(fto.good(),"send: trouble opening mailbox file");
|
||||
fto << m.from() << '\n'
|
||||
<< m.subject() << '\n'
|
||||
<< m.body() << '\n';
|
||||
fto.close();
|
||||
}
|
||||
|
||||
void TMailbox::sendcmd(int argc, char* argv[], char* to)
|
||||
{
|
||||
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
// parse argv[i]
|
||||
// create new message
|
||||
// send it out
|
||||
}
|
||||
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
// parse argv[i]
|
||||
// create new message
|
||||
// send it out
|
||||
}
|
||||
}
|
||||
|
||||
char* TMailbox::readcmd(char*)
|
||||
{
|
||||
// filters all messages to recipient and adds to to_path
|
||||
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
// TMessage* m;
|
||||
return "NOT YET IMPLEMENTED";
|
||||
// filters all messages to recipient and adds to to_path
|
||||
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
|
||||
// TMessage* m;
|
||||
return "NOT YET IMPLEMENTED";
|
||||
}
|
||||
|
||||
TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY)
|
||||
{
|
||||
if (appname == NULL)
|
||||
if (appname == NULL)
|
||||
appname = MainApp()->name(); // myself; must be global
|
||||
|
||||
_path.tempdir();
|
||||
// strcpy(_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
|
||||
_path << "/" << appname << ".mbx";
|
||||
_path.tempdir();
|
||||
// strcpy(_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
|
||||
_path << "/" << appname << ".mbx";
|
||||
|
||||
_lastread =0; _lastpos = 0l;
|
||||
n_new = 0;
|
||||
this->reread();
|
||||
restart();
|
||||
restart();
|
||||
}
|
||||
|
||||
TMailbox::~TMailbox()
|
||||
{
|
||||
TMessage* m;
|
||||
// scan all remaining messages and erase mailbox
|
||||
reread();
|
||||
reread();
|
||||
if (access(_path,0) == 0)
|
||||
remove(_path);
|
||||
// send unread messages to myself
|
||||
while((m = next()) != NULL)
|
||||
{
|
||||
m->to(MainApp()->name());
|
||||
send(*m);
|
||||
}
|
||||
{
|
||||
m->to(MainApp()->name());
|
||||
send(*m);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: mailbox.h,v 1.2 1994-09-19 09:49:42 villa Exp $
|
||||
// $Id: mailbox.h,v 1.3 1994-09-28 10:35:46 villa Exp $
|
||||
|
||||
/* si', trattasi di -*-c++-*- */
|
||||
// Mailbox.h
|
||||
@ -21,73 +21,73 @@
|
||||
class TMessage : public TObject
|
||||
// basic message
|
||||
{
|
||||
TString _from;
|
||||
TString _to;
|
||||
TString _subject;
|
||||
TString _text;
|
||||
byte _flags;
|
||||
int _number;
|
||||
TString _from;
|
||||
TString _to;
|
||||
TString _subject;
|
||||
TString _text;
|
||||
byte _flags;
|
||||
int _number;
|
||||
|
||||
friend class TMailbox;
|
||||
friend class TMailbox;
|
||||
|
||||
void setread() { _flags |= MSG_READ; }
|
||||
bool isread() { return _flags & MSG_READ; }
|
||||
int number(int n = -1)
|
||||
{ return (n == -1 ? _number : (_number = n)); }
|
||||
void setread() { _flags |= MSG_READ; }
|
||||
bool isread() { return _flags & MSG_READ; }
|
||||
int number(int n = -1)
|
||||
{ return (n == -1 ? _number : (_number = n)); }
|
||||
|
||||
public:
|
||||
|
||||
const char* from(const char* f = NULL) // get-set sender
|
||||
{ return f == NULL ? _from : (_from = f); }
|
||||
const char* to (const char* f = NULL) // get-set recipient
|
||||
{ return f == NULL ? _to : (_to = f); }
|
||||
const char* subject(const char* f = NULL) // get-set subject
|
||||
{ return f == NULL ? _subject : (_subject = f); }
|
||||
const char* from(const char* f = NULL) // get-set sender
|
||||
{ return f == NULL ? _from : (_from = f); }
|
||||
const char* to (const char* f = NULL) // get-set recipient
|
||||
{ return f == NULL ? _to : (_to = f); }
|
||||
const char* subject(const char* f = NULL) // get-set subject
|
||||
{ return f == NULL ? _subject : (_subject = f); }
|
||||
const char* body(const char* f = NULL) // get-set body
|
||||
{ return f == NULL ? _text : (_text = f); }
|
||||
{ return f == NULL ? _text : (_text = f); }
|
||||
|
||||
void send();
|
||||
void send();
|
||||
|
||||
TMessage(const char* to, const char* sub, const char* text,
|
||||
const char* from = NULL);
|
||||
TMessage(const char* to, const char* sub, const char* text,
|
||||
const char* from = NULL);
|
||||
};
|
||||
|
||||
class TMailbox : public TObject
|
||||
{
|
||||
TFilename _path;
|
||||
TFilename _path;
|
||||
TArray _msgs;
|
||||
int _lastread, n_new;
|
||||
long _lastpos;
|
||||
int _cnt;
|
||||
int _cnt;
|
||||
|
||||
protected:
|
||||
|
||||
void reread();
|
||||
TMessage* next_read();
|
||||
TMessage* next_unread();
|
||||
TMessage* next_unread();
|
||||
|
||||
public:
|
||||
|
||||
int check() // return
|
||||
{ reread(); return n_new; } // n. of messages waiting
|
||||
void restart() { _cnt = 0;} // reinitialize read phase
|
||||
int items() // n. of read+unread messages
|
||||
{ return _msgs.items(); } // in mailbox
|
||||
TMessage* next(bool read = FALSE); // get next message; if
|
||||
// TRUE passed, get read mess. too
|
||||
TMessage* next_s(char* s, bool read = FALSE); // next w/ matching subject
|
||||
TMessage* next_f(char* f, bool read = FALSE); // next w/ matching sender
|
||||
void send(TMessage& m); // send a message
|
||||
{ reread(); return n_new; } // n. of messages waiting
|
||||
void restart() { _cnt = 0;} // reinitialize read phase
|
||||
int items() // n. of read+unread messages
|
||||
{ return _msgs.items(); } // in mailbox
|
||||
TMessage* next(bool read = FALSE); // get next message; if
|
||||
// TRUE passed, get read mess. too
|
||||
TMessage* next_s(char* s, bool read = FALSE); // next w/ matching subject
|
||||
TMessage* next_f(char* f, bool read = FALSE); // next w/ matching sender
|
||||
void send(TMessage& m); // send a message
|
||||
void sendcmd(int argc, char* argv[],
|
||||
char* to); // transform commandline args
|
||||
// in mail messages
|
||||
// NOT IMPLEMENTED
|
||||
char* to); // transform commandline args
|
||||
// in mail messages
|
||||
// NOT IMPLEMENTED
|
||||
char* readcmd(char* to = NULL); // transform mailbox in
|
||||
// cmdline parms for calling
|
||||
// non_compliant applications
|
||||
// NOT IMPLEMENTED
|
||||
// cmdline parms for calling
|
||||
// non_compliant applications
|
||||
// NOT IMPLEMENTED
|
||||
TMessage* get(int n) // nth message
|
||||
{ return (TMessage*)_msgs.objptr(n); }
|
||||
{ return (TMessage*)_msgs.objptr(n); }
|
||||
|
||||
TMailbox::TMailbox(const char* appname = NULL);
|
||||
virtual ~TMailbox();
|
||||
|
@ -31,7 +31,7 @@ TObject* TObject::dup() const
|
||||
|
||||
{
|
||||
CHECK(FALSE, "Can't duplicate an Object");
|
||||
return 0L;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
class TObject
|
||||
{
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
virtual ~TObject() {}
|
||||
virtual const char* class_name() const;
|
||||
virtual word class_id() const;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
class TError_Object : public TObject
|
||||
{
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
virtual const char* class_name() const;
|
||||
virtual word class_id() const;
|
||||
virtual bool ok() const;
|
||||
@ -69,8 +69,8 @@ public:
|
||||
class TSortable : public TObject
|
||||
{
|
||||
public:
|
||||
// @FPUB
|
||||
virtual int compare(const TSortable& s) const pure;
|
||||
// @FPUB
|
||||
virtual int compare(const TSortable& s) const pure;
|
||||
virtual const char* class_name() const;
|
||||
virtual word class_id() const;
|
||||
};
|
||||
@ -98,43 +98,43 @@ inline istream& operator >>(istream& in, TObject& obj)
|
||||
inline bool operator ==(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res == 0 || res == UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res == 0 || res == UNDEFINED;
|
||||
}
|
||||
|
||||
inline bool operator >(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res > 0 || res == UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res > 0 || res == UNDEFINED;
|
||||
}
|
||||
|
||||
inline bool operator <(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res < 0 || res == UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res < 0 || res == UNDEFINED;
|
||||
}
|
||||
|
||||
inline bool operator >=(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res >= 0 || res == UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res >= 0 || res == UNDEFINED;
|
||||
}
|
||||
|
||||
inline bool operator <=(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res <= 0 || res == UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res <= 0 || res == UNDEFINED;
|
||||
}
|
||||
|
||||
inline bool operator !=(const TSortable& a, const TSortable& b)
|
||||
|
||||
{
|
||||
int res = a.compare(b);
|
||||
return res != 0 && res != UNDEFINED;
|
||||
int res = a.compare(b);
|
||||
return res != 0 && res != UNDEFINED;
|
||||
}
|
||||
|
||||
#ifdef __OBJECT_CPP
|
||||
|
@ -155,7 +155,7 @@ void TPrinter::_parse_background ()
|
||||
tt.add (y1 - 1);
|
||||
tt.add (txt);
|
||||
break;
|
||||
case 'P': // set pen style
|
||||
case 'P': // set pen style
|
||||
|
||||
case 'B': // set brush
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __RECTYPES_H
|
||||
|
||||
|
||||
#define NOERR 0
|
||||
#define NOERR 0
|
||||
#define FIELDERR -1
|
||||
|
||||
// @T
|
||||
@ -10,27 +10,27 @@ typedef long TRecnotype;
|
||||
// @END
|
||||
|
||||
enum TFilelock { _excllock = 0x100, _autolock = 0x200,
|
||||
_manulock = 0x400};
|
||||
_manulock = 0x400};
|
||||
enum TReclock { _unlock = 0x1000, _nolock = 0x2000, _lock = 0x4000,
|
||||
_testandlock = (int)0x8000} ;
|
||||
enum TRecstates { _valid, _deleted};
|
||||
_testandlock = (int)0x8000} ;
|
||||
enum TRecstates { _valid, _deleted};
|
||||
enum TDirtype { _nordir, _comdir } ;
|
||||
enum TDirop { _nordirop, _sysdirop };
|
||||
enum TFieldtypes { _nullfld, _alfafld, _intfld, _longfld, _realfld,
|
||||
_datefld, _wordfld, _charfld, _boolfld , _intzerofld, _longzerofld} ;
|
||||
enum TIsamop { _isfirst = 0x0, _islast = 0x1, _isnext= 0x2,
|
||||
_isprev = 0x4, _iscurr = 0x8, _isequal = 0x10,
|
||||
_isgreat = 0x20, _isgteq = 0x40, _isnextn = 0x100,
|
||||
_isprevn = 0x200} ;
|
||||
enum TIsamerr { _iseof = 201, _isbof = 202, _isfileovf = 203,
|
||||
_iskeynotfound = 204, _isemptyfile = 205,
|
||||
_isdupkey = 206, _isnocurkey = 207,
|
||||
_iskeyrangeerr = 211, _iskeyerr = 212,
|
||||
_iskeylenerr = 214, _ispatherr = 216, _ispathfull = 217,
|
||||
_isnrecerr = 218, _isfilefull = 219, _isnotopen = 220,
|
||||
_isnotcurr = 221, _isalropen = 222, _isdeadlock = 223,
|
||||
_isreinsert = 224, _islocked = 225} ;
|
||||
typedef long TRecnotype;
|
||||
_datefld, _wordfld, _charfld, _boolfld , _intzerofld, _longzerofld} ;
|
||||
enum TIsamop { _isfirst = 0x0, _islast = 0x1, _isnext= 0x2,
|
||||
_isprev = 0x4, _iscurr = 0x8, _isequal = 0x10,
|
||||
_isgreat = 0x20, _isgteq = 0x40, _isnextn = 0x100,
|
||||
_isprevn = 0x200} ;
|
||||
enum TIsamerr { _iseof = 201, _isbof = 202, _isfileovf = 203,
|
||||
_iskeynotfound = 204, _isemptyfile = 205,
|
||||
_isdupkey = 206, _isnocurkey = 207,
|
||||
_iskeyrangeerr = 211, _iskeyerr = 212,
|
||||
_iskeylenerr = 214, _ispatherr = 216, _ispathfull = 217,
|
||||
_isnrecerr = 218, _isfilefull = 219, _isnotopen = 220,
|
||||
_isnotcurr = 221, _isalropen = 222, _isdeadlock = 223,
|
||||
_isreinsert = 224, _islocked = 225} ;
|
||||
typedef long TRecnotype;
|
||||
|
||||
#endif // __RECTYPES_H
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
HIDDEN const char* strlwr (const char* str)
|
||||
{
|
||||
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
|
||||
*s = '\0';
|
||||
return __tmp_string;
|
||||
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
|
||||
*s = '\0';
|
||||
return __tmp_string;
|
||||
}
|
||||
|
||||
inline bool string_start(char c)
|
||||
@ -18,105 +18,105 @@ inline char match(char c)
|
||||
{ return (c == '{') ? '}' : c; }
|
||||
|
||||
TScanner::TScanner(const char* filename)
|
||||
: ifstream(strlwr(filename)), _token(128), _key(2), _pushed(FALSE), _line(0)
|
||||
: ifstream(strlwr(filename)), _token(128), _key(2), _pushed(FALSE), _line(0)
|
||||
{
|
||||
if (bad()) fatal_box("Impossibile aprire %s", filename);
|
||||
if (bad()) fatal_box("Impossibile aprire %s", filename);
|
||||
}
|
||||
|
||||
const TString& TScanner::pop()
|
||||
{
|
||||
if (!_pushed) do
|
||||
{
|
||||
_token.read_from((ifstream&) *this);
|
||||
if (_token[0] == '/' && _token[1] == '/')
|
||||
{
|
||||
line();
|
||||
_token.cut(0);
|
||||
}
|
||||
} while (_token.empty() && good());
|
||||
if (!_pushed) do
|
||||
{
|
||||
_token.read_from((ifstream&) *this);
|
||||
if (_token[0] == '/' && _token[1] == '/')
|
||||
{
|
||||
line();
|
||||
_token.cut(0);
|
||||
}
|
||||
} while (_token.empty() && good());
|
||||
|
||||
_pushed = FALSE;
|
||||
_token.upper();
|
||||
_key = _token.left(2);
|
||||
_pushed = FALSE;
|
||||
_token.upper();
|
||||
_key = _token.left(2);
|
||||
|
||||
return _token;
|
||||
return _token;
|
||||
}
|
||||
|
||||
TString& TScanner::line(char eol)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!_pushed) _token = "";
|
||||
getline(__tmp_string, sizeof(__tmp_string), eol);
|
||||
_line++;
|
||||
_token << __tmp_string;
|
||||
_token.trim();
|
||||
} while (_token.empty() && good());
|
||||
do
|
||||
{
|
||||
if (!_pushed) _token = "";
|
||||
getline(__tmp_string, sizeof(__tmp_string), eol);
|
||||
_line++;
|
||||
_token << __tmp_string;
|
||||
_token.trim();
|
||||
} while (_token.empty() && good());
|
||||
|
||||
_pushed = FALSE;
|
||||
_pushed = FALSE;
|
||||
|
||||
return _token;
|
||||
return _token;
|
||||
}
|
||||
|
||||
const TString& TScanner::string()
|
||||
{
|
||||
if (!_pushed)
|
||||
{
|
||||
char c;
|
||||
while (isspace(c = get()));
|
||||
if (string_start(c))
|
||||
{
|
||||
getline(__tmp_string, sizeof(__tmp_string), match(c));
|
||||
_token = __tmp_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_box("Stringa non trovata: riga ignorata");
|
||||
_token.cut(0);
|
||||
}
|
||||
}
|
||||
if (!_pushed)
|
||||
{
|
||||
char c;
|
||||
while (isspace(c = get()));
|
||||
if (string_start(c))
|
||||
{
|
||||
getline(__tmp_string, sizeof(__tmp_string), match(c));
|
||||
_token = __tmp_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_box("Stringa non trovata: riga ignorata");
|
||||
_token.cut(0);
|
||||
}
|
||||
}
|
||||
|
||||
_pushed = FALSE;
|
||||
return _token;
|
||||
_pushed = FALSE;
|
||||
return _token;
|
||||
}
|
||||
|
||||
void TScanner::rectangle(RCT& rect)
|
||||
{
|
||||
rect.left = integer();
|
||||
rect.top = integer();
|
||||
rect.right = integer();
|
||||
rect.bottom = integer();
|
||||
rect.left = integer();
|
||||
rect.top = integer();
|
||||
rect.right = integer();
|
||||
rect.bottom = integer();
|
||||
}
|
||||
|
||||
int TScanner::integer()
|
||||
{
|
||||
int i = atoi(pop());
|
||||
if (i == 0 && !isdigit(_token[0])) push();
|
||||
return i;
|
||||
int i = atoi(pop());
|
||||
if (i == 0 && !isdigit(_token[0])) push();
|
||||
return i;
|
||||
}
|
||||
|
||||
double TScanner::number()
|
||||
{
|
||||
double d = atof(pop());
|
||||
if (d == 0.0 && !isdigit(_token[0])) push();
|
||||
return d;
|
||||
double d = atof(pop());
|
||||
if (d == 0.0 && !isdigit(_token[0])) push();
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
const TString& TScanner::operand()
|
||||
{
|
||||
if (!_pushed)
|
||||
{
|
||||
char c;
|
||||
while (isspace(c = get()));
|
||||
putback(c);
|
||||
if (string_start(c))
|
||||
return string();
|
||||
else
|
||||
return pop();
|
||||
}
|
||||
if (!_pushed)
|
||||
{
|
||||
char c;
|
||||
while (isspace(c = get()));
|
||||
putback(c);
|
||||
if (string_start(c))
|
||||
return string();
|
||||
else
|
||||
return pop();
|
||||
}
|
||||
|
||||
_pushed = FALSE;
|
||||
_pushed = FALSE;
|
||||
return _token;
|
||||
}
|
||||
|
||||
@ -130,13 +130,13 @@ void TScanner::push(const char* s)
|
||||
|
||||
bool TScanner::paragraph(const char* name)
|
||||
{
|
||||
TString80 p;
|
||||
p << '[' << name << ']';
|
||||
TString80 p;
|
||||
p << '[' << name << ']';
|
||||
|
||||
seekg(0L);
|
||||
seekg(0L);
|
||||
|
||||
while (line().not_empty())
|
||||
if (token() == p) return TRUE;
|
||||
while (line().not_empty())
|
||||
if (token() == p) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -13,19 +13,19 @@
|
||||
#ifndef XVT_INCL_TYPE
|
||||
// @T
|
||||
typedef struct s_rct { /* mathematical rectangle */
|
||||
short top; /* top coordinate */
|
||||
short left; /* left coordinate */
|
||||
short bottom; /* bottom coordinate */
|
||||
short right; /* right coordinate */
|
||||
short top; /* top coordinate */
|
||||
short left; /* left coordinate */
|
||||
short bottom; /* bottom coordinate */
|
||||
short right; /* right coordinate */
|
||||
} RCT;
|
||||
#endif
|
||||
#else
|
||||
#ifndef XVT_INCL_XVTTYPE
|
||||
typedef struct s_rct { /* mathematical rectangle */
|
||||
short top; /* top coordinate */
|
||||
short left; /* left coordinate */
|
||||
short bottom; /* bottom coordinate */
|
||||
short right; /* right coordinate */
|
||||
short top; /* top coordinate */
|
||||
short left; /* left coordinate */
|
||||
short bottom; /* bottom coordinate */
|
||||
short right; /* right coordinate */
|
||||
} RCT;
|
||||
#endif
|
||||
|
||||
@ -34,13 +34,13 @@ typedef struct s_rct { /* mathematical rectangle */
|
||||
// @C
|
||||
class TScanner : private ifstream
|
||||
{
|
||||
// @DPRIV
|
||||
// @DPRIV
|
||||
TString _token, _key;
|
||||
bool _pushed;
|
||||
word _line;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TScanner(const char* filename);
|
||||
const TString& pop();
|
||||
const TString& key() const { return _key; }
|
||||
@ -52,7 +52,7 @@ public:
|
||||
int integer();
|
||||
double number();
|
||||
const TString& operand();
|
||||
bool paragraph(const char* name);
|
||||
bool paragraph(const char* name);
|
||||
|
||||
bool ok() { return good(); }
|
||||
|
||||
|
164
include/sheet.h
164
include/sheet.h
@ -18,7 +18,7 @@ class TCursor;
|
||||
#endif
|
||||
|
||||
#ifndef __MASKFLD_H
|
||||
class TEdit_field;
|
||||
class TEdit_field;
|
||||
#endif
|
||||
|
||||
// @C
|
||||
@ -27,136 +27,136 @@ class TEdit_field;
|
||||
|
||||
class TSheet : public TScroll_window
|
||||
{
|
||||
// @DPRIV
|
||||
enum { MAX_BUT = 8, MAX_COL = 128 };
|
||||
TArray _page;
|
||||
// @DPRIV
|
||||
enum { MAX_BUT = 8, MAX_COL = 128 };
|
||||
TArray _page;
|
||||
|
||||
byte _columns;
|
||||
byte _size[MAX_COL];
|
||||
long _curr, _last_update;
|
||||
byte _columns;
|
||||
byte _size[MAX_COL];
|
||||
long _curr, _last_update;
|
||||
|
||||
short _visible_rows;
|
||||
short _visible_rows;
|
||||
|
||||
bool _checkable;
|
||||
bool _check_enabled;
|
||||
TBit_array _checked;
|
||||
bool _checkable;
|
||||
bool _check_enabled;
|
||||
TBit_array _checked;
|
||||
|
||||
WINDOW _button[MAX_BUT];
|
||||
KEY _key[MAX_BUT];
|
||||
byte _buttonmask;
|
||||
WINDOW _button[MAX_BUT];
|
||||
KEY _key[MAX_BUT];
|
||||
byte _buttonmask;
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
bool head_on() const { return _columns > 1; }
|
||||
bool buttons_on() const { return *_button != NULL_WIN; }
|
||||
short visible_rows() const { return _visible_rows; }
|
||||
virtual short reserved_rows() const;
|
||||
void build_page(long first = -1);
|
||||
// @FPROT
|
||||
bool head_on() const { return _columns > 1; }
|
||||
bool buttons_on() const { return *_button != NULL_WIN; }
|
||||
short visible_rows() const { return _visible_rows; }
|
||||
virtual short reserved_rows() const;
|
||||
void build_page(long first = -1);
|
||||
|
||||
PNT log2dev(long x, long y) const;
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
virtual bool on_key(KEY);
|
||||
virtual void update();
|
||||
virtual void open();
|
||||
PNT log2dev(long x, long y) const;
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
virtual bool on_key(KEY);
|
||||
virtual void update();
|
||||
virtual void open();
|
||||
|
||||
void set_first(long n);
|
||||
bool is_visible(long n) const { return n >= first() && n < first()+visible_rows(); }
|
||||
void set_first(long n);
|
||||
bool is_visible(long n) const { return n >= first() && n < first()+visible_rows(); }
|
||||
|
||||
int width() const;
|
||||
int row_to_page(long n) const;
|
||||
int row_to_win(long n) const;
|
||||
int width() const;
|
||||
int row_to_page(long n) const;
|
||||
int row_to_win(long n) const;
|
||||
|
||||
long first() const { return origin().y; }
|
||||
bool update_row(long n);
|
||||
void invert_row(long n);
|
||||
long first() const { return origin().y; }
|
||||
bool update_row(long n);
|
||||
void invert_row(long n);
|
||||
|
||||
void set_row(const TToken_string& row, byte n);
|
||||
void set_row(const TToken_string& row, byte n);
|
||||
|
||||
virtual void repos_buttons() const;
|
||||
virtual void repos_buttons() const;
|
||||
|
||||
virtual void page_build(long first, byte num) pure;
|
||||
virtual void page_build(long first, byte num) pure;
|
||||
|
||||
void print();
|
||||
void print();
|
||||
public:
|
||||
// @FPUB
|
||||
TSheet(short x, short y, short dx, short dy,
|
||||
const char* title, const char* head, byte buttons = 0,
|
||||
long first = 0L, WINDOW parent = NULL_WIN);
|
||||
void add_button(short id, const char* caption, KEY key = K_ESC);
|
||||
// @FPUB
|
||||
TSheet(short x, short y, short dx, short dy,
|
||||
const char* title, const char* head, byte buttons = 0,
|
||||
long first = 0L, WINDOW parent = NULL_WIN);
|
||||
void add_button(short id, const char* caption, KEY key = K_ESC);
|
||||
|
||||
virtual long items() const pure;
|
||||
virtual TToken_string& row(long s = -1);
|
||||
virtual long items() const pure;
|
||||
virtual TToken_string& row(long s = -1);
|
||||
|
||||
long selected() const { return _curr; }
|
||||
void select(long n);
|
||||
long selected() const { return _curr; }
|
||||
void select(long n);
|
||||
|
||||
bool checked(long n) const { return _checked[n]; }
|
||||
void check(long n, bool on = TRUE);
|
||||
void uncheck(long n) { check(n, FALSE); }
|
||||
void enable_check(bool yn = TRUE) { _check_enabled = yn; }
|
||||
void disable_check() { enable_check(FALSE); }
|
||||
bool one_checked() const { return _checked.first_one() != -1; }
|
||||
long checked() const { return _checked.ones(); }
|
||||
bool checked(long n) const { return _checked[n]; }
|
||||
void check(long n, bool on = TRUE);
|
||||
void uncheck(long n) { check(n, FALSE); }
|
||||
void enable_check(bool yn = TRUE) { _check_enabled = yn; }
|
||||
void disable_check() { enable_check(FALSE); }
|
||||
bool one_checked() const { return _checked.first_one() != -1; }
|
||||
long checked() const { return _checked.ones(); }
|
||||
};
|
||||
|
||||
class TArray_sheet : public TSheet
|
||||
{
|
||||
TArray _data;
|
||||
TArray _data;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void page_build(long first, byte num);
|
||||
virtual void page_build(long first, byte num);
|
||||
|
||||
TArray& data() const { return (TArray&)_data; }
|
||||
TToken_string& data(long n) const { return (TToken_string&)_data[(int)n]; }
|
||||
TArray& data() const { return (TArray&)_data; }
|
||||
TToken_string& data(long n) const { return (TToken_string&)_data[(int)n]; }
|
||||
|
||||
public:
|
||||
TArray_sheet(short x, short y, short dx, short dy, const char* caption,
|
||||
const char* head, byte buttons = 0, WINDOW parent = NULL_WIN);
|
||||
virtual long items() const { return _data.items(); }
|
||||
long add(const TToken_string& s);
|
||||
TArray_sheet(short x, short y, short dx, short dy, const char* caption,
|
||||
const char* head, byte buttons = 0, WINDOW parent = NULL_WIN);
|
||||
virtual long items() const { return _data.items(); }
|
||||
long add(const TToken_string& s);
|
||||
long insert(const TToken_string& s, long n);
|
||||
virtual TToken_string& row(long s = -1) { return (s < 0) ? data(selected()) : data(s); }
|
||||
bool destroy(int i = -1) { uncheck(-1); return _data.destroy(i, TRUE); }
|
||||
virtual TToken_string& row(long s = -1) { return (s < 0) ? data(selected()) : data(s); }
|
||||
bool destroy(int i = -1) { uncheck(-1); return _data.destroy(i, TRUE); }
|
||||
};
|
||||
|
||||
|
||||
class TCursor_sheet : public TSheet
|
||||
{
|
||||
TArray _fields; // Array of TRecfield
|
||||
long _records;
|
||||
TArray _fields; // Array of TRecfield
|
||||
long _records;
|
||||
|
||||
protected:
|
||||
TCursor* _cursor;
|
||||
TCursor* _cursor;
|
||||
|
||||
virtual void page_build(long first, byte rows);
|
||||
virtual void page_build(long first, byte rows);
|
||||
|
||||
public:
|
||||
TCursor_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons = 0);
|
||||
virtual ~TCursor_sheet() {}
|
||||
virtual long items() const { return _records; }
|
||||
virtual KEY run();
|
||||
TCursor_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons = 0);
|
||||
virtual ~TCursor_sheet() {}
|
||||
virtual long items() const { return _records; }
|
||||
virtual KEY run();
|
||||
};
|
||||
|
||||
|
||||
class TBrowse_sheet : public TCursor_sheet
|
||||
{
|
||||
TEdit_field* const _field;
|
||||
TEdit_field* const _field;
|
||||
|
||||
protected:
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
virtual short reserved_rows() const;
|
||||
virtual void repos_buttons() const;
|
||||
virtual bool on_key(KEY k);
|
||||
TEdit_field& field() { return *_field; }
|
||||
virtual short reserved_rows() const;
|
||||
virtual void repos_buttons() const;
|
||||
virtual bool on_key(KEY k);
|
||||
TEdit_field& field() { return *_field; }
|
||||
|
||||
public:
|
||||
TBrowse_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons,
|
||||
TEdit_field* f, TToken_string* siblings = NULL);
|
||||
virtual ~TBrowse_sheet() {}
|
||||
virtual KEY run();
|
||||
TBrowse_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons,
|
||||
TEdit_field* f, TToken_string* siblings = NULL);
|
||||
virtual ~TBrowse_sheet() {}
|
||||
virtual KEY run();
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
enum direction {up, down, updown};
|
||||
enum style {normal = 0, bold = FS_BOLD, italic = FS_ITALIC, underlined = 0x0004,
|
||||
overstrike = 0x0008, smallcaps = 0x0010};
|
||||
|
||||
|
||||
class TTextfile: public TObject
|
||||
{
|
||||
enum {DEFAULT_PAGESIZE = 128};
|
||||
@ -50,11 +50,11 @@ class TTextfile: public TObject
|
||||
|
||||
void _read_page(long line);
|
||||
bool _in_page(long l)
|
||||
{ return l >= _page_start && l < _page_end; }
|
||||
// void _parse_style(long j);
|
||||
{ return l >= _page_start && l < _page_end; }
|
||||
// void _parse_style(long j);
|
||||
style _trans_style(char c);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
long lines() { return _lines; }
|
||||
bool changed() { return _dirty; }
|
||||
@ -62,7 +62,7 @@ class TTextfile: public TObject
|
||||
// line() ritorna la stringa di caratteri senza formattazione
|
||||
const char* line(long row, long column = 0);
|
||||
bool append(const char* l);
|
||||
|
||||
|
||||
// chide tutti i files per poter copiare o eseguire operazioni
|
||||
// dopo close() non si puo' piu' fare nulla
|
||||
void close();
|
||||
@ -70,7 +70,7 @@ class TTextfile: public TObject
|
||||
// chiude l'aggiunta di nuove linee
|
||||
void freeze() { _accept = FALSE; }
|
||||
bool frozen() { return !_accept; }
|
||||
|
||||
|
||||
// per leggere il testo formattato, si fa prima read_line, poi
|
||||
// si prende un pezzo per volta
|
||||
// style() ritorna lo stile (vedi enum) del piece() corrente
|
||||
@ -110,7 +110,7 @@ class TTextfile: public TObject
|
||||
TArray& hotspots() { return _spots; }
|
||||
|
||||
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
|
||||
direction preferred = updown);
|
||||
direction preferred = updown);
|
||||
virtual ~TTextfile();
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
#endif
|
||||
|
||||
/* @M
|
||||
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
|
||||
*/
|
||||
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
|
||||
*/
|
||||
#define TASK_MENUBAR 10000
|
||||
#define ALT_MENUBAR 11000
|
||||
|
||||
|
@ -20,51 +20,51 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
void xvt_draw_rect(WINDOW w, const RCT& r, COLOR c1, COLOR c2, short depth = 1);
|
||||
|
||||
WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags,
|
||||
EVENT_HANDLER eh,
|
||||
long app_data);
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags,
|
||||
EVENT_HANDLER eh,
|
||||
long app_data);
|
||||
|
||||
WINDOW xvt_create_control(WIN_TYPE wt,
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
WINDOW xvt_create_control(WIN_TYPE wt,
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
|
||||
WINDOW xvt_create_statbar();
|
||||
void xvt_statbar_set(const char* text);
|
||||
void xvt_statbar_refresh();
|
||||
WINDOW xvt_create_statbar();
|
||||
void xvt_statbar_set(const char* text);
|
||||
void xvt_statbar_refresh();
|
||||
|
||||
void beep();
|
||||
void do_events();
|
||||
void customize_controls(bool on);
|
||||
KEY e_char_to_key(const EVENT* ep);
|
||||
void dispatch_e_char(WINDOW win, KEY key);
|
||||
void dispatch_e_scroll(WINDOW win, KEY key);
|
||||
void beep();
|
||||
void do_events();
|
||||
void customize_controls(bool on);
|
||||
KEY e_char_to_key(const EVENT* ep);
|
||||
void dispatch_e_char(WINDOW win, KEY key);
|
||||
void dispatch_e_scroll(WINDOW win, KEY key);
|
||||
|
||||
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
|
||||
void xvt_set_front_control(WINDOW win);
|
||||
const char* xvt_get_title(WINDOW win);
|
||||
void xvt_enable_control(WINDOW win, bool on);
|
||||
void xvt_check_box(WINDOW win, bool on);
|
||||
bool xvt_get_checked_state(WINDOW win);
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
|
||||
void xvt_set_front_control(WINDOW win);
|
||||
const char* xvt_get_title(WINDOW win);
|
||||
void xvt_enable_control(WINDOW win, bool on);
|
||||
void xvt_check_box(WINDOW win, bool on);
|
||||
bool xvt_get_checked_state(WINDOW win);
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
|
||||
COLOR trans_color(char c);
|
||||
PAT_STYLE trans_brush(char p);
|
||||
PEN_STYLE trans_pen (char p);
|
||||
COLOR trans_color(char c);
|
||||
PAT_STYLE trans_brush(char p);
|
||||
PEN_STYLE trans_pen (char p);
|
||||
|
||||
|
||||
/* @END */
|
||||
/* @END */
|
||||
|
||||
extern short CHARX, CHARY, COLX, ROWY;
|
||||
extern short CHARX, CHARY, COLX, ROWY;
|
||||
|
||||
/* @END */
|
||||
/* @END */
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user