From e78b03e4da82ee6c379ca81f851e97c718596681 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 5 Mar 2004 08:50:18 +0000 Subject: [PATCH] Patch level : 2.1 nopatch Files correlati : agalib.lib Ricompilazione Demo : [ ] Commento : csort.* Tolte tutte dipendenze dalle librerie e sostituite con chiamate a xvt currency.cpp Tolti vecchi riferimenti a LIT e sostituiti con _firm_val maskfld.h Indentazioni e commenti varrec.* Indentazioni e commenti xml.* Aggiunta gestione attributi booleani (oltre alle stringhe) git-svn-id: svn://10.65.10.50/trunk@11807 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/csort.c | 15 +++++++++------ include/csort.h | 8 ++++---- include/currency.cpp | 18 ++++++++++++++---- include/maskfld.h | 13 ++++++------- include/varrec.cpp | 16 ++++------------ include/varrec.h | 4 ++-- include/xml.cpp | 33 +++++++++++++++------------------ include/xml.h | 3 +++ 8 files changed, 57 insertions(+), 53 deletions(-) diff --git a/include/csort.c b/include/csort.c index c0ec12063..fb38ab2c1 100755 --- a/include/csort.c +++ b/include/csort.c @@ -1,4 +1,5 @@ -#include +#include "xvt.h" + #include #include @@ -59,8 +60,8 @@ void dummy(void); @(FD) */ -int init_sort(prms) - struct s_prm *prms; /* struttura di descrizione del sort */ +/* struttura di descrizione del sort */ +int init_sort(struct s_prm *prms) { sp = prms; if ((bf = appr_mem(&bspace)) != NULL) { @@ -394,7 +395,7 @@ static FILE *wopen(char* name) /* nome del file temporaneo */ fp = fopen(name, "wb+"); if (fp == NULL) - fatal_box("Can't open SORT file"); + xvt_dm_post_fatal_exit("Can't open SORT file"); return fp; } @@ -541,14 +542,16 @@ static FILE *wopen(char* name) /* nome del file temporaneo */ void sort_stats() { - message_box( + char msg[256]; + sprintf(msg, "Record length = %d\n" "%u records sorted\n" "%u sequences\n" "%u bytes of sort buffer\n" "%u records per buffer", sp->rc_len, totrcd, no_seq, bspace, nrcds - ); + ); + xvt_dm_post_note(msg); } /* diff --git a/include/csort.h b/include/csort.h index 0a3cbb6d1..85feb6e9e 100755 --- a/include/csort.h +++ b/include/csort.h @@ -25,10 +25,10 @@ extern "C" { #endif /* __cplusplus */ /*----------------------- FUNZIONI VISIBILI PRIMA PARTE ---------------------*/ - int init_sort(struct s_prm *); /* Initialize the sort */ - void sort(char *); /* Pass records to Sort */ - char *sort_op(void); /* Retrieve sorted records */ - void sort_stats(void); /* Display sort statistics */ + int init_sort(struct s_prm *); /* Initialize the sort */ + void sort(char *); /* Pass records to Sort */ + char *sort_op(void); /* Retrieve sorted records */ + void sort_stats(void); /* Display sort statistics */ /*----------------------- FUNZIONI VISIBILI SECONDA PARTE -------------------*/ diff --git a/include/currency.cpp b/include/currency.cpp index 0e48d9a25..ce19299f5 100755 --- a/include/currency.cpp +++ b/include/currency.cpp @@ -1,7 +1,11 @@ #include +#include #include #include +#include +#include + /////////////////////////////////////////////////////////// // DowJones /////////////////////////////////////////////////////////// @@ -68,15 +72,21 @@ TObject* TDowJones::rec2obj(const TRectype& rec) const { TExchangeData* data = new TExchangeData; - const TString16 codval = rec.get("CODTAB"); + const TString4 codval = rec.get("CODTAB"); data->_chg = rec.get_real("S4"); if (data->_chg <= ZERO) { data->_chg = rec.get_real("R10"); if (data->_chg <= ZERO) - { - if (codval.not_empty() && codval != "LIT") - NFCHECK("Codice valuta senza cambio: '%s'", (const char*)codval); + { +#ifdef DBG + if (codval.not_empty() && codval != _firm_val) + { + TString msg = TR("Codice valuta senza cambio"); + msg << ": " << codval; + statbar_set_title(TASK_WIN, msg); + } +#endif data->_chg = 1.0; } } diff --git a/include/maskfld.h b/include/maskfld.h index c59c3997f..2c53ca1ac 100755 --- a/include/maskfld.h +++ b/include/maskfld.h @@ -1599,12 +1599,12 @@ class TTree; class TTree_field : public TWindowed_field { protected: // TObject - word class_id() const; - bool is_kind_of(word cid) const; + virtual word class_id() const; + virtual bool is_kind_of(word cid) const; protected: // TWindowed_field - virtual TField_window* create_window(int x, int y, int dx, int dy, - WINDOW parent); + virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent); + public: TTree* tree() const; void set_tree(TTree* t); @@ -1617,7 +1617,6 @@ public: void set_header(const char* head); void set_row_height(int rh); - TTree_field(TMask* m) : TWindowed_field(m) { } virtual ~TTree_field() { } }; @@ -1627,8 +1626,8 @@ class TGolem_client_field : public TWindowed_field TGolem_field* _driver; protected: // TObject - word class_id() const; - bool is_kind_of(word cid) const; + virtual word class_id() const; + virtual bool is_kind_of(word cid) const; protected: // TWindowed_field virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent); diff --git a/include/varrec.cpp b/include/varrec.cpp index e30d939f8..c09215dd7 100755 --- a/include/varrec.cpp +++ b/include/varrec.cpp @@ -1,19 +1,11 @@ #include #include -// HIDDEN bool rec_has_memo(const RecDes* rd) -//{ -// for( int i = rd->NFields - 1; i >= 0; i--) -// if (rd->Fd[i].TypeF == _memofld) -// return TRUE; -// return FALSE; -//} - TVariable_field::TVariable_field( - const char * name, // - const char * expr, // - TTypeexp type, - int len) // + const char * name, + const char * expr, + TTypeexp type, + int len) : _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL), _put_string(NULL), _in_get(FALSE),_lenght(len) { diff --git a/include/varrec.h b/include/varrec.h index d2ee702de..5a53c21a2 100755 --- a/include/varrec.h +++ b/include/varrec.h @@ -24,11 +24,11 @@ typedef const char * (*VIRTUAL_GET_FUNCTION)(TVariable_rectype & r); // @base public | TObject class TVariable_field : public TObject -// @author:(INTERNAL) Sandro +// @author:(INTERNAL) Alessandro { TVariable_rectype * _rec; - TString _name; + TString80 _name; TExpression * _e; TString _value; TToken_string * _put_string; diff --git a/include/xml.cpp b/include/xml.cpp index a97fdbd9d..e500ac045 100755 --- a/include/xml.cpp +++ b/include/xml.cpp @@ -106,23 +106,9 @@ public: void TXmlAttr::Write(ostream& outf) const { - if (empty()) - { - outf << '"' << '"'; - } - else - { - if (real::is_real(*this)) - { - print_on(outf); - } - else - { - outf << '"'; - print_on(outf); - outf << '"'; - } - } + outf << '"'; + print_on(outf); + outf << '"'; } /////////////////////////////////////////////////////////// @@ -134,7 +120,8 @@ TXmlItem& TXmlItem::SetAttr(const char* strAttr, const char* strVal) if (m_Attributes == NULL) m_Attributes = new TAssoc_array; m_Attributes->remove(strAttr); - m_Attributes->add(strAttr, new TXmlAttr(strVal)); + if (strVal && *strVal) + m_Attributes->add(strAttr, new TXmlAttr(strVal)); return *this; } @@ -149,6 +136,16 @@ const TString& TXmlItem::GetAttr(const char* strAttr) const return EMPTY_STRING; } +TXmlItem& TXmlItem::SetAttr(const char* strAttr, bool b) +{ + return SetAttr(strAttr, b ? "1" : ""); +} + +bool TXmlItem::GetBoolAttr(const char* strAttr) const +{ + return !GetAttr(strAttr).blank(); +} + int TXmlItem::GetChildren() const { int n = 0; diff --git a/include/xml.h b/include/xml.h index 6e8b78948..f86801cf9 100755 --- a/include/xml.h +++ b/include/xml.h @@ -48,6 +48,9 @@ public: TXmlItem& SetAttr(const char* strAttr, const char* strVal); const TString& GetAttr(const char* strAttr) const; + TXmlItem& SetAttr(const char* strAttr, bool yes); + bool GetBoolAttr(const char* strAttr) const; + TXmlItem& AddChild(const char* strTag); TXmlItem& AddSoapString(const char* name, const char* value, bool typized = false); TXmlItem& AddSoapInt(const char* name, int value, bool typized = false);