Modifiche dalla versione Linux sulla 2.1

git-svn-id: svn://10.65.10.50/trunk@11840 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-03-12 14:39:04 +00:00
parent 2902fa494a
commit ee474af565
8 changed files with 95 additions and 52 deletions

View File

@ -501,7 +501,7 @@ bool TApplication::remove_menu(MENU_TAG id)
TApplication::TApplication()
: _savefirm(0), _running(FALSE), _create_ok(FALSE), _god_vars(NULL)
: _god_vars(NULL),_savefirm(0), _running(FALSE), _create_ok(FALSE)
{
}
@ -556,7 +556,8 @@ const char* TApplication::get_module_name() const
TScanner scanner(AUT_FILE);
bool ok = FALSE;
for (int aut = 0; scanner.line() != ""; aut++)
int aut;
for (aut = 0; scanner.line() != ""; aut++)
if (strncmp(scanner.token(), _name, 2) == 0)
{ ok = TRUE; break; }
module = scanner.token().mid(3);
@ -908,7 +909,7 @@ bool TApplication::build_firm_data(long codditta, bool flagcom)
prefix().set_codditta(codditta);
dir.put(i, _nordir, _sysdirop);
rec.put(i);
const char* name = dir.name();
// const char* name = dir.name();
dir.flags() = 0L;
create_now = create_now && (flagcom ? dir.is_com() : dir.is_firm());

View File

@ -276,7 +276,7 @@ bool TArchive::fsplit_zip(
do_events();
}
const long minsize = 360*1024L;
const unsigned long minsize = 360*1024L;
if (size < minsize)
size = minsize;

View File

@ -117,8 +117,18 @@ void TConfig::_write_file()
if (_file.exist())
{
// ifstream in(_file, ios::in | ios::nocreate, filebuf::sh_read); // PARKED
#ifdef WIN32
ifstream in(_file, ios::in | ios::nocreate);
#else
ifstream in(_file, ios::in);
#endif
if (in.good())
{
TString l(1024);
@ -531,9 +541,11 @@ word TConfig::items(
// @comm Il paragrafo passato in <p section> diventa quello attivo.
// <nl>Possono esserci dei "buchi" causati da set() errate
{
if (section && *section)
int cnt;
if (section && *section)
set_paragraph(section);
for (int cnt = 0; exist(var, cnt); cnt++);
for (cnt = 0; exist(var, cnt); cnt++);
return cnt;
}
@ -739,11 +751,10 @@ TConfig::TConfig(int which_config, const char* paragraph)
TString16 u = user();
if (u.blank())
u = ::dongle().administrator();
else
u.upper();
u.lower();
_file.add(u);
_file.ext("ini");
if (u != "ADMIN" && !_file.exist())
if (u != "admin" && !_file.exist())
{
TFilename prassi = _file.path();
prassi.add("admin.ini");

View File

@ -5,8 +5,10 @@
#include <strings.h>
#endif
#ifdef WIN32
#define TO_BE_TRANSLATED "\03\02\01\00"
#define ALREADY_TRANSLATED "\01\02\03\00"
#endif
#ifndef XVT_INCL_XVT
typedef unsigned long WINDOW;
@ -27,10 +29,19 @@ void dictionary_translate_menu(WINDOW win);
bool dictionary_active();
void dictionary_close();
#ifdef WIN32
#define TR(str) dictionary_translate_macro(TO_BE_TRANSLATED##str)
#define PR(str) dictionary_translate_macro_prompt(TO_BE_TRANSLATED##str)
#define BR(str, len) dictionary_translate_macro_prompt(TO_BE_TRANSLATED##str, len)
#define HR(str) dictionary_translate_macro_header(TO_BE_TRANSLATED##str)
#define FR(str) dictionary_translate_macro(TO_BE_TRANSLATED##str)
#else
#define TR(str) dictionary_translate_macro(str)
#define PR(str) dictionary_translate_macro_prompt(str)
#define BR(str, len) dictionary_translate_macro_prompt(str, len)
#define HR(str) dictionary_translate_macro_header(str)
#define FR(str) dictionary_translate_macro(str)
#endif
#endif
#endif

View File

@ -23,13 +23,13 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
// Certified 70%
TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
: _text(NULL), _cancel(NULL), _bar(0),
_status(0L), _max(tot), _flags(0x0)
: _text(NULL), _cancel(NULL),
_bar(0), _flags(0x0), _max(tot), _status(0L)
{
TToken_string testo(txt, '\n');
word maxlen = div;
const word lines = measure_text(testo, maxlen);
const int hor = min(maxlen+3, 78);
const int ver = lines+1 + (bar ? 2 : 0) + (cancel ? 2: 0);
@ -40,13 +40,13 @@ TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
_text = new TMultiline_control(win(), DLG_NULL, 1, 0, hor-2, lines+1, 512, "CD", "");
_text->set_read_only();
set_text(testo);
if (bar)
{
{
RCT r; _text->get_rect(r);
_bar = r.bottom + CHARY;
}
if (cancel)
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 12, 2, "", "", BMP_CANCEL);
@ -55,7 +55,7 @@ TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
_indwin_count++;
setmax(tot);
}
}
// @doc EXTERNAL

View File

@ -1,6 +1,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <xvt.h>
#include <real.h>
const real ZERO(0.0);
@ -142,7 +143,7 @@ const char *real::string (
// <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;
@ -155,31 +156,31 @@ const char *real::string (
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';
}
}
}
__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--)
for (int i = pow; i > 0; i--)
{
m *= 10.0;
d *= 0.1;
@ -227,7 +228,7 @@ real& real::round (
else
_dec *= m;
}
if (_dec >= 0.0)
_dec = floorl(_dec + 0.5);
else
@ -319,7 +320,7 @@ long double sqrt(long double a)
long double sqr(long double a)
{
return a*a;
return a*a;
}
long double exp10(long double a)
@ -503,10 +504,10 @@ bool real::is_zero () const
// @doc EXTERNAL
// @mfunc Ritorna il segno del reale
// @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
@ -575,6 +576,7 @@ const char *real::string (
return s;
}
// @doc EXTERNAL
// @func ostream& | operator <lt><lt> | Permette di reindirizzare il numero
@ -1484,7 +1486,7 @@ const char* real::string(const char *picture) const
return string ();
if (*picture == '.')
return points (atoi (picture + 1));
if (stricmp (picture, "LETTERE") == 0)
if (xvt_str_compare_ignoring_case(picture, "LETTERE") == 0)
return literals ();
TString v (string());
@ -1513,7 +1515,8 @@ const char* real::string(const char *picture) const
int j = v.len () - 1;
bool sign(FALSE);
for (int i = f.len () - 1; i >= 0 && j >= 0; i--)
int i;
for (i = f.len () - 1; i >= 0 && j >= 0; i--)
{
char &z = f[i];
if (strchr ("#@^", z))
@ -1811,4 +1814,4 @@ bool TImporto::is_zero() const
#else
return _valore.is_zero();
#endif
}
}

View File

@ -1,6 +1,8 @@
#include <xvt.h>
#include <errno.h>
#ifdef WIN32
#include <direct.h>
#endif
#include <diction.h>
#include <strings.h>
@ -30,7 +32,7 @@ bool fcopy(
const char* wflag = append ? "ab" : "wb";
// Copia il file su se stesso?
if (stricmp(orig, dest) == 0)
if (xvt_str_compare_ignoring_case(orig, dest) == 0)
return TRUE; // Or FALSE?
FILE* i = fopen(orig, rflag);
@ -106,11 +108,23 @@ long fsize(const char* name)
//
// @flag TRUE | Se l'operazione e' avvenuta con successo
// @flag FALSE | Se l'operazione non e' riuscita
bool make_dir(
const char* dir) // @parm Nome della directory da creare
bool make_dir(const char* dir) // @parm Nome della directory da creare
{
int res = mkdir(dir);
return res == 0;
return xvt_fsys_mkdir(dir);
}
// @doc EXTERNAL
// @func Cancella un file
//
// @rdesc Ritorna il risultato dell'operazione
//
// @flag TRUE | Se l'operazione e' avvenuta con successo
// @flag FALSE | Se l'operazione non e' riuscita
bool remove_file(const char* file) // @parm Nome della directory da creare
{
return xvt_fsys_removefile(file);
}
// @doc EXTERNAL
@ -126,7 +140,9 @@ int list_files(
{
TFilename dir(filelist);
for (int i = dir.len()-1; i >= 0; i--)
int i;
for (i = dir.len()-1; i >= 0; i--)
if (dir[i] == '/' || dir[i] == '\\' || dir[i] == ':') break;
TFilename mask(dir.mid(i+1));
@ -452,7 +468,8 @@ const char * encode(
// @xref <f decode>
{
char* tmp = get_tmp_string(50).get_buffer();
for (int i = 0; data[i]; i++)
int i;
for (i = 0; data[i]; i++)
tmp[i] = data[i] + (i < 8 ? encryption_key[i] : data[i - 8]);
tmp[i] = '\0';
return tmp;
@ -469,7 +486,9 @@ const char * decode(
// @xref <f encode>
{
char* tmp = get_tmp_string(50).get_buffer();
for (int i = 0; data[i]; i++)
int i;
for (i = 0; data[i]; i++)
tmp[i] = data[i] - (i < 8 ? encryption_key[i] : tmp[i - 8]);
tmp[i] = '\0';
return tmp;

View File

@ -6,8 +6,8 @@ TVariable_field::TVariable_field(
const char * expr,
TTypeexp type,
int len)
: _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL),
_put_string(NULL), _in_get(FALSE),_lenght(len)
: _rec(NULL), _name(name), _e(NULL), _put_string(NULL),
_getfunc(NULL), _in_get(FALSE),_lenght(len)
{
if (expr && *expr)
{
@ -21,8 +21,8 @@ TVariable_field::TVariable_field(
const char * name, //
VIRTUAL_GET_FUNCTION getfunc,
int len) //
: _name(name), _e(NULL) , _rec(NULL), _getfunc(getfunc),
_put_string(NULL), _in_get(FALSE),_lenght(len)
: _rec(NULL), _name(name), _e(NULL), _put_string(NULL),
_getfunc(getfunc), _in_get(FALSE), _lenght(len)
{
CHECK(_getfunc, "You must pass a valid VIRTUAL_GET_FUNCTION");
}
@ -32,15 +32,15 @@ TVariable_field::TVariable_field(
const TExpression & expr, //
TTypeexp type,
int len) //
: _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL),
_put_string(NULL), _in_get(FALSE),_lenght(len)
: _rec(NULL), _name(name), _e(NULL), _put_string(NULL),
_getfunc(NULL), _in_get(FALSE),_lenght(len)
{
_e = (TExpression *) expr.dup();
}
TVariable_field::TVariable_field(const TVariable_field & f)
: _rec(f._rec), _name(f._name), _e(NULL) , _getfunc(f._getfunc),
_put_string(NULL), _in_get(FALSE),_lenght(f._lenght)
: _rec(f._rec), _name(f._name), _e(NULL), _put_string(NULL),
_getfunc(f._getfunc), _in_get(FALSE),_lenght(f._lenght)
{
if (f._e)
_e = (TExpression *) f._e->dup();
@ -387,5 +387,3 @@ TExtrectype::~TExtrectype()
{
delete _rd;
}