From 3c2aaeeaea91959a15ac8740943a52442497481b Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 12 Mar 2004 15:08:44 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://10.65.10.50/trunk@11842 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/confapp.cpp | 2 +- include/config.h | 2 +- include/controls.cpp | 32 +++++++++++++++++++++----------- include/csort.c | 2 +- include/currency.cpp | 11 ++++++----- include/date.cpp | 8 ++++---- include/diction.cpp | 16 +++++++++++++++- include/dongle.cpp | 6 +++--- include/expr.cpp | 21 +++++++++++++-------- include/expr.h | 2 +- include/files.cpp | 14 ++++++++++---- include/filetext.h | 6 +++--- include/fraction.cpp | 13 +++++++++---- include/fraction.h | 2 +- 14 files changed, 89 insertions(+), 48 deletions(-) diff --git a/include/confapp.cpp b/include/confapp.cpp index 30dd921d1..6704ece76 100755 --- a/include/confapp.cpp +++ b/include/confapp.cpp @@ -245,4 +245,4 @@ TConfig_application::TConfig_application(int which_config) TConfig_application::~TConfig_application() { -} \ No newline at end of file +} diff --git a/include/config.h b/include/config.h index e1ac11932..f15b5433e 100755 --- a/include/config.h +++ b/include/config.h @@ -5,7 +5,7 @@ #include #endif -class ofstream; +// class ofstream; class TConfig; // questo sara' il principale, per ora non c'e' diff --git a/include/controls.cpp b/include/controls.cpp index e90656751..7a794469b 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -152,7 +152,11 @@ XVT_FNTID xvt_default_font(bool bold) TConfig font(CONFIG_GUI, "Font"); TString font_ser_desc(font.get("FontDesc")); if (font_ser_desc.empty()) +#ifdef WIN32 font_ser_desc = "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier"; +#else + font_ser_desc = "01\\Courier\\0\\10\\WIN01/12/0/0/0/400/0/0/0/0/1/2/1/49/Courier"; +#endif xvt_font_deserialize(DEF_FONT, (char *)(const char *) font_ser_desc); xvt_font_map_using_default(DEF_FONT); CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font"); @@ -206,6 +210,7 @@ XVT_FNTID xvt_load_default_font() X_FU_MULTIPLE = Y_FU_MULTIPLE = 0; XVT_FNTID font = xvt_default_font(FALSE); + xi_set_font_id(font); xi_init_sysvals(); // Ricalcola i FU units statbar_set_fontid(TASK_WIN, font); @@ -431,7 +436,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, const WIN_TYPE wt = (dx == 0) ? W_PLAIN : W_DOC; long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR; - WINDOW win = xvt_win_create(wt, &r, (char*)caption, NULL, parent, wsf, + WINDOW win = xvt_win_create(wt, &r, (char*)caption, 0L, parent, wsf, EM_ALL, (EVENT_HANDLER)xi_event, (long)msk); CHECK(win, "Can't create an XVT window for an interface"); xvt_set_font(win, NULL, 0, 0); @@ -894,7 +899,10 @@ const char* TControl::parse_caption(const char* cap, bool& bold, COLOR& color) c { bold = FALSE; color = NORMAL_COLOR; - for (const char* t = cap; *t == '@' || *t == '$'; t++) + + const char* t; + + for (t = cap; *t == '@' || *t == '$'; t++) { if (*t == '@') { @@ -1732,7 +1740,9 @@ byte TRadiobutton_control::get_checked() const { int children; XI_OBJ** child = xi_get_member_list(_obj, &children); - for (int c = children-1; c > 0; c--) + int c; + + for (c = children-1; c > 0; c--) if (xi_is_checked(child[c])) break; return (byte)c; } @@ -1780,7 +1790,9 @@ void TRadiobutton_control::set_focus() const { int children; XI_OBJ** child = xi_get_member_list(_obj, &children); - for (int c = children-1; c > 0; c--) + int c; + + for (c = children-1; c > 0; c--) if (xi_is_checked(child[c])) break; xi_set_focus(child[c]); } @@ -1909,8 +1921,6 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev) if (!ddl->is_open()) return; - const char* row = NULL; - switch(xiev->type) { case XIE_GET_FIRST: @@ -2169,9 +2179,9 @@ void TDropDownList::create() } } - XI_OBJ_DEF* coldef = xi_add_column_def(lstdef, _obj->cid+2000, - XI_ATR_VISIBLE|XI_ATR_ENABLED|XI_ATR_READONLY|XI_ATR_SELECTABLE, - 0, len, 80, ""); + xi_add_column_def(lstdef, _obj->cid+2000, + XI_ATR_VISIBLE|XI_ATR_ENABLED|XI_ATR_READONLY|XI_ATR_SELECTABLE, + 0, len, 80, ""); RCT l; xi_get_def_rect(lstdef, (XinRect *) &l); PNT p; p.h = r.left; @@ -2294,8 +2304,8 @@ void TDropDownList::on_mouse_down(const PNT& pt) } TDropDownList::TDropDownList(XI_OBJ* o, const char* codes, const char* values) - : _obj(o), _codes(codes), _values(values), - _open(FALSE), _xi_lst(NULL), _selected(0) + : _obj(o), _xi_lst(NULL), _codes(codes), + _values(values), _selected(0), _open(FALSE) { if (o->type == XIT_CELL) { diff --git a/include/csort.c b/include/csort.c index fb38ab2c1..7442b7f71 100755 --- a/include/csort.c +++ b/include/csort.c @@ -545,7 +545,7 @@ static FILE *wopen(char* name) /* nome del file temporaneo */ char msg[256]; sprintf(msg, "Record length = %d\n" - "%u records sorted\n" + "%lu records sorted\n" "%u sequences\n" "%u bytes of sort buffer\n" "%u records per buffer", diff --git a/include/currency.cpp b/include/currency.cpp index ce19299f5..409da7a67 100755 --- a/include/currency.cpp +++ b/include/currency.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -163,11 +164,11 @@ const char* TDowJones::expand_value(const char* val) { if (*val == '_') { - if (stricmp(val, "_FIRM") == 0) + if (xvt_str_compare_ignoring_case(val, "_FIRM") == 0) val = get_firm_val(); else - if (stricmp(val, "_EURO") == 0) + if (xvt_str_compare_ignoring_case(val, "_EURO") == 0) val = get_euro_val(); else - if (stricmp(val, "_BASE") == 0) + if (xvt_str_compare_ignoring_case(val, "_BASE") == 0) val = get_base_val(); } else @@ -633,7 +634,7 @@ TCurrency::TCurrency(const real& num, const char* val, const real& exchg, exchan } TCurrency::TCurrency(const real& num, const TExchange& exc, bool price) - : _num(num), _chg(exc), _price(price) + : _chg(exc), _num(num), _price(price) { _num.round(decimals()); } @@ -645,7 +646,7 @@ bool same_values(const char * valuea, const char * valueb) if (valueb == NULL || *valueb == '\0') valueb = TCurrency::get_firm_val(); - return stricmp(valuea, valueb) == 0; + return xvt_str_compare_ignoring_case(valuea, valueb) == 0; } diff --git a/include/date.cpp b/include/date.cpp index 15e94be8e..2c9d0abd9 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -77,10 +77,10 @@ TDate::TDate(const char* s) if (len != 8 && len != 10) return; - int d = 0, m = 0, y = 0; + int d = 0, m = 0, y = 0, i; if (len == 8) { - for (int i = 0; i < 8; i++) + for (i = 0; i < 8; i++) if (!isdigit(s[i])) break; if (i == 8) { @@ -437,10 +437,10 @@ bool TDate::isdate(const char* s) if (len != 8 && len != 10) return FALSE; - int d = 0, m = 0, y = 0; + int d = 0, m = 0, y = 0, i; if (len == 8) { - for (int i = 0; i < 8; i++) + for (i = 0; i < 8; i++) if (!isdigit(s[i])) break; if (i == 8) { diff --git a/include/diction.cpp b/include/diction.cpp index 85c44534e..016383014 100755 --- a/include/diction.cpp +++ b/include/diction.cpp @@ -152,8 +152,12 @@ const char* dictionary_translate(const char* sentence) const char* dictionary_translate_macro(const char* sentence) { +#ifdef WIN32 if (memcmp(sentence, TO_BE_TRANSLATED, 4) == 0) sentence = dictionary_translate(sentence+4); +#else + sentence = dictionary_translate(sentence); +#endif return sentence; } @@ -223,7 +227,9 @@ const char* dictionary_translate_prompt(const char* prompt, int maxlen) if (str.len() > limit) { // Abbrevio all'ultima consonante - for (int i = limit-2; i > 0; i--) + int i; + + for (i = limit-2; i > 0; i--) { if (strchr("aeiou", str[i]) == NULL) { @@ -248,8 +254,12 @@ const char* dictionary_translate_prompt(const char* prompt, int maxlen) const char* dictionary_translate_macro_prompt(const char* sentence, int maxlen) { +#ifdef WIN32 if (memcmp(sentence, TO_BE_TRANSLATED, 4) == 0) sentence = dictionary_translate_prompt(sentence+4, maxlen); +#else + sentence = dictionary_translate_prompt(sentence, maxlen); +#endif return sentence; } @@ -279,8 +289,12 @@ const char* dictionary_translate_header(const char* head) const char* dictionary_translate_macro_header(const char* head) { +#ifdef WIN32 if (memcmp(head, TO_BE_TRANSLATED, 4) == 0) head = dictionary_translate_header(head+4); +#else + head = dictionary_translate_header(head); +#endif return head; } diff --git a/include/dongle.cpp b/include/dongle.cpp index cadadbf15..331f44865 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -137,7 +137,7 @@ inline void reset_bit(word& w, byte b) TDongle::TDongle() : _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF), - _dirty(FALSE), _max_users(1), _year_assist(1997) + _max_users(1), _year_assist(1997), _dirty(FALSE) { memset(_eprom, 0, sizeof(_eprom)); memset(_assist, 0, sizeof(_assist)); @@ -449,7 +449,7 @@ bool TDongle::network_login(bool test_all_keys) const char* server = ini.get("Dongle"); const char* guest = "******"; const TString16 appname = main_app().name(); - const char* utente = (!main_app().is_running() && appname == "ba0100") ? guest : user(); + const char* utente = (!main_app().is_running() && appname == "ba0100") ? guest : (const char *) user(); const bool ok = rpc_UserLogin(server, utente, "******", appname); if (ok) @@ -848,4 +848,4 @@ bool TDongle::pay_assist(int index, real imp, bool lire) ok = burn(); } return ok; -} \ No newline at end of file +} diff --git a/include/expr.cpp b/include/expr.cpp index ef1eefa36..cd9174744 100755 --- a/include/expr.cpp +++ b/include/expr.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -228,10 +229,10 @@ TExpression::TExpression(TTypeexp type, bool ignore_err) TExpression::TExpression(const TExpression & expr) : _code(expr._code), _var(expr._var), - _val(expr._val), _dirty(expr._dirty), - _type(expr._type), _original(expr._original), + _val(expr._val), _ignore_error(expr._ignore_error), + _error(expr._error), _dirty(expr._dirty), _user_func_defined(expr._user_func_defined), - _ignore_error(expr._ignore_error),_error(expr._error) + _type(expr._type), _original(expr._original) { } @@ -754,7 +755,7 @@ TCodesym TExpression::tok2fun(const char* tok) const if (i < f || i > l) return _invalid; - const int cmp = stricmp(tok, fnstr[i]); + const int cmp = xvt_str_compare_ignoring_case(tok, fnstr[i]); if (cmp == 0) break; @@ -854,8 +855,9 @@ TCodesym TExpression::__gettoken(bool /* reduct */) sym = tok2fun(_tok); if (sym != _invalid) return sym; - - for (const char * p = _s; isspace(*p); p++); + const char * p; + + for (p = _s; isspace(*p); p++); if (*p == '(') return _userfunc; } @@ -998,8 +1000,11 @@ TCodesym TExpression::__factor(TCodesym startsym) _code.add(_number, real(from)); _code.add(_number, real(to >= from ? to-from+1 : 0)); _code.add(_mid); - } - for (int i = numvar()-1 ; i >= 0; i--) + } + + int i; + + for (i = numvar()-1 ; i >= 0; i--) if (strcmp(_tok, varname(i)) == 0) break; if (i < 0) _var.add(_tok); sym = __gettoken(TRUE); diff --git a/include/expr.h b/include/expr.h index 7ca0cbc00..ef5d6c8ae 100755 --- a/include/expr.h +++ b/include/expr.h @@ -338,7 +338,7 @@ public: void add(const char* name, const TValue& val = nulltvalue); // @cmember Ritorna il nome della variabile di posto varnum const char* varname(int varnum) const - { return varnum < items() ? ((TVar *) objptr(varnum))->getname() : "";} + { return varnum < items() ? (const char *)((TVar *) objptr(varnum))->getname() : "";} //verificare // @cmember Setta l'oggetto TVararray con il nome e il valore della variabile void set(const char* varname, const real& val); diff --git a/include/files.cpp b/include/files.cpp index 47699879c..610be2225 100755 --- a/include/files.cpp +++ b/include/files.cpp @@ -500,8 +500,10 @@ void TTrec::put ( void TTrec::zero () { + int i; + _rec->NFields = 0; - for (int i = 0; i < MaxFields; i++) + for (i = 0; i < MaxFields; i++) { strcpy(_rec->Fd[i].Name, ""); _rec->Fd[i].TypeF = _nullfld; @@ -613,8 +615,9 @@ void TTrec::update_keydef (int key, const char *desc) if (sym == _variable) { const char *s = inst.string (); + int i; - for (int i = 0; i < _rec->NFields; i++) + for (i = 0; i < _rec->NFields; i++) if (strcmp (_rec->Fd[i].Name, s) == 0) break; @@ -651,9 +654,10 @@ void TTrec::print_on (ostream & out) const out << '\n'; const int nfields = fields (); TToken_string s (80); + int i; out << nfields << '\n'; - for (int i = 0; i < nfields; i++) + for (i = 0; i < nfields; i++) { s = fielddef (i); out << s ; @@ -696,7 +700,9 @@ void TTrec::read_from (istream & in) const int nfields = atoi (_files_tmp_string); set_fields (nfields); TToken_string t; - for (int i = 0; i < nfields; i++) + int i; + + for (i = 0; i < nfields; i++) { in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); t = _files_tmp_string; diff --git a/include/filetext.h b/include/filetext.h index 4ae228aec..8cec2959b 100755 --- a/include/filetext.h +++ b/include/filetext.h @@ -9,8 +9,8 @@ #include #endif -#ifndef _INC_FSTREAM -#include +#ifndef _INCSTR_H +#include #endif ///////////////////////////TTracciato_Campo//////////////////////////////// @@ -89,7 +89,7 @@ class TTracciato_record : public TObject TString _type;//tipo del record TArray _tracciati_campo;//tracciati dei vari campi public: - TTracciato_record(const TString& tipo) : _type(tipo) ,_rel(NULL){} + TTracciato_record(const TString& tipo) : _rel(NULL), _type(tipo){} TTracciato_record(const TTracciato_record& tr); virtual ~TTracciato_record(); virtual TObject* dup() const; diff --git a/include/fraction.cpp b/include/fraction.cpp index f13206315..a39617319 100755 --- a/include/fraction.cpp +++ b/include/fraction.cpp @@ -88,16 +88,17 @@ void fraction::build_fraction (const char *s) if (ndec > 2) { bool found = FALSE; - int j; + int j = 0; + const char * pc; - for (const char * pc = (const char *)n + pdec + 1; !found && *pc != NULL;pc++) + for (pc = (const char *)n + pdec + 1; !found && *pc != '\0'; pc++) { int max_period = strlen(pc) / 3; for (j = max_period; !found && j > 0 ; j--) { - int len, pos; + int len = 0, pos = 0, c; - for (int c = 0; c < j; c++) + for (c = 0; c < j; c++) { const char * pp = pc + c; len = strlen(pp); @@ -125,7 +126,11 @@ void fraction::build_fraction (const char *s) } } n.strip(",.-+/[]"); +#ifdef WIN32 sscanf(n, "%I64d", &_num); +#else + sscanf(n, "%Ld", &_num); +#endif if (len_periodo > 0) { _den = 9; diff --git a/include/fraction.h b/include/fraction.h index 1f3ed67fd..0b0bb91a7 100755 --- a/include/fraction.h +++ b/include/fraction.h @@ -130,4 +130,4 @@ void swap(fraction& a, fraction& b) ; const fraction& fnc_min(const fraction& a, const fraction& b); const fraction& fnc_max(const fraction& a, const fraction& b); -#endif \ No newline at end of file +#endif