Patch: 2.1 no patch (linux)

Files :

Modifiche per la compilazione sotto Linux.
Verificare la eatwhite (il file incstr.cpp di xvaga.cpp non deve servire sotto Windows).
Verificare anche incstr.h


git-svn-id: svn://10.65.10.50/trunk@12158 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-06-07 09:09:47 +00:00
parent 4b78c47bc4
commit 320f34e5c8
4 changed files with 50 additions and 40 deletions

View File

@ -8,11 +8,10 @@
#include <reprint.h>
#include <statbar.h>
TVariant& TVariant_stack::peek(int depth)
{
const int sp = _sp-depth-1;
return sp >= 0 ? (TVariant&)_var[sp] : NULL_VARIANT;
return sp >= 0 ? (TVariant&)_var[sp] : (TVariant &)NULL_VARIANT;
}
bool TVariant_stack::drop()
@ -498,7 +497,7 @@ void TAVM::log_error(const char* str)
bool TAVM::get_token(istream& instr, TString& str) const
{
str.cut(0);
instr.eatwhite();
eatwhite(instr);
if (instr.eof())
return false;
char c;
@ -661,7 +660,7 @@ bool TAVM::compile(istream& instr, TBytecode& bytecode)
case avm_loop:
case avm_plus_loop:
{
const do_pos = find_matching(bytecode, avm_do);
const int do_pos = find_matching(bytecode, avm_do);
if (do_pos < 0)
{
_last_error.cut(0) << str << " without matching DO";
@ -1133,7 +1132,7 @@ void TAVM::do_restart(bool cold)
}
TAVM::TAVM(TAlex_virtual_machine* vm)
: _vm(vm), _outstr(NULL), _interactive(false)
: _vm(vm), _interactive(false), _outstr(NULL)
{
do_restart(true);
}
@ -1172,7 +1171,12 @@ bool TAlex_virtual_machine::execute(const TBytecode& bc)
bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
{
istrstream instr((char*)cmd, strlen(cmd));
#ifdef LINUX
string s(cmd);
istringstream instr(s);
#else
istrstream instr((char*)cmd, (size_t)strlen(cmd));
#endif
return compile(instr, bc);
}

View File

@ -1,8 +1,4 @@
#ifdef WIN32
#include <fstream.h>
#else
#include "../xvaga/incstr.h"
#endif
#include <diction.h>
#include <extcdecl.h>
@ -18,14 +14,14 @@
// TVariant
///////////////////////////////////////////////////////////
static const TVariant NULL_VARIANT;
const TVariant NULL_VARIANT;
void TVariant::set_null()
{
if (_ptr != NULL)
{
if (_type != _nullfld && _type != _longfld)
delete _ptr;
delete (char *) _ptr;
_ptr = NULL;
}
_type = _nullfld;
@ -609,7 +605,8 @@ bool TRecordset::save_as(const char* path, TRecordsetExportFormat fmt)
int TRecordset::find_column(const char* column_name) const
{
for (int i = columns()-1; i >= 0; i--)
int i;
for (i = columns()-1; i >= 0; i--)
{
const TRecordset_column_info& info = column_info(i);
if (info._name == column_name)
@ -1441,7 +1438,7 @@ const TString& TCursor_parser::pop()
{
_token.cut(0);
_instr.eatwhite();
eatwhite(_instr);
if (_instr.eof())
return _token;
@ -1691,7 +1688,6 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
return;
const int logicnum = table2logic(tok);
const char* tab = NULL;
if (logicnum != LF_TAB && logicnum != LF_TABCOM)
_relation = new TRelation(logicnum);
@ -1915,7 +1911,12 @@ TCursor* TISAM_recordset::cursor() const
TString use; parsed_text(use);
TPerformance_profiler prof("ISAM query");
TISAM_recordset* my = (TISAM_recordset*)this;
#ifdef LINUX
string s(use.get_buffer());
istringstream instr(s);
#else
istrstream instr(use.get_buffer(), use.len());
#endif
TCursor_parser parser(instr, my->_column);
my->_relation = parser.get_relation();

View File

@ -166,12 +166,12 @@ bool TReport_font::load(const TXmlItem& item)
return font != NULL;
}
TReport_font::TReport_font() : _fontid(NULL), _win_mapped(NULL_WIN)
TReport_font::TReport_font() : _win_mapped(NULL_WIN), _fontid(NULL)
{
create("Courier New", DEFAULT_FONT_SIZE, XVT_FS_NONE);
}
TReport_font::TReport_font(const TReport_font& f) : _fontid(NULL), _win_mapped(NULL_WIN)
TReport_font::TReport_font(const TReport_font& f) : _win_mapped(NULL_WIN), _fontid(NULL)
{ copy(f); }
TReport_font::~TReport_font()
@ -441,7 +441,7 @@ static short get_num_attr(const TXmlItem& item, const char* attr, short def = 0)
const TString& str = item.GetAttr(attr);
if (str.not_empty())
{
real n = str; n *=CENTO ;
real n(str); n *=CENTO ;
def = (short)n.integer();
}
return def;
@ -548,7 +548,9 @@ int TReport_section::add(TObject& obj)
int TReport_section::find_field_pos(int id)
{
for (int i = items()-1; i >= 0; i--)
int i;
for (i = items()-1; i >= 0; i--)
{
if (field(i).id() == id)
break;
@ -750,10 +752,12 @@ void TReport_section::load(const TXmlItem& sec)
}
TReport_section::TReport_section(TReport& r, char t, int l)
: _report(r), _type(t), _level(l), _font(NULL),
_size(0,0), _pos(0,0),
_page_break(false), _hidden_if_needed(false), _repeat(false),
_hidden(false), _deactivated(false)
: _report(r), _type(t), _level(l), _pos(0,0),
_size(0,0), _page_break(false), _hidden_if_needed(false),
_repeat(false), _hidden(false), _deactivated(false), _font(NULL)
{ }
TReport_section::~TReport_section()
@ -1569,10 +1573,11 @@ int TReport_field::compare(const TSortable& s) const
}
TReport_field::TReport_field(TReport_section* sec)
: _section(sec), _id(0), _type('T'),
_font(NULL), _halign('L'), _valign('T'),_dynamic_height(false),
_selected(false), _hidden(false), _deactivated(false), _hide_zeroes(false),
_border(0), _fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE), _rct(0,0,1000,100)
: _section(sec), _id(0), _type('T'), _rct(0,0,1000,100),
_fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE),
_border(0), _halign('L'), _valign('T'),_dynamic_height(false), _font(NULL),
_hidden(false), _deactivated(false), _hide_zeroes(false), _selected(false)
{ }
TReport_field::TReport_field(const TReport_field& rf) : _font(NULL)
@ -2448,7 +2453,7 @@ void TReport::include_libraries(bool reload)
}
}
TReport::TReport() : _lpi(6), _recordset(NULL), _curr_field(NULL), _include(15, ',')
TReport::TReport() : _lpi(6), _include(15, ','), _recordset(NULL), _curr_field(NULL)
{
_expressions.set_report(this);
_prescript.set_description("PRESCRIPT");

View File

@ -314,16 +314,16 @@ void TPrint_preview_window::handler(WINDOW win, EVENT* ep)
void TPrint_preview_window::do_scroll(int kx, int ky)
{
const TPoint& r = range();
TPoint or = origin();
or.x += kx * r.x/8;
or.y += ky * r.y/6;
if (or.x < 0) or.x = 0;
if (or.x > r.x) or.x = r.x;
if (or.y < 0) or.y = 0;
if (or.y > r.y) or.y = r.y;
if (or != origin())
TPoint orig = origin();
orig.x += kx * r.x/8;
orig.y += ky * r.y/6;
if (orig.x < 0) orig.x = 0;
if (orig.x > r.x) orig.x = r.x;
if (orig.y < 0) orig.y = 0;
if (orig.y > r.y) orig.y = r.y;
if (orig != origin())
{
update_thumb(or.x, or.y);
update_thumb(orig.x, orig.y);
force_update();
}
}
@ -396,7 +396,7 @@ protected:
virtual void handler(WINDOW win, EVENT* ep);
public:
void export();
void export_text();
TPreview_mask(TBook* book);
};
@ -433,7 +433,7 @@ void TPreview_mask::handler(WINDOW win, EVENT* ep)
TAutomask::handler(win, ep);
}
void TPreview_mask::export()
void TPreview_mask::export_text()
{
TFilename n; n.temp(NULL, "txt");
if (_book->export_text(n))
@ -451,7 +451,7 @@ bool TPreview_mask::on_field_event(TOperable_field& o, TField_event e, long joll
case DLG_FINDREC : dispatch_e_menu(_pvf->win().win(), POPUP_SEARCH);break;
case DLG_NEXTREC : dispatch_e_menu(_pvf->win().win(), POPUP_NEXT); break;
case DLG_LASTREC : dispatch_e_menu(_pvf->win().win(), POPUP_LAST); break;
case DLG_EDIT : export(); break;
case DLG_EDIT : export_text(); break;
default: break;
}
}