Patch level : 12.0 no patch

Files correlati     : 
Commento            : 
real.h & real.cpp
- Sostituito 3.0 con costante real TRE
prefix.cpp & report.cpp
- Sostituito valori numerici con costante, sistemati casting

git-svn-id: svn://10.65.10.50/branches/R_10_00@23291 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
mtollari 2016-09-16 11:01:13 +00:00
parent c784d91187
commit b4cdd18f6e
4 changed files with 13 additions and 9 deletions

View File

@ -211,7 +211,7 @@ TToken_string & TRecord_info::relation(int logicnum)
const int nPos = kd.FieldSeq[i] % MaxFields; // Posizione del campo i della chiave const int nPos = kd.FieldSeq[i] % MaxFields; // Posizione del campo i della chiave
const RecFieldDes& dfield = rd.Fd[nPos]; // Nome del campo i della chiave const RecFieldDes& dfield = rd.Fd[nPos]; // Nome del campo i della chiave
int nBest = -1; int nBest = -1;
double dBest = 0.0; double dBest = ZERO;
for (int j = 0; i < fd.NFields; j++) for (int j = 0; i < fd.NFields; j++)
{ {

View File

@ -5,6 +5,7 @@
const real ZERO(0.0); const real ZERO(0.0);
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 CENTO(100.0); const real CENTO(100.0);
#ifdef __LONGDOUBLE__ #ifdef __LONGDOUBLE__

View File

@ -14,6 +14,7 @@ class real;
extern const real ZERO; extern const real ZERO;
extern const real UNO; extern const real UNO;
extern const real DUE; extern const real DUE;
extern const real TRE;
extern const real CENTO; extern const real CENTO;
#ifdef __LONGDOUBLE__ #ifdef __LONGDOUBLE__
@ -114,7 +115,7 @@ public:
real& operator /=(long double b); real& operator /=(long double b);
// @cmember Ritorna la negazione di un reale (TRUE se 0, altrimenti FALSE) // @cmember Ritorna la negazione di un reale (TRUE se 0, altrimenti FALSE)
bool operator !() const bool operator !() const
{ return _dec == 0.0; } { return _dec == ZERO; }
// @cmember Ritorna il risultato della differenza tra due reali // @cmember Ritorna il risultato della differenza tra due reali
real operator -() const; real operator -() const;
@ -405,7 +406,7 @@ public:
} }
// @cmember Costruttore // @cmember Costruttore
TDistrib(const real& r,int round=UNDEFINED) : _tot(r), _prog(0.0), _ready(FALSE), _slices(4), _current(0), _decs(round) TDistrib(const real& r,int round=UNDEFINED) : _tot(r), _prog(ZERO), _ready(FALSE), _slices(4), _current(0), _decs(round)
{} {}
// @cmember Distruttore // @cmember Distruttore
virtual ~TDistrib() virtual ~TDistrib()
@ -470,7 +471,7 @@ public:
// @cmember Costruttore // @cmember Costruttore
TGeneric_distrib(const TGeneric_distrib & d) { copy(d); } TGeneric_distrib(const TGeneric_distrib & d) { copy(d); }
// @cmember Costruttore // @cmember Costruttore
TGeneric_distrib(const real& r = ZERO, int round = 0) : _tot(r), _totslices(0.0), _ready(FALSE), _slices(4), _current(0),_decs(round) TGeneric_distrib(const real& r = ZERO, int round = 0) : _tot(r), _totslices(ZERO), _ready(FALSE), _slices(4), _current(0),_decs(round)
{} {}
// @cmember Distruttore // @cmember Distruttore
virtual ~TGeneric_distrib() virtual ~TGeneric_distrib()

View File

@ -328,7 +328,7 @@ static void set_num_attr(TXmlItem& item, const char* attr, long num, short def =
{ {
if (num != def) if (num != def)
{ {
const real n = num / CENTO; const real n = real(num) / CENTO;
item.SetAttr(attr, n.string()); item.SetAttr(attr, n.string());
} }
} }
@ -3276,7 +3276,8 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
if (fld != NULL) if (fld != NULL)
{ {
const TReport_rct& r = fld->get_draw_rect(); const TReport_rct& r = fld->get_draw_rect();
x = r.x / CENTO; y = r.y / CENTO; x = real(r.x) / CENTO;
y = real(r.y) / CENTO;
} }
} }
stack.push(x); stack.push(y); stack.push(x); stack.push(y);
@ -3293,8 +3294,8 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
{ {
TReport_section& sec = section(type, level); TReport_section& sec = section(type, level);
w = sec.width() / CENTO; w = real(sec.width()) / CENTO;
h = sec.height() / CENTO; h = real(sec.height()) / CENTO;
} }
else else
{ {
@ -3303,7 +3304,8 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
if (fld != NULL) if (fld != NULL)
{ {
const TReport_rct& r = fld->get_draw_rect(); const TReport_rct& r = fld->get_draw_rect();
w = r.width() / CENTO; h = r.height() / CENTO; w = real(r.width()) / CENTO;
h = real(r.height()) / CENTO;
} }
} }
stack.push(w); stack.push(h); stack.push(w); stack.push(h);