Cambiata integer() dei real: adesso ritorna long. Sistemati files dipendenti

(ma non erano tutti questi. Boh.)


git-svn-id: svn://10.65.10.50/trunk@264 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-09-19 09:50:07 +00:00
parent 867ca4bd7d
commit 0178369ee6
33 changed files with 2475 additions and 2475 deletions

View File

@ -1,14 +1,14 @@
#ifndef __ANAFIS_H #ifndef __ANAFIS_H
#define __ANAFIS_H #define __ANAFIS_H
#define ANF_CODANAGR "CODANAGR" #define ANF_CODANAGR "CODANAGR"
#define ANF_DATANASC "DATANASC" #define ANF_DATANASC "DATANASC"
#define ANF_SESSO "SESSO" #define ANF_SESSO "SESSO"
#define ANF_STATONASC "STATONASC" #define ANF_STATONASC "STATONASC"
#define ANF_COMNASC "COMNASC" #define ANF_COMNASC "COMNASC"
#define ANF_COMRES "COMRES" #define ANF_COMRES "COMRES"
#define ANF_TIPOA "TIPOA" #define ANF_TIPOA "TIPOA"
#endif #endif

View File

@ -1,19 +1,19 @@
#ifndef __ANAGR_H #ifndef __ANAGR_H
#define __ANAGR_H #define __ANAGR_H
#define ANA_TIPOA "TIPOA" #define ANA_TIPOA "TIPOA"
#define ANA_CODANAGR "CODANAGR" #define ANA_CODANAGR "CODANAGR"
#define ANA_PAIV "PAIV" #define ANA_PAIV "PAIV"
#define ANA_COFI "COFI" #define ANA_COFI "COFI"
#define ANA_RAGSOC "RAGSOC" #define ANA_RAGSOC "RAGSOC"
#define ANA_COMRF "COMRF" #define ANA_COMRF "COMRF"
#define ANA_STATORES "STATORES" #define ANA_STATORES "STATORES"
#define ANA_COMRES "COMRES" #define ANA_COMRES "COMRES"
#define ANA_INDRES "INDRES" #define ANA_INDRES "INDRES"
#define ANA_CIVRES "CIVRES" #define ANA_CIVRES "CIVRES"
#define ANA_CAPRES "CAPRES" #define ANA_CAPRES "CAPRES"
#define ANA_INDRF "INDRF" #define ANA_INDRF "INDRF"
#define ANA_CIVRF "CIVRF" #define ANA_CIVRF "CIVRF"
#endif #endif

View File

@ -1,18 +1,18 @@
#define F_GROUP 101 #define F_GROUP 101
#define F_KEY 102 #define F_KEY 102
#define F_CLASS 103 #define F_CLASS 103
#define F_X 104 #define F_X 104
#define F_Y 105 #define F_Y 105
#define F_WIDTH 106 #define F_WIDTH 106
#define F_HEIGTH 107 #define F_HEIGTH 107
#define F_PROMPT 108 #define F_PROMPT 108
#define F_PICTURE 121 #define F_PICTURE 121
#define F_FIELD 131 #define F_FIELD 131
#define F_FIELD2 132 #define F_FIELD2 132
#define F_AUTOMAGIC 151 #define F_AUTOMAGIC 151
#define F_HIDDEN 152 #define F_HIDDEN 152
#define F_DISABLED 153 #define F_DISABLED 153

View File

@ -1,23 +1,23 @@
#ifndef __CAUSALI_H #ifndef __CAUSALI_H
#define __CAUSALI_H #define __CAUSALI_H
#define CAU_CODCAUS "CODCAUS" #define CAU_CODCAUS "CODCAUS"
#define CAU_NRIGA "NRIGA" #define CAU_NRIGA "NRIGA"
#define CAU_DESCR "DESCR" #define CAU_DESCR "DESCR"
#define CAU_TIPODOC "TIPODOC" #define CAU_TIPODOC "TIPODOC"
#define CAU_MOVAP "MOVAP" #define CAU_MOVAP "MOVAP"
#define CAU_ALLEG "ALLEG" #define CAU_ALLEG "ALLEG"
#define CAU_INTRACOM "INTRACOM" #define CAU_INTRACOM "INTRACOM"
#define CAU_REG "REG" #define CAU_REG "REG"
#define CAU_MOVVAL "MOVVAL" #define CAU_MOVVAL "MOVVAL"
#define CAU_DATADOC "DATADOC" #define CAU_DATADOC "DATADOC"
#define CAU_NUMDOC "NUMDOC" #define CAU_NUMDOC "NUMDOC"
#define CAU_AUTOFATT "AUTOFATT" #define CAU_AUTOFATT "AUTOFATT"
#define CAU_MOVSEZ "MOVSEZ" #define CAU_MOVSEZ "MOVSEZ"
#define CAU_TIPOMOV "TIPOMOV" #define CAU_TIPOMOV "TIPOMOV"
#define CAU_RITFATT "RITFATT" #define CAU_RITFATT "RITFATT"
#define CAU_COLLCESP "COLLCESP" #define CAU_COLLCESP "COLLCESP"
#define CAU_M770 "M770" #define CAU_M770 "M770"
#define CAU_CODCAUSIM "CODCAUSIM" #define CAU_CODCAUSIM "CODCAUSIM"
#endif #endif

View File

@ -1,13 +1,13 @@
#ifndef __COLORS_H #ifndef __COLORS_H
#define __COLORS_H #define __COLORS_H
extern COLOR MASK_BACK_COLOR; extern COLOR MASK_BACK_COLOR;
extern COLOR NORMAL_COLOR; extern COLOR NORMAL_COLOR;
extern COLOR NORMAL_BACK_COLOR; extern COLOR NORMAL_BACK_COLOR;
extern COLOR DISABLED_COLOR; extern COLOR DISABLED_COLOR;
extern COLOR DISABLED_BACK_COLOR; extern COLOR DISABLED_BACK_COLOR;
extern COLOR FOCUS_COLOR; extern COLOR FOCUS_COLOR;
extern COLOR FOCUS_BACK_COLOR; extern COLOR FOCUS_BACK_COLOR;
#endif #endif

View File

@ -1,25 +1,25 @@
#ifndef __COMUNI_H #ifndef __COMUNI_H
#define __COMUNI_H #define __COMUNI_H
#define COM_STATO "STATO" #define COM_STATO "STATO"
#define COM_COM "COM" #define COM_COM "COM"
#define COM_DENCOM "DENCOM" #define COM_DENCOM "DENCOM"
#define COM_PROVCOM "PROVCOM" #define COM_PROVCOM "PROVCOM"
#define COM_CAPCOM "CAPCOM" #define COM_CAPCOM "CAPCOM"
#define COM_CODISTAT "CODISTAT" #define COM_CODISTAT "CODISTAT"
#define COM_UFFIIDD1 "UFFIIDD1" #define COM_UFFIIDD1 "UFFIIDD1"
#define COM_UFFIIDD2 "UFFIIDD2" #define COM_UFFIIDD2 "UFFIIDD2"
#define COM_UFFIIDD3 "UFFIIDD3" #define COM_UFFIIDD3 "UFFIIDD3"
#define COM_UFFIVA1 "UFFIVA1" #define COM_UFFIVA1 "UFFIVA1"
#define COM_UFFIVA2 "UFFIVA2" #define COM_UFFIVA2 "UFFIVA2"
#define COM_UFFIVA3 "UFFIVA3" #define COM_UFFIVA3 "UFFIVA3"
#define COM_UFFREG "UFFREG" #define COM_UFFREG "UFFREG"
#define COM_UFFCONC "UFFCONC" #define COM_UFFCONC "UFFCONC"
#define COM_UFFCSERV "UFFCSERV" #define COM_UFFCSERV "UFFCSERV"
#define COM_UFFESPROV "UFFESPROV" #define COM_UFFESPROV "UFFESPROV"
#define COM_UFFESCOM "UFFESCOM" #define COM_UFFESCOM "UFFESCOM"
#define COM_ALIQICI "ALIQICI" #define COM_ALIQICI "ALIQICI"
#define COM_TERRMON "TERRMON" #define COM_TERRMON "TERRMON"
#endif #endif

View File

@ -49,7 +49,7 @@ bool TConfig_application::menu(MENU_TAG m)
_last_choice = m; _last_choice = m;
do_config((m - BAR_ITEM(0))/100); do_config((m - BAR_ITEM(0))/100);
} }
return xvt_test_menu_tag(BAR_ITEM(2)); return xvt_test_menu_tag(BAR_ITEM(2));
} }
void TConfig_application::do_config(int m) void TConfig_application::do_config(int m)

View File

@ -1,81 +1,81 @@
#ifndef __CONFAPP_H #ifndef __CONFAPP_H
#define __CONFAPP_H #define __CONFAPP_H
#ifndef __APPLICAT_H #ifndef __APPLICAT_H
#include <applicat.h> #include <applicat.h>
#endif #endif
#ifndef __CONFIG_H #ifndef __CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#ifndef __MASK_H #ifndef __MASK_H
#include <mask.h> #include <mask.h>
#endif #endif
// le applicazioni di questo tipo servono a leggere - scrivere - modificare // le applicazioni di questo tipo servono a leggere - scrivere - modificare
// files di configurazione. La linea di comando e' // files di configurazione. La linea di comando e'
// //
// <app> [-f <filename>] [-d] [<paragraph>, ...] // <app> [-f <filename>] [-d] [<paragraph>, ...]
// //
// dopo -f si dara' il nome file che si vuole editare, default e' CONFIG_FILE // dopo -f si dara' il nome file che si vuole editare, default e' CONFIG_FILE
// definito in config.h. Se si da' -d viene considerato quello relativo alla // definito in config.h. Se si da' -d viene considerato quello relativo alla
// ditta corrente, che viene creato copiando il principale se non c'e'. // ditta corrente, che viene creato copiando il principale se non c'e'.
// Quindi si da' la lista dei paragrafi che si vuole editare; se non ne vengono // Quindi si da' la lista dei paragrafi che si vuole editare; se non ne vengono
// dati sara' il modulo corrente preso dal nome dell'applicazione. Se si // dati sara' il modulo corrente preso dal nome dell'applicazione. Se si
// indicano piu' paragrafi questi vengono assegnati nell'ordine alle voci // indicano piu' paragrafi questi vengono assegnati nell'ordine alle voci
// di menu (da mettere nell'URL) da 1 in poi. La maschera usata e' la // di menu (da mettere nell'URL) da 1 in poi. La maschera usata e' la
// EditMask specificata nel paragrafo; se non c'e', nothing happens // EditMask specificata nel paragrafo; se non c'e', nothing happens
// Ogni modifica puo' essere controllata e porcessata con la postprocess_ // Ogni modifica puo' essere controllata e porcessata con la postprocess_
// config (vedi sotto) che agisce come la change_config di application. // config (vedi sotto) che agisce come la change_config di application.
// La voce Scelta parametri di Application rimane come prima. // La voce Scelta parametri di Application rimane come prima.
class TConfig_application : public TApplication class TConfig_application : public TApplication
{ {
TArray _paragraphs; TArray _paragraphs;
int _which_config; int _which_config;
MENU_TAG _last_choice; MENU_TAG _last_choice;
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG); virtual bool menu(MENU_TAG);
void do_config(int m); void do_config(int m);
protected: protected:
virtual bool user_create() { return TRUE; } virtual bool user_create() { return TRUE; }
virtual bool user_destroy() { return TRUE; } virtual bool user_destroy() { return TRUE; }
// questa viene chiamata prima della run() e ferma tutto se ritorna // questa viene chiamata prima della run() e ferma tutto se ritorna
// FALSE // FALSE
virtual bool preprocess_config (TMask& mask, TConfig& config); virtual bool preprocess_config (TMask& mask, TConfig& config);
// questa viene chiamata dopo e blocca tutto se FALSE // questa viene chiamata dopo e blocca tutto se FALSE
virtual bool postprocess_config (TMask& mask, TConfig& config); virtual bool postprocess_config (TMask& mask, TConfig& config);
// questa e' come la change_config di application ma viene usata // questa e' come la change_config di application ma viene usata
// dalla maschera principale; le viene passato in piu' il paragrafo // dalla maschera principale; le viene passato in piu' il paragrafo
// in corso di editing. E' chiamata per ogni parametro modificato // in corso di editing. E' chiamata per ogni parametro modificato
// Se ritorna FALSE la modifica non viene accettata; default ritorna // Se ritorna FALSE la modifica non viene accettata; default ritorna
// TRUE e non rompe i bal // TRUE e non rompe i bal
virtual bool postprocess_config_changed (const char* par, const char* var, virtual bool postprocess_config_changed (const char* par, const char* var,
const char* oldv, const char* newv); const char* oldv, const char* newv);
public: public:
TConfig_application(int which_config = CONFIG_GENERAL) TConfig_application(int which_config = CONFIG_GENERAL)
: _which_config(which_config) : _which_config(which_config)
{} {}
virtual ~TConfig_application() virtual ~TConfig_application()
{} {}
}; };
#endif #endif

View File

@ -1,227 +1,227 @@
#include <stdlib.h> #include <stdlib.h>
#include <applicat.h> #include <applicat.h>
#include <config.h> #include <config.h>
#include <utility.h> #include <utility.h>
#include <scanner.h> #include <scanner.h>
// questo sara' il principale, per ora non c'e' // questo sara' il principale, per ora non c'e'
#define CONFIG_FILE "prassi.ini" #define CONFIG_FILE "prassi.ini"
// file parametri studio (uno per studio, per ora e' il principale) // file parametri studio (uno per studio, per ora e' il principale)
#define CONFIG_FILE_STUDIO "prassis.ini" #define CONFIG_FILE_STUDIO "prassis.ini"
// file parametri ditta (uno per ditta) // file parametri ditta (uno per ditta)
#define CONFIG_FILE_DITTA "prassid.ini" #define CONFIG_FILE_DITTA "prassid.ini"
extern "C" extern "C"
{ {
int rename(const char*, const char*); int rename(const char*, const char*);
}; };
bool TConfig::_read_paragraph() bool TConfig::_read_paragraph()
// ritorna TRUE se il paragrafo c'era, FALSE altrimenti // ritorna TRUE se il paragrafo c'era, FALSE altrimenti
{ {
bool itwas = FALSE; bool itwas = FALSE;
_data.destroy(); _data.destroy();
TScanner scan(_file); TScanner scan(_file);
if (scan.paragraph(_paragraph)) if (scan.paragraph(_paragraph))
{ {
itwas = TRUE; itwas = TRUE;
// populate array // populate array
TString l, key, val; TString l, key, val;
for (;;) for (;;)
{ {
l = scan.line(); l = scan.line();
if (l[0] == '#') continue; if (l[0] == '#') continue;
if (l == "" || l[0] == '[') break; if (l == "" || l[0] == '[') break;
int ind = l.find('='); int ind = l.find('=');
if (ind == -1) if (ind == -1)
{ {
warning_box("Errore configurazione: file %s, vicino a riga %ud", warning_box("Errore configurazione: file %s, vicino a riga %ud",
(const char*)_file, scan.linenum()); (const char*)_file, scan.linenum());
continue; continue;
} }
key = l.left(ind); key.trim(); key = l.left(ind); key.trim();
val = l.mid(ind+1); val.trim(); val = l.mid(ind+1); val.trim();
// sostituzione abilitata // sostituzione abilitata
_data.add(key,val,TRUE); _data.add(key,val,TRUE);
} }
} }
return itwas; return itwas;
} }
void TConfig::_write_paragraph(ofstream& out) void TConfig::_write_paragraph(ofstream& out)
{ {
_data.restart(); _data.restart();
TString cnf(16); TString cnf(16);
cnf << '[' << _paragraph << ']'; cnf << '[' << _paragraph << ']';
out << cnf << '\n'; out << cnf << '\n';
for (int i = 0; i < _data.items(); i++) for (int i = 0; i < _data.items(); i++)
{ {
THash_object* o = _data.get_hashobj(); THash_object* o = _data.get_hashobj();
out << o->key() << "\t= " << (TString&)(o->obj()) << '\n'; out << o->key() << "\t= " << (TString&)(o->obj()) << '\n';
} }
out << '\n'; out << '\n';
} }
void TConfig::_write_file() void TConfig::_write_file()
{ {
ifstream in(_file); ifstream in(_file);
TFilename temp; TFilename temp;
temp.temp("__tmp__.cnf"); temp.temp("__tmp__.cnf");
ofstream out(temp); ofstream out(temp);
TFixed_string l(__tmp_string, sizeof(__tmp_string)); TFixed_string l(__tmp_string, sizeof(__tmp_string));
TString cnf(16); TString cnf(16);
cnf << '[' << _paragraph << ']'; cnf << '[' << _paragraph << ']';
bool skip = FALSE, done = FALSE; bool skip = FALSE, done = FALSE;
while (!in.eof()) while (!in.eof())
{ {
in.getline(__tmp_string,sizeof(__tmp_string)-1); in.getline(__tmp_string,sizeof(__tmp_string)-1);
l.trim(); l.trim();
if (cnf == l) if (cnf == l)
{ {
// write paragraph and all variables // write paragraph and all variables
_write_paragraph(out); _write_paragraph(out);
skip = TRUE; done = TRUE; skip = TRUE; done = TRUE;
} }
else else
{ {
if (skip) skip = l[0] != '['; if (skip) skip = l[0] != '[';
if (!skip) out << l << '\n'; if (!skip) out << l << '\n';
} }
} }
// new paragraph // new paragraph
if (!done) _write_paragraph(out); if (!done) _write_paragraph(out);
out.close(); in.close(); out.close(); in.close();
TFilename bak(_file); bak.ext("bak"); TFilename bak(_file); bak.ext("bak");
rename(_file,bak); rename(_file,bak);
fcopy(temp,_file); fcopy(temp,_file);
remove(temp); remove(temp);
} }
void TConfig::_check_paragraph(const char* section) void TConfig::_check_paragraph(const char* section)
{ {
if (section != NULL && section != _paragraph) if (section != NULL && section != _paragraph)
{ {
if (_dirty) _write_file(); if (_dirty) _write_file();
_paragraph = section; _paragraph = section;
_dirty = FALSE; _dirty = FALSE;
_read_paragraph(); _read_paragraph();
} }
} }
TString& TConfig::get(const char* var, const char* section, int index) TString& TConfig::get(const char* var, const char* section, int index)
{ {
// ritorna valore di variabile nella sezione corrente o in // ritorna valore di variabile nella sezione corrente o in
// quella specificata // quella specificata
static TFixed_string s(__tmp_string, 256); static TFixed_string s(__tmp_string, 256);
TString vvar(var); if (index != -1) vvar << '(' << index << ')'; TString vvar(var); if (index != -1) vvar << '(' << index << ')';
_check_paragraph(section); _check_paragraph(section);
if (_data.is_key(vvar)) if (_data.is_key(vvar))
s = (TString&)_data[vvar]; s = (TString&)_data[vvar];
else else
{ {
#ifdef DBG #ifdef DBG
error_box("Can't find '%s' in section '%s' of '%s'", error_box("Can't find '%s' in section '%s' of '%s'",
var, (const char*)_paragraph, (const char*)_file); var, (const char*)_paragraph, (const char*)_file);
#endif #endif
s = ""; s = "";
} }
return s; return s;
} }
long TConfig::get_long(const char* var, const char* section, int index) long TConfig::get_long(const char* var, const char* section, int index)
{ {
return atol(get(var,section,index)); return atol(get(var,section,index));
} }
bool TConfig::get_bool(const char* var, const char* section, int index) bool TConfig::get_bool(const char* var, const char* section, int index)
{ {
const TString& s = get(var, section, index).upper(); const TString& s = get(var, section, index).upper();
return s != "" && (s == "X" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE"); return s != "" && (s == "X" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE");
} }
bool TConfig::set(const char* var, const char* value, const char* section, bool TConfig::set(const char* var, const char* value, const char* section,
bool force, int index) bool force, int index)
{ {
// setta variabile nella sezione corrente o specificata // setta variabile nella sezione corrente o specificata
// se force == TRUE crea la variabile se non esiste; altrimenti // se force == TRUE crea la variabile se non esiste; altrimenti
// da' errore; ritorna TRUE se la variabile c'era, FALSE diversamente // da' errore; ritorna TRUE se la variabile c'era, FALSE diversamente
_check_paragraph(section); _check_paragraph(section);
TString vvar(var); if (index != -1) vvar << '(' << index << ')'; TString vvar(var); if (index != -1) vvar << '(' << index << ')';
bool itwas = _data.is_key(vvar); bool itwas = _data.is_key(vvar);
if (itwas && !force) if (itwas && !force)
warning_box("Tentativo di ridefinizione simbolo: %s", (const char*)vvar); warning_box("Tentativo di ridefinizione simbolo: %s", (const char*)vvar);
else else
{ {
_dirty = TRUE; _dirty = TRUE;
_data.add(vvar, new TString(value), force); _data.add(vvar, new TString(value), force);
} }
return itwas; return itwas;
} }
bool TConfig::set(const char* var, long value, const char* section, bool TConfig::set(const char* var, long value, const char* section,
bool force, int index) bool force, int index)
{ {
TString t; t << value; TString t; t << value;
return set(var,t,section,force,index); return set(var,t,section,force,index);
} }
word TConfig::items(const char* var, const char* section) word TConfig::items(const char* var, const char* section)
{ {
_check_paragraph(section); _check_paragraph(section);
TString vvar(16); TString vvar(16);
for (int cnt = 0; /* uncazzo */ ;cnt++) for (int cnt = 0; /* uncazzo */ ;cnt++)
{ {
vvar = var; vvar << '(' << cnt << ')'; vvar = var; vvar << '(' << cnt << ')';
if (!_data.is_key(var)) if (!_data.is_key(var))
break; break;
} }
return cnt; return cnt;
} }
TConfig::TConfig(int which_config, const char* paragraph) : TConfig::TConfig(int which_config, const char* paragraph) :
_paragraph(paragraph), _dirty(FALSE), _ispresent(FALSE) _paragraph(paragraph), _dirty(FALSE), _ispresent(FALSE)
{ {
if (which_config < CONFIG_STUDIO) _file = CONFIG_FILE; if (which_config < CONFIG_STUDIO) _file = CONFIG_FILE;
else else
if (which_config == CONFIG_STUDIO) _file = CONFIG_FILE_STUDIO; if (which_config == CONFIG_STUDIO) _file = CONFIG_FILE_STUDIO;
else else
{ {
_file.format("%s/%s", MainApp()->get_firm_dir(), CONFIG_FILE_DITTA); _file.format("%s/%s", MainApp()->get_firm_dir(), CONFIG_FILE_DITTA);
if (!fexist(_file)) if (!fexist(_file))
{ {
fcopy(CONFIG_FILE_DITTA, _file); fcopy(CONFIG_FILE_DITTA, _file);
if (!fexist(_file)) if (!fexist(_file))
fatal_box("Impossibile aprire la configurazione %s", fatal_box("Impossibile aprire la configurazione %s",
which_config < CONFIG_STUDIO ? "generale" : which_config < CONFIG_STUDIO ? "generale" :
which_config == CONFIG_STUDIO ? "di studio" : "della ditta"); which_config == CONFIG_STUDIO ? "di studio" : "della ditta");
} }
} }
if (_paragraph.empty()) if (_paragraph.empty())
{ {
_paragraph = MainApp()->name(); _paragraph = MainApp()->name();
_paragraph.cut(2); _paragraph.cut(2);
} }
_ispresent = _read_paragraph(); _ispresent = _read_paragraph();
} }
TConfig::~TConfig() TConfig::~TConfig()
{ {
// il distruttore riscrive il file con le modifiche se necessario // il distruttore riscrive il file con le modifiche se necessario
if (_dirty) _write_file(); if (_dirty) _write_file();
} }

View File

@ -1,71 +1,71 @@
#ifndef __CONFIG_H #ifndef __CONFIG_H
#define __CONFIG_H #define __CONFIG_H
#ifndef __ASSOC_H #ifndef __ASSOC_H
#include <assoc.h> #include <assoc.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
class ofstream; class ofstream;
// questo sara' il principale, per ora non c'e' // questo sara' il principale, per ora non c'e'
#define CONFIG_GENERAL -1 #define CONFIG_GENERAL -1
// file parametri studio (uno per studio, per ora e' il principale) // file parametri studio (uno per studio, per ora e' il principale)
#define CONFIG_STUDIO 0 #define CONFIG_STUDIO 0
// file parametri ditta (uno per ditta) // file parametri ditta (uno per ditta)
#define CONFIG_DITTA 1 #define CONFIG_DITTA 1
class TConfig : public TObject class TConfig : public TObject
{ {
TAssoc_array _data; TAssoc_array _data;
TFilename _file; TFilename _file;
bool _dirty, _ispresent; bool _dirty, _ispresent;
TString _paragraph; TString _paragraph;
bool _read_paragraph(); bool _read_paragraph();
void _write_paragraph(ofstream&); void _write_paragraph(ofstream&);
void _write_file(); void _write_file();
void _check_paragraph(const char*); void _check_paragraph(const char*);
public: public:
// ritorna valore di variabile nella sezione corrente o in // ritorna valore di variabile nella sezione corrente o in
// quella specificata; se non c'e' ritorna "" // quella specificata; se non c'e' ritorna ""
// passando index >=0 viene appeso al nome variabile per // passando index >=0 viene appeso al nome variabile per
// implementare un mezzo cazzo di array // implementare un mezzo cazzo di array
TString& get(const char* var, const char* section = NULL, int index = -1); TString& get(const char* var, const char* section = NULL, int index = -1);
// questa ritorna 0 se non c'e', il che e' un po' sfigotto // questa ritorna 0 se non c'e', il che e' un po' sfigotto
long get_long(const char* var, const char* section = NULL, int index = -1); long get_long(const char* var, const char* section = NULL, int index = -1);
// questa ritorna FALSE se non c'e', il che e' ancora piu' sfigotto // questa ritorna FALSE se non c'e', il che e' ancora piu' sfigotto
bool get_bool(const char* var, const char* section = NULL, int index = -1); bool get_bool(const char* var, const char* section = NULL, int index = -1);
// setta variabile nella sezione corrente o specificata // setta variabile nella sezione corrente o specificata
// se force == TRUE crea la sezione/variabile se non esiste; altrimenti // se force == TRUE crea la sezione/variabile se non esiste; altrimenti
// da' errore; ritorna TRUE se la sezione/var c'era, FALSE diversamente // da' errore; ritorna TRUE se la sezione/var c'era, FALSE diversamente
// index come per get() // index come per get()
bool set(const char* var, const char* value, const char* section = NULL, bool set(const char* var, const char* value, const char* section = NULL,
bool force = TRUE, int index = -1); bool force = TRUE, int index = -1);
bool set(const char* var, long value, const char* section = NULL, bool set(const char* var, long value, const char* section = NULL,
bool force = TRUE, int index = -1); bool force = TRUE, int index = -1);
// TRUE se il paragrafo corrente e' nuovo // TRUE se il paragrafo corrente e' nuovo
bool new_paragraph() { return !_ispresent; } bool new_paragraph() { return !_ispresent; }
// items ritorna quanti elementi dell'array nominato sono // items ritorna quanti elementi dell'array nominato sono
// presenti nella sezione indicata // presenti nella sezione indicata
// non si risponde di eventuali "buchi" causati da set() errate // non si risponde di eventuali "buchi" causati da set() errate
word items(const char* var, const char* section); word items(const char* var, const char* section);
// il paragrafo iniziale e' il modulo corrente salvo diversa indicazione // il paragrafo iniziale e' il modulo corrente salvo diversa indicazione
TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL); TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL);
// il distruttore riscrive il file con le modifiche se necessrio, // il distruttore riscrive il file con le modifiche se necessrio,
virtual ~TConfig(); virtual ~TConfig();
}; };
#endif #endif

View File

@ -1,83 +1,83 @@
#ifndef __DEFMASK_H #ifndef __DEFMASK_H
#define __DEFMASK_H #define __DEFMASK_H
/* @M /* @M
Identificativi predefiniti dei controlli di XVT Identificativi predefiniti dei controlli di XVT
*/ */
#define DLG_NULL -1 #define DLG_NULL -1
#define DLG_OK 1 /* TAG del bottone <Conferma> */ #define DLG_OK 1 /* TAG del bottone <Conferma> */
#define DLG_CANCEL 2 /* TAG del bottone <Annulla> */ #define DLG_CANCEL 2 /* TAG del bottone <Annulla> */
#define DLG_PGDN 5 /* TAG del bottone <PgDn> */ #define DLG_PGDN 5 /* TAG del bottone <PgDn> */
#define DLG_PGUP 6 /* TAG del bottone <PgUp> */ #define DLG_PGUP 6 /* TAG del bottone <PgUp> */
#define DLG_PAGE 7 /* TAG del bottone <PgUp/PgDn> */ #define DLG_PAGE 7 /* TAG del bottone <PgUp/PgDn> */
#define DLG_PAGETAGS 8 /* TAG del bottone <Pg n> */ #define DLG_PAGETAGS 8 /* TAG del bottone <Pg n> */
#define DLG_QUIT 9 /* TAG del bottone <Uscita> */ #define DLG_QUIT 9 /* TAG del bottone <Uscita> */
#define DLG_F9 10 /* TAG del bottone <Ricerca> */ #define DLG_F9 10 /* TAG del bottone <Ricerca> */
#define DLG_FIRSTREC 11 /* TAG del bottone <Primo> */ #define DLG_FIRSTREC 11 /* TAG del bottone <Primo> */
#define DLG_PREVREC 12 /* TAG del bottone <Precedente> */ #define DLG_PREVREC 12 /* TAG del bottone <Precedente> */
#define DLG_STOPREC 13 /* TAG del bottone <Stop> */ #define DLG_STOPREC 13 /* TAG del bottone <Stop> */
#define DLG_NEXTREC 14 /* TAG del bottone <Successivo> */ #define DLG_NEXTREC 14 /* TAG del bottone <Successivo> */
#define DLG_LASTREC 15 /* TAG del bottone <Ultimo> */ #define DLG_LASTREC 15 /* TAG del bottone <Ultimo> */
#define DLG_NEWREC 16 /* TAG del bottone <Nuovo> */ #define DLG_NEWREC 16 /* TAG del bottone <Nuovo> */
#define DLG_DELREC 17 /* TAG del bottone <Cancella> */ #define DLG_DELREC 17 /* TAG del bottone <Cancella> */
#define DLG_SAVEREC 18 /* TAG del bottone <Registra> */ #define DLG_SAVEREC 18 /* TAG del bottone <Registra> */
#define DLG_FINDREC 19 /* TAG del bottone <Ricerca> */ #define DLG_FINDREC 19 /* TAG del bottone <Ricerca> */
#define DLG_BAR 20 /* TAG del bottone <Barra> == <Annulla> */ #define DLG_BAR 20 /* TAG del bottone <Barra> == <Annulla> */
#define DLG_SELECT 21 /* TAG del bottone <Selezione> */ #define DLG_SELECT 21 /* TAG del bottone <Selezione> */
#define DLG_EDIT 22 /* TAG del bottone Edit */ #define DLG_EDIT 22 /* TAG del bottone Edit */
#define DLG_LINK 23 /* TAG del bottone Collega (applicazione) */ #define DLG_LINK 23 /* TAG del bottone Collega (applicazione) */
#define DLG_PRINT 24 /* TAG del bottone Stampa */ #define DLG_PRINT 24 /* TAG del bottone Stampa */
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */ #define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
/* @M /* @M
Funzioni di libreria per i validate delle maschere Funzioni di libreria per i validate delle maschere
Nome descrizione Parametri Nome descrizione Parametri
NUM_EXPR espressione numerica espressione NUM_EXPR espressione numerica espressione
STR_EXPR espressione stringa espressione STR_EXPR espressione stringa espressione
NOT_EMPTY_FUNC campo non vuoto NOT_EMPTY_FUNC campo non vuoto
FIXLEN_FUNC lunghezza fissa lunghezza FIXLEN_FUNC lunghezza fissa lunghezza
EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto
DATE_CMP_FUNC compara due date operatore,id.campo con l'altra DATE_CMP_FUNC compara due date operatore,id.campo con l'altra
data data
PI_FUNC controllo part.IVA ???? PI_FUNC controllo part.IVA ????
XTPI_FUNC controllo esteso XTPI_FUNC controllo esteso
part.IVA ???? part.IVA ????
XTZPI_FUNC controllo esteso XTZPI_FUNC controllo esteso
part.IVA anche vuota ???? part.IVA anche vuota ????
CF_FUNC controllo cod.fisc. ???? CF_FUNC controllo cod.fisc. ????
XTCF_FUNC controllo esteso XTCF_FUNC controllo esteso
cod.fisc. ???? cod.fisc. ????
XTZCF_FUNC controllo esteso XTZCF_FUNC controllo esteso
cod.fisc.anche vuoto ???? cod.fisc.anche vuoto ????
MTCHECK_FUNC mese corretto per MTCHECK_FUNC mese corretto per
ditta mensile o ditta mensile o
trimestrale trimestrale
REQIF_FUNC richiesto se immesso REQIF_FUNC richiesto se immesso
un campo della lista n.ro di campi lista di campi... un campo della lista n.ro di campi lista di campi...
*/ */
#define EXPR_FUNC 0 2 #define EXPR_FUNC 0 2
#define EMPTYCOPY_FUNC 1 1 #define EMPTYCOPY_FUNC 1 1
#define PI_FUNC 2 1 #define PI_FUNC 2 1
#define CF_FUNC 3 1 #define CF_FUNC 3 1
#define NOT_EMPTY_FUNC 4 0 #define NOT_EMPTY_FUNC 4 0
#define DATE_CMP_FUNC 5 2 #define DATE_CMP_FUNC 5 2
#define XTPI_FUNC 6 3 #define XTPI_FUNC 6 3
#define XTCF_FUNC 7 4 #define XTCF_FUNC 7 4
#define XTZPI_FUNC 8 3 #define XTZPI_FUNC 8 3
#define XTZCF_FUNC 9 4 #define XTZCF_FUNC 9 4
#define FIXLEN_FUNC 10 1 #define FIXLEN_FUNC 10 1
#define MTCHECK_FUNC 11 0 #define MTCHECK_FUNC 11 0
#define REQIF_FUNC 12 #define REQIF_FUNC 12
#define AUTOEXIT_FUNC 13 #define AUTOEXIT_FUNC 13
#define NUMCALC_FUNC 14 #define NUMCALC_FUNC 14
#define STRCALC_FUNC 15 #define STRCALC_FUNC 15
#define VALEXPR VALIDATE EXPR_FUNC #define VALEXPR VALIDATE EXPR_FUNC
#define NUM_EXPR VALEXPR 0 #define NUM_EXPR VALEXPR 0
#define STR_EXPR VALEXPR 1 #define STR_EXPR VALEXPR 1
#define NUM_CALC VALIDATE NUMCALC_FUNC 1 #define NUM_CALC VALIDATE NUMCALC_FUNC 1
#define STR_CALC VALIDATE STRCALC_FUNC 1 #define STR_CALC VALIDATE STRCALC_FUNC 1
#define THIS_FIELD 0 #define THIS_FIELD 0
/* @END */ /* @END */
#endif // __DEFMASK_H #endif // __DEFMASK_H

View File

@ -1,34 +1,34 @@
// execp.h; trattasi di -*-c++-*- // execp.h; trattasi di -*-c++-*-
// fv 6/10/93 // fv 6/10/93
#ifndef __EXECP_H #ifndef __EXECP_H
#define __EXECP_H #define __EXECP_H
#ifndef __OBJECT_H #ifndef __OBJECT_H
#include <object.h> #include <object.h>
#endif #endif
// Class for external object execution with optional background // Class for external object execution with optional background
// exec under UNIX and swap on EMS under DOS // exec under UNIX and swap on EMS under DOS
// Manages restoring the XVT status // Manages restoring the XVT status
// No command line is implemented; user is supposed to use the // No command line is implemented; user is supposed to use the
// mailbox for this // mailbox for this
class TExternal_app : public TObject class TExternal_app : public TObject
{ {
const char* _path; // app name (must be allocated by user) const char* _path; // app name (must be allocated by user)
int _error; // last error (errno code) int _error; // last error (errno code)
int _exitcode; // last exit code int _exitcode; // last exit code
int _count; // count of calls int _count; // count of calls
public: public:
int run(bool async = FALSE); int run(bool async = FALSE);
int error() { return _error;}; int error() { return _error;};
int exitcode() { return _exitcode;}; int exitcode() { return _exitcode;};
int count() { return _count; }; int count() { return _count; };
TExternal_app(const char* p); TExternal_app(const char* p);
}; };
#endif #endif

View File

@ -1,242 +1,242 @@
#ifndef __EXPR_H #ifndef __EXPR_H
#define __EXPR_H #define __EXPR_H
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#ifndef __REAL_H #ifndef __REAL_H
#include <real.h> #include <real.h>
#endif #endif
#ifndef __ARRAY_H #ifndef __ARRAY_H
#include <array.h> #include <array.h>
#endif #endif
// @T // @T
// @DES I simboli/istruzioni possibili // @DES I simboli/istruzioni possibili
// @T // @T
enum TCodesym { _invalid, _endsym, _comma, _lpar, _rpar, _variable, enum TCodesym { _invalid, _endsym, _comma, _lpar, _rpar, _variable,
_number, _string, _plus, _minus, _multiply, _divide, _number, _string, _plus, _minus, _multiply, _divide,
_chgs, _and, _or, _not, _equal, _match, _noteq, _lt, _gt, _chgs, _and, _or, _not, _equal, _match, _noteq, _lt, _gt,
_lteq, _gteq, _sqrt, _sqr, _exp10, _exp, _log10, _log, _lteq, _gteq, _sqrt, _sqr, _exp10, _exp, _log10, _log,
_sin, _cos, _tan, _left, _right, _pow, _min, _max, _mid, _sin, _cos, _tan, _left, _right, _pow, _min, _max, _mid,
_upper } ; _upper } ;
// @DES I tipi di espressioni definiti // @DES I tipi di espressioni definiti
// @T // @T
enum TTypeexp { _numexpr, _strexpr } ; enum TTypeexp { _numexpr, _strexpr } ;
// @END // @END
// @C // @C
// Classe TValue : public TObject // Classe TValue : public TObject
// @END // @END
class TValue : public TObject class TValue : public TObject
{ {
// @DPRIV // @DPRIV
real _r; // Valore real real _r; // Valore real
TString _s; // Valore in formato stringa TString _s; // Valore in formato stringa
public: public:
// @FPUB // @FPUB
TValue& operator =(const TValue& val) { _s = val._s; _r = val._r; return *this;} // Operatore = tra oggetti TValue TValue& operator =(const TValue& val) { _s = val._s; _r = val._r; return *this;} // Operatore = tra oggetti TValue
const real& number() const { return _r;} // Ritorna il valore numerico const real& number() const { return _r;} // Ritorna il valore numerico
const char* string() const { return (const char*) _s;} // Ritorna il valore come stringa const char* string() const { return (const char*) _s;} // Ritorna il valore come stringa
void set(const real& val) { _r = val; _s = val.string();} // Real void set(const real& val) { _r = val; _s = val.string();} // Real
void set(const char* val) { _s = val; _r = real(val);} // Stringa void set(const char* val) { _s = val; _r = real(val);} // Stringa
// @DES Costruttori. Inizializzano TValue con vari oggetti // @DES Costruttori. Inizializzano TValue con vari oggetti
// @FPUB // @FPUB
TValue(const real& val) { _r = val; _s = val.string();} // Real TValue(const real& val) { _r = val; _s = val.string();} // Real
TValue(const char* val) { _s = val; _r = real(val);} // Stringa TValue(const char* val) { _s = val; _r = real(val);} // Stringa
TValue(const TValue& val) { *this = val; } // Altro TValue TValue(const TValue& val) { *this = val; } // Altro TValue
TValue() { _r = 0.00; _s = ""; } // 0,0 e "" TValue() { _r = 0.00; _s = ""; } // 0,0 e ""
}; };
#ifdef __EXPR_CPP #ifdef __EXPR_CPP
#define extern #define extern
#endif #endif
// @DPUB // @DPUB
extern TValue nulltvalue; extern TValue nulltvalue;
// @END // @END
#undef extern #undef extern
// @C // @C
// Classe TCode : public TObject // Classe TCode : public TObject
// @END // @END
class TCode : public TObject class TCode : public TObject
{ {
// @DPRIV // @DPRIV
TCodesym _sym; // Simbolo-istruzione-codice TCodesym _sym; // Simbolo-istruzione-codice
TValue _val; // Valore TValue _val; // Valore
public: public:
// @FPUB // @FPUB
TCode& operator =(const TCode& b); TCode& operator =(const TCode& b);
void set(TCodesym sym, const TValue& val = nulltvalue) { _sym = sym; _val = val; } // Inizializza simbolo = sym e valore = val void set(TCodesym sym, const TValue& val = nulltvalue) { _sym = sym; _val = val; } // Inizializza simbolo = sym e valore = val
TCodesym getsym() const { return _sym;} // Ritorna il simbolo _sym TCodesym getsym() const { return _sym;} // Ritorna il simbolo _sym
const real& number() const { return _val.number();} // Ritorna il valore _val come real const real& number() const { return _val.number();} // Ritorna il valore _val come real
const char* string() const { return _val.string();} // Ritorna il valore _val come stringa const char* string() const { return _val.string();} // Ritorna il valore _val come stringa
TCode() {set(_invalid);} // Costruttore, inizializza simbolo con "invalid", valore a nullvalue TCode() {set(_invalid);} // Costruttore, inizializza simbolo con "invalid", valore a nullvalue
TCode(TCodesym sym, const TValue& val = nulltvalue) { set(sym, val);} // Costruttore, inizializza simbolo con sym e valore con val TCode(TCodesym sym, const TValue& val = nulltvalue) { set(sym, val);} // Costruttore, inizializza simbolo con sym e valore con val
}; };
// @C // @C
// Classe TCodearray : public TObject // Classe TCodearray : public TObject
// //
// L'array di istruzioni // L'array di istruzioni
// //
// @END // @END
class TCodearray : public TObject class TCodearray : public TObject
{ {
// @DPRIV // @DPRIV
int _last; // Numero di istruzioni int _last; // Numero di istruzioni
int _ip; // Puntatore all'istruzione corrente (Istruction pointer) int _ip; // Puntatore all'istruzione corrente (Istruction pointer)
TArray _rpn; // Array TArray _rpn; // Array
// @END // @END
public: public:
// @FPUB // @FPUB
void clear(); // Cancella contenuto array void clear(); // Cancella contenuto array
void add(TCodesym sym, const TValue& val = nulltvalue); // Aggiunge un'istruzione all'array void add(TCodesym sym, const TValue& val = nulltvalue); // Aggiunge un'istruzione all'array
void begin() { _ip = 0;} // Mette all'inizio il puntatore all'istruzione corrente void begin() { _ip = 0;} // Mette all'inizio il puntatore all'istruzione corrente
TCode& step() { return (TCode&) _rpn[end() ? _ip : _ip++];} // Incrementa istruction pointer TCode& step() { return (TCode&) _rpn[end() ? _ip : _ip++];} // Incrementa istruction pointer
bool end() const { return ((TCode&) _rpn[_ip]).getsym() == _endsym;} // Ritorna vero se _ip ha raggiunto il simbolo di fine codice bool end() const { return ((TCode&) _rpn[_ip]).getsym() == _endsym;} // Ritorna vero se _ip ha raggiunto il simbolo di fine codice
void backtrace(int step = 1) { _ip > step ? _ip -= step : begin(); } void backtrace(int step = 1) { _ip > step ? _ip -= step : begin(); }
TCodearray(int size = 50); // Il costruttore crea un array di 10 elementi TCodearray(int size = 50); // Il costruttore crea un array di 10 elementi
}; };
// @C // @C
// Classe TVar : public TObject // Classe TVar : public TObject
// @END // @END
class TVar : public TObject class TVar : public TObject
{ {
// @DPRIV // @DPRIV
TString _name; // Nome variabile TString _name; // Nome variabile
TValue _val; // Valore TValue _val; // Valore
public: public:
// @DES Operatore = tra vari oggetti // @DES Operatore = tra vari oggetti
// @FPUB // @FPUB
const char* operator =(const char* val) { _val.set(val); return val;} const char* operator =(const char* val) { _val.set(val); return val;}
const real& operator =(const real& val) { _val.set(val); return val;} const real& operator =(const real& val) { _val.set(val); return val;}
TVar& operator =(const TValue& val) { _val = val; return *this;} TVar& operator =(const TValue& val) { _val = val; return *this;}
TVar& operator =(const TVar& var) { _name = var._name ; _val = var._val; return *this;} TVar& operator =(const TVar& var) { _name = var._name ; _val = var._val; return *this;}
void set(const char* name, const TValue& val = nulltvalue) { _name = name ; _val = val;} void set(const char* name, const TValue& val = nulltvalue) { _name = name ; _val = val;}
void setname(const char* name) { _name = name;} // Setta a name il nome della variabile void setname(const char* name) { _name = name;} // Setta a name il nome della variabile
const char* getname() const { return _name;} // Ritorna il nome della variabile const char* getname() const { return _name;} // Ritorna il nome della variabile
operator TValue&() { return _val;} // Ritorna _val (un TValue) operator TValue&() { return _val;} // Ritorna _val (un TValue)
const real& number() const { return _val.number();} // Ritorna il valore real della variabile const real& number() const { return _val.number();} // Ritorna il valore real della variabile
const char* string() const { return _val.string();} // Ritorna il valore stringa della variabile const char* string() const { return _val.string();} // Ritorna il valore stringa della variabile
// @DES Costruttori // @DES Costruttori
// @FPUB // @FPUB
TVar() { _name = ""; _val = nulltvalue;} TVar() { _name = ""; _val = nulltvalue;}
TVar(const char* name, const TValue& val = nulltvalue) { _name = name; _val = val;} TVar(const char* name, const TValue& val = nulltvalue) { _name = name; _val = val;}
TVar(TVar& v) { _name = v._name; _val = v._val;} TVar(TVar& v) { _name = v._name; _val = v._val;}
}; };
// @C // @C
// class TVararray : public TObject // class TVararray : public TObject
// @END // @END
class TVararray : public TObject class TVararray : public TObject
{ {
// @DPRIV // @DPRIV
int _last; // Numero di variabili int _last; // Numero di variabili
TArray _array; // Array TArray _array; // Array
// @END // @END
public: public:
// @FPUB // @FPUB
void clear() { _last = 0; } // Cancella contenuto array void clear() { _last = 0; } // Cancella contenuto array
void add(const TVar& var); // Aggiunge un oggetto TVar void add(const TVar& var); // Aggiunge un oggetto TVar
void add(const char* name, const TValue& val = nulltvalue); // Aggiunge un nome di variabile e il suo valore void add(const char* name, const TValue& val = nulltvalue); // Aggiunge un nome di variabile e il suo valore
const char* varname(int varnum) const { return varnum < _array.items() ? ((TVar&) _array[varnum]).getname() : "";} // Ritorna il nome della variabile di posto varnum const char* varname(int varnum) const { return varnum < _array.items() ? ((TVar&) _array[varnum]).getname() : "";} // Ritorna il nome della variabile di posto varnum
// @DES Metodi di inizializzazione // @DES Metodi di inizializzazione
// @FPUB // @FPUB
void set(const char* varname, const real& val); void set(const char* varname, const real& val);
void set(const char* varname, const char* val); void set(const char* varname, const char* val);
void set(int varnum, const real& val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;} void set(int varnum, const real& val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
void set(int varnum, const char* val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;} void set(int varnum, const char* val) { if (varnum < _array.items()) ((TVar&) _array[varnum]) = val;}
// @DES Metodi di interrogazione // @DES Metodi di interrogazione
// @FPUB // @FPUB
const real& getnum(const char* varname); const real& getnum(const char* varname);
const real& getnum(int varnum); const real& getnum(int varnum);
const char* getstring(const char* varname); const char* getstring(const char* varname);
const char* getstring(int varnum); const char* getstring(int varnum);
int numvar() const { return _last;} // Ritorna il numero di variabili utilizzate int numvar() const { return _last;} // Ritorna il numero di variabili utilizzate
TVararray(int size = 10); TVararray(int size = 10);
}; };
// @C // @C
// class TExpression : public TObject // class TExpression : public TObject
// @END // @END
class TExpression : public TObject class TExpression : public TObject
{ {
// @DPRIV // @DPRIV
TCodearray _code; // Array di codice TCodearray _code; // Array di codice
TVararray _var; // Array di variabili TVararray _var; // Array di variabili
TValue _val; // Valore dell'espressione TValue _val; // Valore dell'espressione
bool _dirty; // Vero se l'espressione e' stata modificata bool _dirty; // Vero se l'espressione e' stata modificata
TTypeexp _type; // Tipo dell'espressione TTypeexp _type; // Tipo dell'espressione
TString _original; // stringa originale TString _original; // stringa originale
// @END // @END
// @FPROT // @FPROT
protected: protected:
void eval(); // Valuta l'espressione void eval(); // Valuta l'espressione
TCodesym __gettoken(bool reduct = FALSE); TCodesym __gettoken(bool reduct = FALSE);
TCodesym __factor(TCodesym startsym); TCodesym __factor(TCodesym startsym);
TCodesym __term(TCodesym startsym); TCodesym __term(TCodesym startsym);
TCodesym __expression(TCodesym startsym); TCodesym __expression(TCodesym startsym);
virtual void print_on(ostream& out) const ; virtual void print_on(ostream& out) const ;
bool compile(const char* expression, TTypeexp type); // Compila l'espressione bool compile(const char* expression, TTypeexp type); // Compila l'espressione
public: public:
// @FPUB // @FPUB
operator const real&(); // Ritorna il valore real dell'espressione operator const real&(); // Ritorna il valore real dell'espressione
operator const char*(); // Ritorna il valore come stringa operator const char*(); // Ritorna il valore come stringa
operator bool(); // Ritorna il valore come booleano operator bool(); // Ritorna il valore come booleano
// @DES Metodi di interrogazione // @DES Metodi di interrogazione
// @FPUB // @FPUB
// Ritorna il nome della variabile di posto varnum // Ritorna il nome della variabile di posto varnum
const char* varname(int varnum) const { return _var.varname(varnum); } const char* varname(int varnum) const { return _var.varname(varnum); }
// Ritorna il numero di variabili nell'espressione // Ritorna il numero di variabili nell'espressione
int numvar() const { return _var.numvar(); } int numvar() const { return _var.numvar(); }
const TTypeexp type() const { return _type; } const TTypeexp type() const { return _type; }
TCodearray& code() const { return (TCodearray&)_code; } TCodearray& code() const { return (TCodearray&)_code; }
const TVararray& vars() const { return _var; } const TVararray& vars() const { return _var; }
// @DES Metodi di inizializzazione // @DES Metodi di inizializzazione
// @FPUB // @FPUB
void setvar(const char* varname, const real& val); void setvar(const char* varname, const real& val);
void setvar(int varnum, const real& val); void setvar(int varnum, const real& val);
void setvar(const char* varname, const char* val); void setvar(const char* varname, const char* val);
void setvar(int varnum, const char* val); void setvar(int varnum, const char* val);
void set_type(const TTypeexp type) { _type = type; } void set_type(const TTypeexp type) { _type = type; }
bool set(const char* expression, TTypeexp type = _numexpr); bool set(const char* expression, TTypeexp type = _numexpr);
TExpression(const char* expression, TTypeexp type = _numexpr); TExpression(const char* expression, TTypeexp type = _numexpr);
TExpression(TTypeexp type = _numexpr); TExpression(TTypeexp type = _numexpr);
}; };
#endif // __EXPR_H #endif // __EXPR_H

View File

@ -1,225 +1,225 @@
#ifndef __EXTCTYPE_H #ifndef __EXTCTYPE_H
#define __EXTCTYPE_H #define __EXTCTYPE_H
#ifndef __STDTTYPES_H #ifndef __STDTTYPES_H
#include <stdtypes.h> #include <stdtypes.h>
#endif #endif
/* @M */ /* @M */
#ifdef __GNUC__ #ifdef __GNUC__
#define __PACKED__ __attribute__ ((packed)) #define __PACKED__ __attribute__ ((packed))
#define __ALIGNED__ __attribute__ ((aligned(2))) #define __ALIGNED__ __attribute__ ((aligned(2)))
#define __PACK_1__ #define __PACK_1__
#else #else
#define __PACKED__ #define __PACKED__
#define __ALIGNED__ #define __ALIGNED__
#endif #endif
/* @DES Tipi e macro da programmi C */ /* @DES Tipi e macro da programmi C */
/* @M */ /* @M */
#define MaxFields 100 #define MaxFields 100
#define MKFields 10 #define MKFields 10
#define MaxKeys 8 #define MaxKeys 8
#define NORDIR 0 #define NORDIR 0
#define COMDIR 1 #define COMDIR 1
#define MaxArray 80 #define MaxArray 80
#define BPageLen 512 #define BPageLen 512
#define PHLen 20 #define PHLen 20
#define AreaLen (BPageLen - PHLen) #define AreaLen (BPageLen - PHLen)
#define PDLen 28 #define PDLen 28
#define FHRLen 32 #define FHRLen 32
#define MaxPD ((BPageLen - FHRLen) / PDLen) #define MaxPD ((BPageLen - FHRLen) / PDLen)
#define NOFLDS 10 #define NOFLDS 10
#define MOSTMEM 51200 #define MOSTMEM 51200
#define LEASTMEM 10240 #define LEASTMEM 10240
#if !defined(__STDIO_H) && !defined(_INC_STDIO) #if !defined(__STDIO_H) && !defined(_INC_STDIO)
#include <stdio.h> #include <stdio.h>
#endif #endif
/* @END */ /* @END */
/* @T */ /* @T */
typedef long TrDate; typedef long TrDate;
typedef char PathSt[42]; typedef char PathSt[42];
typedef char Str80[82]; typedef char Str80[82];
typedef long RecNoType; typedef long RecNoType;
typedef char *RecType; typedef char *RecType;
typedef char FieldName[12] ; typedef char FieldName[12] ;
typedef char TKey[MaxArray + 2]; typedef char TKey[MaxArray + 2];
typedef char AreaKey[AreaLen]; typedef char AreaKey[AreaLen];
typedef char DataArea[BPageLen]; typedef char DataArea[BPageLen];
typedef struct { typedef struct {
char nome[52] __PACKED__ ; char nome[52] __PACKED__ ;
char indirizzo[32] __PACKED__ ; char indirizzo[32] __PACKED__ ;
char citta[32] __PACKED__ ; char citta[32] __PACKED__ ;
char cap[6] __PACKED__ ; char cap[6] __PACKED__ ;
char partiva[12] __PACKED__ ; char partiva[12] __PACKED__ ;
char codfisc[18] __PACKED__ ; char codfisc[18] __PACKED__ ;
short numero __PACKED__ ; short numero __PACKED__ ;
short tab0[20] __PACKED__ ; short tab0[20] __PACKED__ ;
long tab1 __PACKED__ ; long tab1 __PACKED__ ;
char nome1[52] __PACKED__ ; char nome1[52] __PACKED__ ;
char indirizzo1[32] __PACKED__ ; char indirizzo1[32] __PACKED__ ;
char citta1[32] __PACKED__ ; char citta1[32] __PACKED__ ;
char cap1[6] __PACKED__ ; char cap1[6] __PACKED__ ;
char partiva1[12] __PACKED__ ; char partiva1[12] __PACKED__ ;
char codfisc1[18] __PACKED__ ; char codfisc1[18] __PACKED__ ;
} TDitta; } TDitta;
typedef struct { typedef struct {
int F; int F;
FILE* Fd; FILE* Fd;
int IOR; int IOR;
int LenRec; int LenRec;
int BaseFil; int BaseFil;
unsigned LockMode; unsigned LockMode;
RecNoType lpos; RecNoType lpos;
PathSt name; PathSt name;
} SecDef ; } SecDef ;
typedef struct typedef struct
{ {
char SysName[42] __PACKED__ ; char SysName[42] __PACKED__ ;
RecNoType EOD __PACKED__ ; RecNoType EOD __PACKED__ ;
RecNoType EOX __PACKED__ ; RecNoType EOX __PACKED__ ;
UINT16 LenR __PACKED__ ; UINT16 LenR __PACKED__ ;
RecNoType Flags __PACKED__ ; RecNoType Flags __PACKED__ ;
char Des[42] __PACKED__ ; char Des[42] __PACKED__ ;
char FCalc[32] __PACKED__ ; char FCalc[32] __PACKED__ ;
char GenPrompt[32] __PACKED__ ; char GenPrompt[32] __PACKED__ ;
} FileDes; } FileDes;
typedef struct typedef struct
{ {
FieldName Name __PACKED__ ; FieldName Name __PACKED__ ;
byte TypeF __PACKED__; byte TypeF __PACKED__;
byte Len __PACKED__ ; byte Len __PACKED__ ;
byte Dec __PACKED__ ; byte Dec __PACKED__ ;
#ifdef __PACK_1__ #ifdef __PACK_1__
byte junk __PACKED__ ; byte junk __PACKED__ ;
#endif #endif
UINT16 RecOff __PACKED__ ; UINT16 RecOff __PACKED__ ;
} RecFieldDes ; } RecFieldDes ;
typedef struct typedef struct
{ {
word DupKeys __ALIGNED__ ; word DupKeys __ALIGNED__ ;
byte NkFields __ALIGNED__ ; byte NkFields __ALIGNED__ ;
byte FieldSeq[MKFields] __PACKED__ ; byte FieldSeq[MKFields] __PACKED__ ;
byte FromCh[MKFields] __PACKED__ ; byte FromCh[MKFields] __PACKED__ ;
byte ToCh[MKFields] __PACKED__ ; byte ToCh[MKFields] __PACKED__ ;
} KeyDes ; } KeyDes ;
typedef struct typedef struct
{ {
INT16 NFields __PACKED__ ; INT16 NFields __PACKED__ ;
RecFieldDes Fd[MaxFields] __PACKED__ ; RecFieldDes Fd[MaxFields] __PACKED__ ;
byte SortFd[MaxFields] __PACKED__ ; byte SortFd[MaxFields] __PACKED__ ;
INT16 NKeys __PACKED__ ; INT16 NKeys __PACKED__ ;
KeyDes Ky[MaxKeys] __PACKED__ ; KeyDes Ky[MaxKeys] __PACKED__ ;
} RecDes ; } RecDes ;
typedef struct typedef struct
{ {
RecNoType RootBlock __PACKED__ ; RecNoType RootBlock __PACKED__ ;
INT16 KeyLen __PACKED__ ; INT16 KeyLen __PACKED__ ;
bool DupKeys __PACKED__ ; bool DupKeys __PACKED__ ;
#ifdef __PACK_1__ #ifdef __PACK_1__
byte junk; byte junk;
#endif #endif
INT16 NKNode __PACKED__ ; INT16 NKNode __PACKED__ ;
INT16 MaxKNode __PACKED__ ; INT16 MaxKNode __PACKED__ ;
INT16 MinKNode __PACKED__ ; INT16 MinKNode __PACKED__ ;
RecNoType PEOD __PACKED__ ; RecNoType PEOD __PACKED__ ;
RecNoType PEOX __PACKED__ ; RecNoType PEOX __PACKED__ ;
INT16 Flags[3] __PACKED__ ; INT16 Flags[3] __PACKED__ ;
} PD ; } PD ;
typedef PD PathsArray[MaxPD]; typedef PD PathsArray[MaxPD];
typedef struct typedef struct
{ {
byte TPage __PACKED__ ; byte TPage __PACKED__ ;
#ifdef __PACK_1__ #ifdef __PACK_1__
byte junk; byte junk;
#endif #endif
INT16 PathNumber __PACKED__ ; INT16 PathNumber __PACKED__ ;
INT16 Flags __PACKED__ ; INT16 Flags __PACKED__ ;
RecNoType Father __PACKED__ ; RecNoType Father __PACKED__ ;
RecNoType Prev __PACKED__ ; RecNoType Prev __PACKED__ ;
RecNoType Next __PACKED__ ; RecNoType Next __PACKED__ ;
INT16 NKey __PACKED__ ; INT16 NKey __PACKED__ ;
} PHR ; } PHR ;
typedef struct typedef struct
{ {
RecNoType FFBlock __PACKED__ ; RecNoType FFBlock __PACKED__ ;
RecNoType CABlock __PACKED__ ; RecNoType CABlock __PACKED__ ;
RecNoType NBEOX __PACKED__ ; RecNoType NBEOX __PACKED__ ;
RecNoType NBEOD __PACKED__ ; RecNoType NBEOD __PACKED__ ;
INT16 Filler[3] __PACKED__ ; INT16 Filler[3] __PACKED__ ;
INT16 Flags[4] __PACKED__ ; INT16 Flags[4] __PACKED__ ;
INT16 DPN __PACKED__ ; INT16 DPN __PACKED__ ;
} FHR ; } FHR ;
typedef struct typedef struct
{ {
FHR Header __PACKED__ ; FHR Header __PACKED__ ;
PathsArray Paths __PACKED__ ; PathsArray Paths __PACKED__ ;
} CA ; } CA ;
typedef union typedef union
{ {
struct struct
{ {
PHR PageHeader __PACKED__ ; PHR PageHeader __PACKED__ ;
AreaKey AreaForKey __PACKED__ ; AreaKey AreaForKey __PACKED__ ;
} PA __PACKED__ ; } PA __PACKED__ ;
CA CtrlArea __PACKED__ ; CA CtrlArea __PACKED__ ;
DataArea BuffIO __PACKED__ ; DataArea BuffIO __PACKED__ ;
} Page; } Page;
typedef struct typedef struct
{ {
SecDef Fil; SecDef Fil;
FHR FHead; FHR FHead;
INT16 PN; INT16 PN;
PathsArray Base; PathsArray Base;
TKey Key; TKey Key;
RecNoType Ind; RecNoType Ind;
INT16 Pos; INT16 Pos;
RecNoType CurPag; RecNoType CurPag;
} FilCtrl ; } FilCtrl ;
typedef struct typedef struct
{ {
SecDef f; SecDef f;
FilCtrl i; FilCtrl i;
FileDes *d; FileDes *d;
RecDes *r; RecDes *r;
RecNoType RecNo; RecNoType RecNo;
INT16 ln; INT16 ln;
INT16 ft; INT16 ft;
} isdef ; } isdef ;
typedef isdef* isfdptr; typedef isdef* isfdptr;
struct s_prm { struct s_prm {
int rc_len; int rc_len;
struct { struct {
int f_pos; int f_pos;
int f_len; int f_len;
char ad; char ad;
} s_fld [NOFLDS]; } s_fld [NOFLDS];
}; };
/* @END */ /* @END */
#endif // __EXTCTYPE_H #endif // __EXTCTYPE_H

View File

@ -426,9 +426,9 @@ update_keydef (int key, const char *desc)
_rec->Ky[key].FieldSeq[n] += MaxFields; _rec->Ky[key].FieldSeq[n] += MaxFields;
else if (sym == _number) else if (sym == _number)
{ {
_rec->Ky[key].FromCh[n] = inst.number ().integer () - 1; _rec->Ky[key].FromCh[n] = (int)inst.number().integer() - 1;
inst = c.step (); inst = c.step ();
_rec->Ky[key].ToCh[n] = _rec->Ky[key].FromCh[n] + inst.number ().integer () - 1; _rec->Ky[key].ToCh[n] = _rec->Ky[key].FromCh[n] + (int)inst.number ().integer () - 1;
inst = c.step (); inst = c.step ();
} }
else else

View File

@ -1,203 +1,203 @@
// $Id: mailbox.cpp,v 1.1.1.1 1994-08-12 10:52:01 alex Exp $ // $Id: mailbox.cpp,v 1.2 1994-09-19 09:49:41 villa Exp $
#include <stdlib.h> #include <stdlib.h>
#include <fstream.h> #include <fstream.h>
#include <applicat.h> #include <applicat.h>
#include <mailbox.h> #include <mailbox.h>
#include <utility.h> #include <utility.h>
#if XVT_OS == XVT_OS_DOS || XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_DOS || XVT_OS == XVT_OS_WIN
#include <io.h> #include <io.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
#define DEF_MSGS_CAPACITY 50 #define DEF_MSGS_CAPACITY 50
#define MAX_TXT_LEN 200 #define MAX_TXT_LEN 200
TMessage::TMessage(const char* to, const char* sub, const char* text, TMessage::TMessage(const char* to, const char* sub, const char* text,
const char* from) const char* from)
{ {
_to = to; _subject = sub; _to = to; _subject = sub;
_text = text; _text = text;
_from = (from == NULL ? MainApp()->name() : from); _from = (from == NULL ? MainApp()->name() : from);
_flags = 0x00; _number = -1; _flags = 0x00; _number = -1;
} }
void TMessage::send() void TMessage::send()
{ {
TMailbox mail; TMailbox mail;
mail.send(*this); mail.send(*this);
} }
void TMailbox::reread() void TMailbox::reread()
// reads new messages from mailbox; // reads new messages from mailbox;
// create messages, put messages in _msgs array in cronological order // create messages, put messages in _msgs array in cronological order
{ {
char buf[MAX_TXT_LEN]; char buf[MAX_TXT_LEN];
ifstream mbox(_path); ifstream mbox(_path);
// skip read messages // skip read messages
mbox.seekg(_lastpos); mbox.seekg(_lastpos);
while (mbox.getline(buf, MAX_TXT_LEN -1) != NULL) while (mbox.getline(buf, MAX_TXT_LEN -1) != NULL)
{ {
// process new message // process new message
TMessage* tmnew = new TMessage (NULL, NULL, NULL, buf); TMessage* tmnew = new TMessage (NULL, NULL, NULL, buf);
// lines are <from> <subject> <body> // lines are <from> <subject> <body>
mbox.getline(buf, MAX_TXT_LEN -1); mbox.getline(buf, MAX_TXT_LEN -1);
tmnew->subject(buf); tmnew->subject(buf);
mbox.getline(buf, MAX_TXT_LEN -1); mbox.getline(buf, MAX_TXT_LEN -1);
tmnew->body(buf); tmnew->body(buf);
_msgs.add(tmnew); _msgs.add(tmnew);
tmnew->number(_msgs.items()); tmnew->number(_msgs.items());
n_new++; n_new++;
} }
_lastpos = mbox.tellg(); _lastpos = mbox.tellg();
} }
TMessage* TMailbox::next_unread() TMessage* TMailbox::next_unread()
{ {
// returns next unread message; // returns next unread message;
if (_cnt == _msgs.items()) if (_cnt == _msgs.items())
return NULL; return NULL;
while(this->get(_cnt)->isread()) while(this->get(_cnt)->isread())
{ {
_cnt++; _cnt++;
if (_cnt == _msgs.items()) if (_cnt == _msgs.items())
return NULL; return NULL;
} }
n_new --; n_new --;
return this->get(_lastread = _cnt); return this->get(_lastread = _cnt);
} }
TMessage* TMailbox::next_read() TMessage* TMailbox::next_read()
{ {
// next read/unread message // next read/unread message
if (_cnt == _msgs.items()) if (_cnt == _msgs.items())
return NULL; return NULL;
if (!(this->get(_cnt)->isread())) if (!(this->get(_cnt)->isread()))
n_new--; n_new--;
return this->get(_cnt++); return this->get(_cnt++);
} }
TMessage* TMailbox::next(bool read) TMessage* TMailbox::next(bool read)
{ {
// next message, default unread // next message, default unread
TMessage* m = read ? next_read() : next_unread(); TMessage* m = read ? next_read() : next_unread();
if (m) if (m)
m->setread(); m->setread();
return m; return m;
} }
TMessage* TMailbox::next_s(char* s, bool read) TMessage* TMailbox::next_s(char* s, bool read)
{ {
// next message with matching subject // next message with matching subject
for (;;) for (;;)
{ {
if (_cnt == _msgs.items()) if (_cnt == _msgs.items())
return NULL; return NULL;
if (strcmp(this->get(_cnt)->subject(), s) == 0) if (strcmp(this->get(_cnt)->subject(), s) == 0)
{ {
if (read) break; if (read) break;
else else
{ {
if (!(this->get(_cnt)->isread())) break; if (!(this->get(_cnt)->isread())) break;
} }
} }
_cnt++; _cnt++;
} }
this->get(_cnt)->setread(); this->get(_cnt)->setread();
if (!read) n_new--; if (!read) n_new--;
return this->get(_cnt); return this->get(_cnt);
} }
TMessage* TMailbox::next_f(char* f, bool read) TMessage* TMailbox::next_f(char* f, bool read)
{ {
// next message with matching sender // next message with matching sender
for (;;) for (;;)
{ {
if (_cnt == _msgs.items()) if (_cnt == _msgs.items())
return NULL; return NULL;
if (strcmp(this->get(_cnt)->from(), f) == 0) if (strcmp(this->get(_cnt)->from(), f) == 0)
{ {
if (read) break; if (read) break;
else { if (!(this->get(_cnt)->isread())) break; } else { if (!(this->get(_cnt)->isread())) break; }
} }
_cnt++; _cnt++;
} }
this->get(_cnt)->setread(); this->get(_cnt)->setread();
if (!read) n_new--; if (!read) n_new--;
return this->get(_cnt); return this->get(_cnt);
} }
void TMailbox::send(TMessage& m) void TMailbox::send(TMessage& m)
{ {
CHECK(m.from() != NULL && m.to() != NULL && CHECK(m.from() != NULL && m.to() != NULL &&
(m.subject() != NULL || m.body() != NULL), (m.subject() != NULL || m.body() != NULL),
"can't send partially empty message"); "can't send partially empty message");
// strcpy(to_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR")); // strcpy(to_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
TFilename to_path; to_path.tempdir(); TFilename to_path; to_path.tempdir();
to_path << "/" << m.to() << ".mbx"; to_path << "/" << m.to() << ".mbx";
ofstream fto(to_path, ios::app); ofstream fto(to_path, ios::app);
CHECK(fto.good(),"send: trouble opening mailbox file"); CHECK(fto.good(),"send: trouble opening mailbox file");
fto << m.from() << '\n' fto << m.from() << '\n'
<< m.subject() << '\n' << m.subject() << '\n'
<< m.body() << '\n'; << m.body() << '\n';
fto.close(); fto.close();
} }
void TMailbox::sendcmd(int argc, char* argv[], char* to) void TMailbox::sendcmd(int argc, char* argv[], char* to)
{ {
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED"); CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
for (int i = 0; i < argc; i++) for (int i = 0; i < argc; i++)
{ {
// parse argv[i] // parse argv[i]
// create new message // create new message
// send it out // send it out
} }
} }
char* TMailbox::readcmd(char*) char* TMailbox::readcmd(char*)
{ {
// filters all messages to recipient and adds to to_path // filters all messages to recipient and adds to to_path
CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED"); CHECK(0,"MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED");
// TMessage* m; // TMessage* m;
return "NOT YET IMPLEMENTED"; return "NOT YET IMPLEMENTED";
} }
TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY) TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY)
{ {
if (appname == NULL) if (appname == NULL)
appname = MainApp()->name(); // myself; must be global appname = MainApp()->name(); // myself; must be global
_path.tempdir(); _path.tempdir();
// strcpy(_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR")); // strcpy(_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
_path << "/" << appname << ".mbx"; _path << "/" << appname << ".mbx";
_lastread =0; _lastpos = 0l; _lastread =0; _lastpos = 0l;
n_new = 0; n_new = 0;
this->reread(); this->reread();
restart(); restart();
} }
TMailbox::~TMailbox() TMailbox::~TMailbox()
{ {
TMessage* m; TMessage* m;
// scan all remaining messages and erase mailbox // scan all remaining messages and erase mailbox
reread(); reread();
if (access(_path,0) == 0) if (access(_path,0) == 0)
remove(_path); remove(_path);
// send unread messages to myself // send unread messages to myself
while((m = next()) != NULL) while((m = next()) != NULL)
{ {
m->to(MainApp()->name()); m->to(MainApp()->name());
send(*m); send(*m);
} }
} }

View File

@ -1,123 +1,123 @@
// $Id: mailbox.h,v 1.1.1.1 1994-08-12 10:52:01 alex Exp $ // $Id: mailbox.h,v 1.2 1994-09-19 09:49:42 villa Exp $
/* si', trattasi di -*-c++-*- */ /* si', trattasi di -*-c++-*- */
// Mailbox.h // Mailbox.h
// Message passing between applications and command lines // Message passing between applications and command lines
#ifndef __MAILBOX_H #ifndef __MAILBOX_H
#define __MAILBOX_H #define __MAILBOX_H
#ifndef __ARRAY_H #ifndef __ARRAY_H
#include <array.h> #include <array.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
// TMessage flags // TMessage flags
#define MSG_READ (0x01) #define MSG_READ (0x01)
class TMessage : public TObject class TMessage : public TObject
// basic message // basic message
{ {
TString _from; TString _from;
TString _to; TString _to;
TString _subject; TString _subject;
TString _text; TString _text;
byte _flags; byte _flags;
int _number; int _number;
friend class TMailbox; friend class TMailbox;
void setread() { _flags |= MSG_READ; } void setread() { _flags |= MSG_READ; }
bool isread() { return _flags & MSG_READ; } bool isread() { return _flags & MSG_READ; }
int number(int n = -1) int number(int n = -1)
{ return (n == -1 ? _number : (_number = n)); } { return (n == -1 ? _number : (_number = n)); }
public: public:
const char* from(const char* f = NULL) // get-set sender const char* from(const char* f = NULL) // get-set sender
{ return f == NULL ? _from : (_from = f); } { return f == NULL ? _from : (_from = f); }
const char* to (const char* f = NULL) // get-set recipient const char* to (const char* f = NULL) // get-set recipient
{ return f == NULL ? _to : (_to = f); } { return f == NULL ? _to : (_to = f); }
const char* subject(const char* f = NULL) // get-set subject const char* subject(const char* f = NULL) // get-set subject
{ return f == NULL ? _subject : (_subject = f); } { return f == NULL ? _subject : (_subject = f); }
const char* body(const char* f = NULL) // get-set body const char* body(const char* f = NULL) // get-set body
{ return f == NULL ? _text : (_text = f); } { return f == NULL ? _text : (_text = f); }
void send(); void send();
TMessage(const char* to, const char* sub, const char* text, TMessage(const char* to, const char* sub, const char* text,
const char* from = NULL); const char* from = NULL);
}; };
class TMailbox : public TObject class TMailbox : public TObject
{ {
TFilename _path; TFilename _path;
TArray _msgs; TArray _msgs;
int _lastread, n_new; int _lastread, n_new;
long _lastpos; long _lastpos;
int _cnt; int _cnt;
protected: protected:
void reread(); void reread();
TMessage* next_read(); TMessage* next_read();
TMessage* next_unread(); TMessage* next_unread();
public: public:
int check() // return int check() // return
{ reread(); return n_new; } // n. of messages waiting { reread(); return n_new; } // n. of messages waiting
void restart() { _cnt = 0;} // reinitialize read phase void restart() { _cnt = 0;} // reinitialize read phase
int items() // n. of read+unread messages int items() // n. of read+unread messages
{ return _msgs.items(); } // in mailbox { return _msgs.items(); } // in mailbox
TMessage* next(bool read = FALSE); // get next message; if TMessage* next(bool read = FALSE); // get next message; if
// TRUE passed, get read mess. too // TRUE passed, get read mess. too
TMessage* next_s(char* s, bool read = FALSE); // next w/ matching subject TMessage* next_s(char* s, bool read = FALSE); // next w/ matching subject
TMessage* next_f(char* f, bool read = FALSE); // next w/ matching sender TMessage* next_f(char* f, bool read = FALSE); // next w/ matching sender
void send(TMessage& m); // send a message void send(TMessage& m); // send a message
void sendcmd(int argc, char* argv[], void sendcmd(int argc, char* argv[],
char* to); // transform commandline args char* to); // transform commandline args
// in mail messages // in mail messages
// NOT IMPLEMENTED // NOT IMPLEMENTED
char* readcmd(char* to = NULL); // transform mailbox in char* readcmd(char* to = NULL); // transform mailbox in
// cmdline parms for calling // cmdline parms for calling
// non_compliant applications // non_compliant applications
// NOT IMPLEMENTED // NOT IMPLEMENTED
TMessage* get(int n) // nth message TMessage* get(int n) // nth message
{ return (TMessage*)_msgs.objptr(n); } { return (TMessage*)_msgs.objptr(n); }
TMailbox::TMailbox(const char* appname = NULL); TMailbox::TMailbox(const char* appname = NULL);
virtual ~TMailbox(); virtual ~TMailbox();
}; };
// instead of using commandline args directly, user posts // instead of using commandline args directly, user posts
// messages to application, then calls it without arguments // messages to application, then calls it without arguments
// If the application is called by the user with command_line // If the application is called by the user with command_line
// arguments, sendcmd parses them and translates to messages // arguments, sendcmd parses them and translates to messages
// according to the following rules: // according to the following rules:
// //
// from is "cmdline" // from is "cmdline"
// //
// subject comes from arguments of type -opt=value // subject comes from arguments of type -opt=value
// (opt becomes subject and value becomes body) // (opt becomes subject and value becomes body)
// //
// args like -opt="val, val, val" create // args like -opt="val, val, val" create
// one message for each val, with the same subject=opt // one message for each val, with the same subject=opt
// //
// -opt arg creates subject=opt and empty body // -opt arg creates subject=opt and empty body
// //
// one-word arguments create a message with "null" subject // one-word arguments create a message with "null" subject
// //
// A mailbox should be member of applicat and sendcmd should be // A mailbox should be member of applicat and sendcmd should be
// called automatically upon startup // called automatically upon startup
// Non compliant applications (which do not use mailbox) can be // Non compliant applications (which do not use mailbox) can be
// called consistently by sending messages, // called consistently by sending messages,
// appending TMailbox::readcmd(appname) to // appending TMailbox::readcmd(appname) to
// their name and doing an exec() // their name and doing an exec()
#endif #endif

View File

@ -1,85 +1,85 @@
#define __OBJECT_CPP #define __OBJECT_CPP
#include <object.h> #include <object.h>
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Object // Object
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
const char* TObject::class_name() const const char* TObject::class_name() const
{ {
return "Object"; return "Object";
} }
word TObject::class_id() const word TObject::class_id() const
{ {
return CLASS_OBJECT; return CLASS_OBJECT;
} }
bool TObject::ok() const bool TObject::ok() const
{ {
return TRUE; return TRUE;
} }
TObject* TObject::dup() const TObject* TObject::dup() const
{ {
CHECK(FALSE, "Can't duplicate an Object"); CHECK(FALSE, "Can't duplicate an Object");
return 0L; return 0L;
} }
void TObject::print_on(ostream& out) const void TObject::print_on(ostream& out) const
{ {
out << class_name(); out << class_name();
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Error Object // Error Object
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
const char* TError_Object::class_name() const const char* TError_Object::class_name() const
{ {
return "Error_Object"; return "Error_Object";
} }
word TError_Object::class_id() const word TError_Object::class_id() const
{ {
return CLASS_ERROR; return CLASS_ERROR;
} }
bool TError_Object::ok() const bool TError_Object::ok() const
{ {
return FALSE; return FALSE;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Sortable // Sortable
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
const char* TSortable::class_name() const const char* TSortable::class_name() const
{ {
return "Sortable"; return "Sortable";
} }
word TSortable::class_id() const word TSortable::class_id() const
{ {
return CLASS_SORTABLE; return CLASS_SORTABLE;
} }

View File

@ -1,150 +1,150 @@
#ifndef __OBJECT_H #ifndef __OBJECT_H
#define __OBJECT_H #define __OBJECT_H
#ifndef __IOSTREAM_H #ifndef __IOSTREAM_H
#include <iostream.h> #include <iostream.h>
#endif #endif
#ifndef __CLASSES_H #ifndef __CLASSES_H
#include <classes.h> #include <classes.h>
#endif #endif
#ifndef __STDTYPES_H #ifndef __STDTYPES_H
#include <stdtypes.h> #include <stdtypes.h>
#endif #endif
#ifndef __CHECKS_H #ifndef __CHECKS_H
#include <checks.h> #include <checks.h>
#endif #endif
// @C // @C
// Classe Object // Classe Object
// @END // @END
// @N // @N
// Base class for all object hierarchy // Base class for all object hierarchy
// @END // @END
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Object // Object
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
class TObject class TObject
{ {
public: public:
// @FPUB // @FPUB
virtual ~TObject() {} virtual ~TObject() {}
virtual const char* class_name() const; virtual const char* class_name() const;
virtual word class_id() const; virtual word class_id() const;
virtual bool ok() const; virtual bool ok() const;
virtual TObject* dup() const; virtual TObject* dup() const;
virtual void print_on(ostream& out) const; virtual void print_on(ostream& out) const;
virtual void read_from(istream&) {} virtual void read_from(istream&) {}
virtual word hash() const { return 0; } virtual word hash() const { return 0; }
}; };
// @C // @C
// Classe TErrorObject // Classe TErrorObject
// @END // @END
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Error Object // Error Object
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
class TError_Object : public TObject class TError_Object : public TObject
{ {
public: public:
// @FPUB // @FPUB
virtual const char* class_name() const; virtual const char* class_name() const;
virtual word class_id() const; virtual word class_id() const;
virtual bool ok() const; virtual bool ok() const;
}; };
// @C // @C
// Classe TSortable // Classe TSortable
// @END // @END
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Error Object // Error Object
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
class TSortable : public TObject class TSortable : public TObject
{ {
public: public:
// @FPUB // @FPUB
virtual int compare(const TSortable& s) const pure; virtual int compare(const TSortable& s) const pure;
virtual const char* class_name() const; virtual const char* class_name() const;
virtual word class_id() const; virtual word class_id() const;
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// inline functions // inline functions
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// @FIN // @FIN
inline ostream& operator <<(ostream& out, const TObject& obj) inline ostream& operator <<(ostream& out, const TObject& obj)
{ {
obj.print_on(out); obj.print_on(out);
return out; return out;
} }
// @FIN // @FIN
inline istream& operator >>(istream& in, TObject& obj) inline istream& operator >>(istream& in, TObject& obj)
{ {
obj.read_from(in); obj.read_from(in);
CHECK(obj.ok(), "Can't read an Object from a stream"); CHECK(obj.ok(), "Can't read an Object from a stream");
return in; return in;
} }
inline bool operator ==(const TSortable& a, const TSortable& b) inline bool operator ==(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res == 0 || res == UNDEFINED; return res == 0 || res == UNDEFINED;
} }
inline bool operator >(const TSortable& a, const TSortable& b) inline bool operator >(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res > 0 || res == UNDEFINED; return res > 0 || res == UNDEFINED;
} }
inline bool operator <(const TSortable& a, const TSortable& b) inline bool operator <(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res < 0 || res == UNDEFINED; return res < 0 || res == UNDEFINED;
} }
inline bool operator >=(const TSortable& a, const TSortable& b) inline bool operator >=(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res >= 0 || res == UNDEFINED; return res >= 0 || res == UNDEFINED;
} }
inline bool operator <=(const TSortable& a, const TSortable& b) inline bool operator <=(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res <= 0 || res == UNDEFINED; return res <= 0 || res == UNDEFINED;
} }
inline bool operator !=(const TSortable& a, const TSortable& b) inline bool operator !=(const TSortable& a, const TSortable& b)
{ {
int res = a.compare(b); int res = a.compare(b);
return res != 0 && res != UNDEFINED; return res != 0 && res != UNDEFINED;
} }
#ifdef __OBJECT_CPP #ifdef __OBJECT_CPP
#define extern #define extern
#endif #endif
// @DPUB // @DPUB
extern TError_Object error; extern TError_Object error;
// @END // @END
#undef extern #undef extern
#endif // __OBJECT_H #endif // __OBJECT_H

View File

@ -1,15 +1,15 @@
#ifndef _FLD_OCC_H #ifndef _FLD_OCC_H
#define _FLD_OCC_H #define _FLD_OCC_H
#define OCC_CFPI "CFPI"
#define OCC_RAGSOC "RAGSOC"
#define OCC_INDIR "INDIR"
#define OCC_CIV "CIV"
#define OCC_STATO "STATO"
#define OCC_COM "COM"
#define OCC_CAP "CAP"
#define OCC_DNASC "DNASC"
#define OCC_STATONASC "STATONASC"
#define OCC_COMNASC "COMNASC"
#endif #define OCC_CFPI "CFPI"
#define OCC_RAGSOC "RAGSOC"
#define OCC_INDIR "INDIR"
#define OCC_CIV "CIV"
#define OCC_STATO "STATO"
#define OCC_COM "COM"
#define OCC_CAP "CAP"
#define OCC_DNASC "DNASC"
#define OCC_STATONASC "STATONASC"
#define OCC_COMNASC "COMNASC"
#endif

View File

@ -1,63 +1,63 @@
#ifndef __PREFIX_H #ifndef __PREFIX_H
#define __PREFIX_H #define __PREFIX_H
#ifndef __EXTCTYPE_H #ifndef __EXTCTYPE_H
#include <extctype.h> #include <extctype.h>
#endif #endif
#ifndef __FILES_H #ifndef __FILES_H
#include <files.h> #include <files.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
// @C // @C
// class TPrefix : public TObject // class TPrefix : public TObject
// @END // @END
class TPrefix : public TObject class TPrefix : public TObject
{ {
// @DPRIV // @DPRIV
TString _prefix; TString _prefix;
int* _dirfl; int* _dirfl;
int* _recfl; int* _recfl;
SecDef* _fdir; SecDef* _fdir;
SecDef* _rdir; SecDef* _rdir;
bool test(const char* s) const ; bool test(const char* s) const ;
void put(); void put();
public: public:
// @FPUB // @FPUB
void set(const char* name = NULL, bool force = FALSE, TFilelock mode = _manulock); void set(const char* name = NULL, bool force = FALSE, TFilelock mode = _manulock);
bool test(long codditta) const; bool test(long codditta) const;
long get_codditta() const ; long get_codditta() const ;
bool set_codditta(long codditta, bool force = FALSE); bool set_codditta(long codditta, bool force = FALSE);
const char* name() const { return _prefix;} const char* name() const { return _prefix;}
TPrefix(); TPrefix();
virtual ~TPrefix(); virtual ~TPrefix();
}; };
const char* firm2dir(long codditta); const char* firm2dir(long codditta);
#ifdef __PREFIX_CPP #ifdef __PREFIX_CPP
#define extern #define extern
#endif #endif
// @DPUB // @DPUB
extern TPrefix* prefhndl extern TPrefix* prefhndl
// @END // @END
#ifdef __PREFIX_CPP #ifdef __PREFIX_CPP
= NULL ; = NULL ;
#undef extern #undef extern
#else #else
; ;
#endif #endif
#endif // __PREFIX_H #endif // __PREFIX_H

View File

@ -14,8 +14,8 @@
#include <mask.h> #include <mask.h>
#include <utility.h> #include <utility.h>
#include <viswin.h> #include <viswin.h>
#include <printapp.h>
#include <extcdecl.h> #include <extcdecl.h>
#include <applicat.h>
#include <printer.h> #include <printer.h>
#include <execp.h> #include <execp.h>

View File

@ -14,17 +14,17 @@ HIDDEN real __tmp_real;
HIDDEN char __string[80]; HIDDEN char __string[80];
const real ZERO (0.0); const real ZERO (0.0);
real ::real () real::real ()
{ {
dzero (ptr ()); dzero (ptr ());
} }
real ::real (const real & b) real::real (const real & b)
{ {
dcpy (ptr (), b.ptr ()); dcpy (ptr (), b.ptr ());
} }
real ::real (double a) real::real (double a)
{ {
dftodr (ptr (), a, 9); // Round the number (1.0 is NOT 0.999999999) dftodr (ptr (), a, 9); // Round the number (1.0 is NOT 0.999999999)
@ -32,7 +32,7 @@ real ::real (double a)
} }
char *real ::eng2ita (char *s) char *real::eng2ita (char *s)
{ {
if (s) if (s)
{ {
@ -43,7 +43,7 @@ char *real ::eng2ita (char *s)
return s; return s;
} }
char *real ::ita2eng (const char *s) char *real::ita2eng (const char *s)
{ {
int j = 0; int j = 0;
if (s) if (s)
@ -66,7 +66,7 @@ char *real ::ita2eng (const char *s)
return __string; return __string;
} }
bool real ::is_real (const char *s) bool real::is_real (const char *s)
{ {
bool ok = FALSE; bool ok = FALSE;
if (s) if (s)
@ -79,7 +79,7 @@ bool real ::is_real (const char *s)
return ok; return ok;
} }
real ::real (const char *s) real::real (const char *s)
{ {
if (s) if (s)
while (*s == ' ') while (*s == ' ')
@ -91,46 +91,46 @@ real ::real (const char *s)
dzero (ptr ()); dzero (ptr ());
} }
real & real ::operator = (const real & b) real & real::operator = (const real & b)
{ {
dcpy (ptr (), b.ptr ()); dcpy (ptr (), b.ptr ());
return *this; return *this;
} }
real & real ::operator = (double a) real & real::operator = (double a)
{ {
const real n (a); const real n (a);
operator = (n); operator = (n);
return *this; return *this;
} }
real & real ::operator += (const real & b) real & real::operator += (const real & b)
{ {
dadd (ptr (), ptr (), b.ptr ()); dadd (ptr (), ptr (), b.ptr ());
return *this; return *this;
} }
real & real ::operator += (double a) real & real::operator += (double a)
{ {
__tmp_real = *this; __tmp_real = *this;
adddfd (ptr (), __tmp_real.ptr (), a); adddfd (ptr (), __tmp_real.ptr (), a);
return *this; return *this;
} }
real & real ::operator -= (const real & b) real & real::operator -= (const real & b)
{ {
__tmp_real = *this; __tmp_real = *this;
dsub (ptr (), __tmp_real.ptr (), b.ptr ()); dsub (ptr (), __tmp_real.ptr (), b.ptr ());
return *this; return *this;
} }
real & real ::operator *= (const real & b) real & real::operator *= (const real & b)
{ {
dmul (ptr (), ptr (), b.ptr ()); dmul (ptr (), ptr (), b.ptr ());
return *this; return *this;
} }
real & real ::operator /= (const real & b) real & real::operator /= (const real & b)
{ {
const DEC *dst = ddiv (ptr (), ptr (), b.ptr ()); const DEC *dst = ddiv (ptr (), ptr (), b.ptr ());
@ -145,35 +145,35 @@ real & real ::operator /= (const real & b)
return *this; return *this;
} }
TObject *real :: dup () const TObject *real:: dup () const
{ {
return new real (*this); return new real (*this);
} }
bool real ::is_zero () const bool real::is_zero () const
{ {
return diszero (ptr ()); return diszero (ptr ());
} }
int real ::sign () const int real::sign () const
{ {
return dsign (ptr ()); return dsign (ptr ());
} }
real real ::operator - () const real real::operator - () const
{ {
real n; real n;
dchgs (n.ptr (), ptr ()); dchgs (n.ptr (), ptr ());
return n; return n;
} }
int real ::integer () const long real::integer () const
{ {
return dtoi (ptr ()); return (long)dtodf(ptr ());
} }
// Certified 91% // Certified 91%
char *real ::string (int len, int dec, char pad) const char *real::string (int len, int dec, char pad) const
{ {
__tmp_real = *this; __tmp_real = *this;
if (dec != UNDEFINED) if (dec != UNDEFINED)

View File

@ -48,7 +48,7 @@ public:
int precision() ; int precision() ;
bool is_zero() const; bool is_zero() const;
int sign() const; int sign() const;
int integer() const; // operator int is too dangerous long integer() const; // operator int is too dangerous
real& round(int prec = 0) ; real& round(int prec = 0) ;
real& trunc(int prec = 0) ; real& trunc(int prec = 0) ;

View File

@ -1,36 +1,36 @@
#ifndef __RECTYPES_H #ifndef __RECTYPES_H
#define __RECTYPES_H #define __RECTYPES_H
#define NOERR 0 #define NOERR 0
#define FIELDERR -1 #define FIELDERR -1
// @T // @T
typedef long TRecnotype; typedef long TRecnotype;
// @END // @END
enum TFilelock { _excllock = 0x100, _autolock = 0x200, enum TFilelock { _excllock = 0x100, _autolock = 0x200,
_manulock = 0x400}; _manulock = 0x400};
enum TReclock { _unlock = 0x1000, _nolock = 0x2000, _lock = 0x4000, enum TReclock { _unlock = 0x1000, _nolock = 0x2000, _lock = 0x4000,
_testandlock = (int)0x8000} ; _testandlock = (int)0x8000} ;
enum TRecstates { _valid, _deleted}; enum TRecstates { _valid, _deleted};
enum TDirtype { _nordir, _comdir } ; enum TDirtype { _nordir, _comdir } ;
enum TDirop { _nordirop, _sysdirop }; enum TDirop { _nordirop, _sysdirop };
enum TFieldtypes { _nullfld, _alfafld, _intfld, _longfld, _realfld, enum TFieldtypes { _nullfld, _alfafld, _intfld, _longfld, _realfld,
_datefld, _wordfld, _charfld, _boolfld , _intzerofld, _longzerofld} ; _datefld, _wordfld, _charfld, _boolfld , _intzerofld, _longzerofld} ;
enum TIsamop { _isfirst = 0x0, _islast = 0x1, _isnext= 0x2, enum TIsamop { _isfirst = 0x0, _islast = 0x1, _isnext= 0x2,
_isprev = 0x4, _iscurr = 0x8, _isequal = 0x10, _isprev = 0x4, _iscurr = 0x8, _isequal = 0x10,
_isgreat = 0x20, _isgteq = 0x40, _isnextn = 0x100, _isgreat = 0x20, _isgteq = 0x40, _isnextn = 0x100,
_isprevn = 0x200} ; _isprevn = 0x200} ;
enum TIsamerr { _iseof = 201, _isbof = 202, _isfileovf = 203, enum TIsamerr { _iseof = 201, _isbof = 202, _isfileovf = 203,
_iskeynotfound = 204, _isemptyfile = 205, _iskeynotfound = 204, _isemptyfile = 205,
_isdupkey = 206, _isnocurkey = 207, _isdupkey = 206, _isnocurkey = 207,
_iskeyrangeerr = 211, _iskeyerr = 212, _iskeyrangeerr = 211, _iskeyerr = 212,
_iskeylenerr = 214, _ispatherr = 216, _ispathfull = 217, _iskeylenerr = 214, _ispatherr = 216, _ispathfull = 217,
_isnrecerr = 218, _isfilefull = 219, _isnotopen = 220, _isnrecerr = 218, _isfilefull = 219, _isnotopen = 220,
_isnotcurr = 221, _isalropen = 222, _isdeadlock = 223, _isnotcurr = 221, _isalropen = 222, _isdeadlock = 223,
_isreinsert = 224, _islocked = 225} ; _isreinsert = 224, _islocked = 225} ;
typedef long TRecnotype; typedef long TRecnotype;
#endif // __RECTYPES_H #endif // __RECTYPES_H

View File

@ -1,142 +1,142 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <utility.h> #include <utility.h>
#include <scanner.h> #include <scanner.h>
HIDDEN const char* strlwr (const char* str) HIDDEN const char* strlwr (const char* str)
{ {
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str); for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
*s = '\0'; *s = '\0';
return __tmp_string; return __tmp_string;
} }
inline bool string_start(char c) inline bool string_start(char c)
{ return c == '"' || c == '\'' || c == '{' || c == '\''; } { return c == '"' || c == '\'' || c == '{' || c == '\''; }
inline char match(char c) inline char match(char c)
{ return (c == '{') ? '}' : c; } { return (c == '{') ? '}' : c; }
TScanner::TScanner(const char* filename) TScanner::TScanner(const char* filename)
: ifstream(strlwr(filename)), _token(128), _key(2), _pushed(FALSE), _line(0) : ifstream(strlwr(filename)), _token(128), _key(2), _pushed(FALSE), _line(0)
{ {
if (bad()) fatal_box("Impossibile aprire %s", filename); if (bad()) fatal_box("Impossibile aprire %s", filename);
} }
const TString& TScanner::pop() const TString& TScanner::pop()
{ {
if (!_pushed) do if (!_pushed) do
{ {
_token.read_from((ifstream&) *this); _token.read_from((ifstream&) *this);
if (_token[0] == '/' && _token[1] == '/') if (_token[0] == '/' && _token[1] == '/')
{ {
line(); line();
_token.cut(0); _token.cut(0);
} }
} while (_token.empty() && good()); } while (_token.empty() && good());
_pushed = FALSE; _pushed = FALSE;
_token.upper(); _token.upper();
_key = _token.left(2); _key = _token.left(2);
return _token; return _token;
} }
TString& TScanner::line(char eol) TString& TScanner::line(char eol)
{ {
do do
{ {
if (!_pushed) _token = ""; if (!_pushed) _token = "";
getline(__tmp_string, sizeof(__tmp_string), eol); getline(__tmp_string, sizeof(__tmp_string), eol);
_line++; _line++;
_token << __tmp_string; _token << __tmp_string;
_token.trim(); _token.trim();
} while (_token.empty() && good()); } while (_token.empty() && good());
_pushed = FALSE; _pushed = FALSE;
return _token; return _token;
} }
const TString& TScanner::string() const TString& TScanner::string()
{ {
if (!_pushed) if (!_pushed)
{ {
char c; char c;
while (isspace(c = get())); while (isspace(c = get()));
if (string_start(c)) if (string_start(c))
{ {
getline(__tmp_string, sizeof(__tmp_string), match(c)); getline(__tmp_string, sizeof(__tmp_string), match(c));
_token = __tmp_string; _token = __tmp_string;
} }
else else
{ {
error_box("Stringa non trovata: riga ignorata"); error_box("Stringa non trovata: riga ignorata");
_token.cut(0); _token.cut(0);
} }
} }
_pushed = FALSE; _pushed = FALSE;
return _token; return _token;
} }
void TScanner::rectangle(RCT& rect) void TScanner::rectangle(RCT& rect)
{ {
rect.left = integer(); rect.left = integer();
rect.top = integer(); rect.top = integer();
rect.right = integer(); rect.right = integer();
rect.bottom = integer(); rect.bottom = integer();
} }
int TScanner::integer() int TScanner::integer()
{ {
int i = atoi(pop()); int i = atoi(pop());
if (i == 0 && !isdigit(_token[0])) push(); if (i == 0 && !isdigit(_token[0])) push();
return i; return i;
} }
double TScanner::number() double TScanner::number()
{ {
double d = atof(pop()); double d = atof(pop());
if (d == 0.0 && !isdigit(_token[0])) push(); if (d == 0.0 && !isdigit(_token[0])) push();
return d; return d;
} }
const TString& TScanner::operand() const TString& TScanner::operand()
{ {
if (!_pushed) if (!_pushed)
{ {
char c; char c;
while (isspace(c = get())); while (isspace(c = get()));
putback(c); putback(c);
if (string_start(c)) if (string_start(c))
return string(); return string();
else else
return pop(); return pop();
} }
_pushed = FALSE; _pushed = FALSE;
return _token; return _token;
} }
void TScanner::push(const char* s) void TScanner::push(const char* s)
{ {
CHECK(!_pushed, "You are pushing back two values to the parser"); CHECK(!_pushed, "You are pushing back two values to the parser");
if (s != NULL) _token = s; if (s != NULL) _token = s;
_pushed = TRUE; _pushed = TRUE;
} }
bool TScanner::paragraph(const char* name) bool TScanner::paragraph(const char* name)
{ {
TString80 p; TString80 p;
p << '[' << name << ']'; p << '[' << name << ']';
seekg(0L); seekg(0L);
while (line().not_empty()) while (line().not_empty())
if (token() == p) return TRUE; if (token() == p) return TRUE;
return FALSE; return FALSE;
} }

View File

@ -1,65 +1,65 @@
#ifndef __SCANNER_H #ifndef __SCANNER_H
#define __SCANNER_H #define __SCANNER_H
#ifndef __FSTREAM_H #ifndef __FSTREAM_H
#include <fstream.h> #include <fstream.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#ifndef XVT_R3_API #ifndef XVT_R3_API
#ifndef XVT_INCL_TYPE #ifndef XVT_INCL_TYPE
// @T // @T
typedef struct s_rct { /* mathematical rectangle */ typedef struct s_rct { /* mathematical rectangle */
short top; /* top coordinate */ short top; /* top coordinate */
short left; /* left coordinate */ short left; /* left coordinate */
short bottom; /* bottom coordinate */ short bottom; /* bottom coordinate */
short right; /* right coordinate */ short right; /* right coordinate */
} RCT; } RCT;
#endif #endif
#else #else
#ifndef XVT_INCL_XVTTYPE #ifndef XVT_INCL_XVTTYPE
typedef struct s_rct { /* mathematical rectangle */ typedef struct s_rct { /* mathematical rectangle */
short top; /* top coordinate */ short top; /* top coordinate */
short left; /* left coordinate */ short left; /* left coordinate */
short bottom; /* bottom coordinate */ short bottom; /* bottom coordinate */
short right; /* right coordinate */ short right; /* right coordinate */
} RCT; } RCT;
#endif #endif
#endif #endif
// @C // @C
class TScanner : private ifstream class TScanner : private ifstream
{ {
// @DPRIV // @DPRIV
TString _token, _key; TString _token, _key;
bool _pushed; bool _pushed;
word _line; word _line;
public: public:
// @FPUB // @FPUB
TScanner(const char* filename); TScanner(const char* filename);
const TString& pop(); const TString& pop();
const TString& key() const { return _key; } const TString& key() const { return _key; }
const TString& popkey() { pop(); return key(); } const TString& popkey() { pop(); return key(); }
const TString& string(); const TString& string();
TString& line(char eol = '\n'); TString& line(char eol = '\n');
const TString& equal() { return line('='); } const TString& equal() { return line('='); }
void rectangle(RCT& rect); void rectangle(RCT& rect);
int integer(); int integer();
double number(); double number();
const TString& operand(); const TString& operand();
bool paragraph(const char* name); bool paragraph(const char* name);
bool ok() { return good(); } bool ok() { return good(); }
void push(const char* tok = NULL); void push(const char* tok = NULL);
const TString& token() const { return _token; } const TString& token() const { return _token; }
word linenum() { return _line; } word linenum() { return _line; }
}; };
#endif // __SCANNER_H #endif // __SCANNER_H

View File

@ -1,163 +1,163 @@
#ifndef __SHEET_H #ifndef __SHEET_H
#define __SHEET_H #define __SHEET_H
#ifndef __ARRAY_H #ifndef __ARRAY_H
#include <array.h> #include <array.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#ifndef __WINDOW_H #ifndef __WINDOW_H
#include <window.h> #include <window.h>
#endif #endif
#ifndef __RELATION_H #ifndef __RELATION_H
class TCursor; class TCursor;
#endif #endif
#ifndef __MASKFLD_H #ifndef __MASKFLD_H
class TEdit_field; class TEdit_field;
#endif #endif
// @C // @C
// class TSheet : public TScroll_window // class TSheet : public TScroll_window
// @END // @END
class TSheet : public TScroll_window class TSheet : public TScroll_window
{ {
// @DPRIV // @DPRIV
enum { MAX_BUT = 8, MAX_COL = 128 }; enum { MAX_BUT = 8, MAX_COL = 128 };
TArray _page; TArray _page;
byte _columns; byte _columns;
byte _size[MAX_COL]; byte _size[MAX_COL];
long _curr, _last_update; long _curr, _last_update;
short _visible_rows; short _visible_rows;
bool _checkable; bool _checkable;
bool _check_enabled; bool _check_enabled;
TBit_array _checked; TBit_array _checked;
WINDOW _button[MAX_BUT]; WINDOW _button[MAX_BUT];
KEY _key[MAX_BUT]; KEY _key[MAX_BUT];
byte _buttonmask; byte _buttonmask;
protected: protected:
// @FPROT // @FPROT
bool head_on() const { return _columns > 1; } bool head_on() const { return _columns > 1; }
bool buttons_on() const { return *_button != NULL_WIN; } bool buttons_on() const { return *_button != NULL_WIN; }
short visible_rows() const { return _visible_rows; } short visible_rows() const { return _visible_rows; }
virtual short reserved_rows() const; virtual short reserved_rows() const;
void build_page(long first = -1); void build_page(long first = -1);
PNT log2dev(long x, long y) const; PNT log2dev(long x, long y) const;
virtual void handler(WINDOW win, EVENT* ep); virtual void handler(WINDOW win, EVENT* ep);
virtual bool on_key(KEY); virtual bool on_key(KEY);
virtual void update(); virtual void update();
virtual void open(); virtual void open();
void set_first(long n); void set_first(long n);
bool is_visible(long n) const { return n >= first() && n < first()+visible_rows(); } bool is_visible(long n) const { return n >= first() && n < first()+visible_rows(); }
int width() const; int width() const;
int row_to_page(long n) const; int row_to_page(long n) const;
int row_to_win(long n) const; int row_to_win(long n) const;
long first() const { return origin().y; } long first() const { return origin().y; }
bool update_row(long n); bool update_row(long n);
void invert_row(long n); void invert_row(long n);
void set_row(const TToken_string& row, byte n); void set_row(const TToken_string& row, byte n);
virtual void repos_buttons() const; virtual void repos_buttons() const;
virtual void page_build(long first, byte num) pure; virtual void page_build(long first, byte num) pure;
void print(); void print();
public: public:
// @FPUB // @FPUB
TSheet(short x, short y, short dx, short dy, TSheet(short x, short y, short dx, short dy,
const char* title, const char* head, byte buttons = 0, const char* title, const char* head, byte buttons = 0,
long first = 0L, WINDOW parent = NULL_WIN); long first = 0L, WINDOW parent = NULL_WIN);
void add_button(short id, const char* caption, KEY key = K_ESC); void add_button(short id, const char* caption, KEY key = K_ESC);
virtual long items() const pure; virtual long items() const pure;
virtual TToken_string& row(long s = -1); virtual TToken_string& row(long s = -1);
long selected() const { return _curr; } long selected() const { return _curr; }
void select(long n); void select(long n);
bool checked(long n) const { return _checked[n]; } bool checked(long n) const { return _checked[n]; }
void check(long n, bool on = TRUE); void check(long n, bool on = TRUE);
void uncheck(long n) { check(n, FALSE); } void uncheck(long n) { check(n, FALSE); }
void enable_check(bool yn = TRUE) { _check_enabled = yn; } void enable_check(bool yn = TRUE) { _check_enabled = yn; }
void disable_check() { enable_check(FALSE); } void disable_check() { enable_check(FALSE); }
bool one_checked() const { return _checked.first_one() != -1; } bool one_checked() const { return _checked.first_one() != -1; }
long checked() const { return _checked.ones(); } long checked() const { return _checked.ones(); }
}; };
class TArray_sheet : public TSheet class TArray_sheet : public TSheet
{ {
TArray _data; TArray _data;
protected: protected:
virtual void page_build(long first, byte num); virtual void page_build(long first, byte num);
TArray& data() const { return (TArray&)_data; } TArray& data() const { return (TArray&)_data; }
TToken_string& data(long n) const { return (TToken_string&)_data[(int)n]; } TToken_string& data(long n) const { return (TToken_string&)_data[(int)n]; }
public: public:
TArray_sheet(short x, short y, short dx, short dy, const char* caption, TArray_sheet(short x, short y, short dx, short dy, const char* caption,
const char* head, byte buttons = 0, WINDOW parent = NULL_WIN); const char* head, byte buttons = 0, WINDOW parent = NULL_WIN);
virtual long items() const { return _data.items(); } virtual long items() const { return _data.items(); }
long add(const TToken_string& s); long add(const TToken_string& s);
long insert(const TToken_string& s, long n); long insert(const TToken_string& s, long n);
virtual TToken_string& row(long s = -1) { return (s < 0) ? data(selected()) : data(s); } virtual TToken_string& row(long s = -1) { return (s < 0) ? data(selected()) : data(s); }
bool destroy(int i = -1) { uncheck(-1); return _data.destroy(i, TRUE); } bool destroy(int i = -1) { uncheck(-1); return _data.destroy(i, TRUE); }
}; };
class TCursor_sheet : public TSheet class TCursor_sheet : public TSheet
{ {
TArray _fields; // Array of TRecfield TArray _fields; // Array of TRecfield
long _records; long _records;
protected: protected:
TCursor* _cursor; TCursor* _cursor;
virtual void page_build(long first, byte rows); virtual void page_build(long first, byte rows);
public: public:
TCursor_sheet(TCursor* cursor, const char* fields, TCursor_sheet(TCursor* cursor, const char* fields,
const char* title, const char* head, byte buttons = 0); const char* title, const char* head, byte buttons = 0);
virtual ~TCursor_sheet() {} virtual ~TCursor_sheet() {}
virtual long items() const { return _records; } virtual long items() const { return _records; }
virtual KEY run(); virtual KEY run();
}; };
class TBrowse_sheet : public TCursor_sheet class TBrowse_sheet : public TCursor_sheet
{ {
TEdit_field* const _field; TEdit_field* const _field;
protected: protected:
virtual void handler(WINDOW win, EVENT* ep); virtual void handler(WINDOW win, EVENT* ep);
virtual short reserved_rows() const; virtual short reserved_rows() const;
virtual void repos_buttons() const; virtual void repos_buttons() const;
virtual bool on_key(KEY k); virtual bool on_key(KEY k);
TEdit_field& field() { return *_field; } TEdit_field& field() { return *_field; }
public: public:
TBrowse_sheet(TCursor* cursor, const char* fields, TBrowse_sheet(TCursor* cursor, const char* fields,
const char* title, const char* head, byte buttons, const char* title, const char* head, byte buttons,
TEdit_field* f, TToken_string* siblings = NULL); TEdit_field* f, TToken_string* siblings = NULL);
virtual ~TBrowse_sheet() {} virtual ~TBrowse_sheet() {}
virtual KEY run(); virtual KEY run();
}; };
#endif #endif

View File

@ -1,64 +1,64 @@
#ifndef __STDTYPES_H #ifndef __STDTYPES_H
#define __STDTYPES_H #define __STDTYPES_H
#ifndef XVT_INCL_OS #ifndef XVT_INCL_OS
#include <xvt_os.h> #include <xvt_os.h>
#endif #endif
// @M // @M
#define pure =0 #define pure =0
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
#define HIDDEN static #define HIDDEN static
#define EOL -1 #define EOL -1
#define NOERR 0 #define NOERR 0
// @END // @END
// @T // @T
typedef unsigned char UINT8; typedef unsigned char UINT8;
#ifdef M_I386 #ifdef M_I386
typedef unsigned short UINT16; typedef unsigned short UINT16;
#else #else
typedef unsigned int UINT16; typedef unsigned int UINT16;
#endif #endif
typedef unsigned long UINT32; typedef unsigned long UINT32;
typedef char INT8; typedef char INT8;
#ifdef M_I386 #ifdef M_I386
typedef short INT16; typedef short INT16;
#else #else
typedef int INT16; typedef int INT16;
#endif #endif
typedef long INT32; typedef long INT32;
typedef UINT8 bool; typedef UINT8 bool;
typedef UINT16 word; typedef UINT16 word;
typedef UINT32 dword; typedef UINT32 dword;
typedef UINT8 byte; typedef UINT8 byte;
typedef UINT16 KEY; typedef UINT16 KEY;
#define UNDEFINED -32767 #define UNDEFINED -32767
#undef _SVID #undef _SVID
// @END // @END
// @FPUB // @FPUB
void init_global_vars(); void init_global_vars();
void free_global_vars(); void free_global_vars();
extern void* operator new(unsigned); extern void* operator new(unsigned);
extern void operator delete(void*); extern void operator delete(void*);
// @END // @END
#endif // __STDTYPES_H #endif // __STDTYPES_H

View File

@ -1,118 +1,118 @@
/* actually -*-c++-*- */ /* actually -*-c++-*- */
#ifndef __TEXTFILE_H #ifndef __TEXTFILE_H
#define __TEXTFILE_H #define __TEXTFILE_H
#ifndef __ARRAY_H #ifndef __ARRAY_H
#include <array.h> #include <array.h>
#endif #endif
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#ifndef __STDIO_H #ifndef __STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifndef __WINDOW_H #ifndef __WINDOW_H
#include <window.h> #include <window.h>
#endif #endif
enum direction {up, down, updown}; enum direction {up, down, updown};
enum style {normal = 0, bold = FS_BOLD, italic = FS_ITALIC, underlined = 0x0004, enum style {normal = 0, bold = FS_BOLD, italic = FS_ITALIC, underlined = 0x0004,
overstrike = 0x0008, smallcaps = 0x0010}; overstrike = 0x0008, smallcaps = 0x0010};
class TTextfile: public TObject class TTextfile: public TObject
{ {
enum {DEFAULT_PAGESIZE = 128}; enum {DEFAULT_PAGESIZE = 128};
TArray _page; TArray _page;
long _page_start; long _page_start;
long _page_end; long _page_end;
long _page_size; long _page_size;
long _lines; long _lines;
long _cur_line; long _cur_line;
TFilename _filename; TFilename _filename;
TFilename _indname; TFilename _indname;
FILE* _index; FILE* _index;
FILE* _instr; FILE* _instr;
direction _direction; direction _direction;
TToken_string _line; TToken_string _line;
long _styles[256]; long _styles[256];
int _item; int _item;
TArray _hotspots; TArray _hotspots;
TArray _spots; TArray _spots;
bool _dirty; bool _dirty;
bool _isopen; bool _isopen;
bool _istemp; bool _istemp;
bool _accept; bool _accept;
void _read_page(long line); void _read_page(long line);
bool _in_page(long l) bool _in_page(long l)
{ return l >= _page_start && l < _page_end; } { return l >= _page_start && l < _page_end; }
// void _parse_style(long j); // void _parse_style(long j);
style _trans_style(char c); style _trans_style(char c);
public: public:
long lines() { return _lines; } long lines() { return _lines; }
bool changed() { return _dirty; } bool changed() { return _dirty; }
// line() ritorna la stringa di caratteri senza formattazione // line() ritorna la stringa di caratteri senza formattazione
const char* line(long row, long column = 0); const char* line(long row, long column = 0);
bool append(const char* l); bool append(const char* l);
// chide tutti i files per poter copiare o eseguire operazioni // chide tutti i files per poter copiare o eseguire operazioni
// dopo close() non si puo' piu' fare nulla // dopo close() non si puo' piu' fare nulla
void close(); void close();
void print(); void print();
// chiude l'aggiunta di nuove linee // chiude l'aggiunta di nuove linee
void freeze() { _accept = FALSE; } void freeze() { _accept = FALSE; }
bool frozen() { return !_accept; } bool frozen() { return !_accept; }
// per leggere il testo formattato, si fa prima read_line, poi // per leggere il testo formattato, si fa prima read_line, poi
// si prende un pezzo per volta // si prende un pezzo per volta
// style() ritorna lo stile (vedi enum) del piece() corrente // style() ritorna lo stile (vedi enum) del piece() corrente
// se chiamata con parametri ritorna lo stile del carattere alla // se chiamata con parametri ritorna lo stile del carattere alla
// posizione data // posizione data
// get_background() e get_foreground() ritornano il suo colore di bg e fg // get_background() e get_foreground() ritornano il suo colore di bg e fg
// piece() ritorna il pezzo di linea successivo con stile e colore // piece() ritorna il pezzo di linea successivo con stile e colore
// invarianti, o NULL quando non ce n'e' piu' // invarianti, o NULL quando non ce n'e' piu'
// bello, vero? // bello, vero?
void read_line(long j, long b = 0, bool pg = TRUE); void read_line(long j, long b = 0, bool pg = TRUE);
const char* piece(); const char* piece();
int get_style(int pos = -1); int get_style(int pos = -1);
char get_background(int pos = -1); char get_background(int pos = -1);
char get_foreground(int pos = -1); char get_foreground(int pos = -1);
long get_attribute(int pos = -1); long get_attribute(int pos = -1);
// ritorna la parola alla posizione indicata // ritorna la parola alla posizione indicata
const char* word_at(long x, long y); const char* word_at(long x, long y);
// TBI ritorna il pezzo di testo da x a y // TBI ritorna il pezzo di testo da x a y
// allochera' un altro TText che deve essere disfatto dall'utente // allochera' un altro TText che deve essere disfatto dall'utente
TTextfile* section(TPoint& from, TPoint& to) { return this; } TTextfile* section(TPoint& from, TPoint& to) { return this; }
const char* name() { return (const char*)_filename; } const char* name() { return (const char*)_filename; }
// scrive il testo (non formattato) su file, da punto a punto // scrive il testo (non formattato) su file, da punto a punto
// (tutto per default) // (tutto per default)
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL); bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
// disfa tutto e svuota il file // disfa tutto e svuota il file
void destroy(); void destroy();
// hypertext cazzuls // hypertext cazzuls
// le si dice il colore che devono avere i punti selezionabili; // le si dice il colore che devono avere i punti selezionabili;
// ritorna l'array in cui vengono messi gli hotspots relativi alla // ritorna l'array in cui vengono messi gli hotspots relativi alla
// pagina in memoria (come TToken_string con x|y|text) // pagina in memoria (come TToken_string con x|y|text)
void set_hotspots(char fg, char bg = 'w'); void set_hotspots(char fg, char bg = 'w');
TArray& hotspots() { return _spots; } TArray& hotspots() { return _spots; }
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE, TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
direction preferred = updown); direction preferred = updown);
virtual ~TTextfile(); virtual ~TTextfile();
}; };
#endif #endif

View File

@ -1,69 +1,69 @@
#ifndef __URLDEFID_H #ifndef __URLDEFID_H
#define __URLDEFID_H #define __URLDEFID_H
#ifndef __DEFMASK_H #ifndef __DEFMASK_H
#include <defmask.h> #include <defmask.h>
#endif #endif
/* @M /* @M
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
*/ */
#define TASK_MENUBAR 10000 #define TASK_MENUBAR 10000
#define ALT_MENUBAR 11000 #define ALT_MENUBAR 11000
#define MENU_BAR(i) (10000+i) #define MENU_BAR(i) (10000+i)
#define BAR_ITEM(i) (5000+100*i) #define BAR_ITEM(i) (5000+100*i)
#define MENU_ITEM(i) (30000+i) #define MENU_ITEM(i) (30000+i)
#define MENU_FILE 1100 #define MENU_FILE 1100
#define MENU_EDIT 1200 #define MENU_EDIT 1200
#define MENU_ALT_EDIT 1300 #define MENU_ALT_EDIT 1300
#define M_EDIT_INSERT 1201 #define M_EDIT_INSERT 1201
#define M_EDIT_MODIFY 1202 #define M_EDIT_MODIFY 1202
#define M_EDIT_DELETE 1203 #define M_EDIT_DELETE 1203
#define M_EDIT_SHOW 1204 #define M_EDIT_SHOW 1204
#define M_EDIT_SEARCH 1205 #define M_EDIT_SEARCH 1205
#define M_EDIT_EDIT 1301 #define M_EDIT_EDIT 1301
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#define BMP_OK 101 #define BMP_OK 101
#define BMP_CANCEL 102 #define BMP_CANCEL 102
#define BMP_SAVEREC 103 #define BMP_SAVEREC 103
#define BMP_DELREC 104 #define BMP_DELREC 104
#define BMP_NEWREC 105 #define BMP_NEWREC 105
#define BMP_SEARCH 109 #define BMP_SEARCH 109
#define BMP_CHECK_ON 110 #define BMP_CHECK_ON 110
#define BMP_CHECK_OFF 111 #define BMP_CHECK_OFF 111
#define BMP_RADIO_ON 112 #define BMP_RADIO_ON 112
#define BMP_RADIO_OFF 113 #define BMP_RADIO_OFF 113
#define BMP_QUIT 114 #define BMP_QUIT 114
#define BMP_SELECT 115 #define BMP_SELECT 115
#define BMP_EDIT 116 #define BMP_EDIT 116
#define BMP_LINK 117 #define BMP_LINK 117
#define BMP_PRINT 118 #define BMP_PRINT 118
#define BMP_FIRSTREC 121 #define BMP_FIRSTREC 121
#define BMP_PREVREC 122 #define BMP_PREVREC 122
#define BMP_STOPREC 123 #define BMP_STOPREC 123
#define BMP_NEXTREC 124 #define BMP_NEXTREC 124
#define BMP_LASTREC 125 #define BMP_LASTREC 125
#define BMP_FINDREC 126 #define BMP_FINDREC 126
#define BMP_MODULE1 127 #define BMP_MODULE1 127
#define BMP_MODULE2 128 #define BMP_MODULE2 128
#define BMP_MODULE3 129 #define BMP_MODULE3 129
#define BMP_MODULE4 130 #define BMP_MODULE4 130
#define BMP_BOOK1 131 #define BMP_BOOK1 131
#define BMP_BOOK2 132 #define BMP_BOOK2 132
#define BMP_BOOK3 133 #define BMP_BOOK3 133
#define BMP_MODULE 134 #define BMP_MODULE 134
#define BMP_SAVERECDN 153 #define BMP_SAVERECDN 153
#define BMP_DELRECDN 154 #define BMP_DELRECDN 154
#define BMP_NEWRECDN 155 #define BMP_NEWRECDN 155
#define BMP_QUITDN 164 #define BMP_QUITDN 164
#endif #endif
/* @END */ /* @END */
#endif // __URLDEFID_H #endif // __URLDEFID_H

View File

@ -1,12 +1,12 @@
#ifndef __VALIDATE_H #ifndef __VALIDATE_H
#define __VALIDATE_H #define __VALIDATE_H
#ifndef __MASKFLD_H #ifndef __MASKFLD_H
#include <maskfld.h> #include <maskfld.h>
#endif #endif
bool validate(int fn, TEdit_field& f, KEY k, const TArray& parms); bool validate(int fn, TEdit_field& f, KEY k, const TArray& parms);
bool pi_check (const char * stato, const char * cf); bool pi_check (const char * stato, const char * cf);
bool cf_check (const char * stato, const char * cf); bool cf_check (const char * stato, const char * cf);
#endif // __VALIDATE_H #endif // __VALIDATE_H

View File

@ -1,70 +1,70 @@
#ifndef __XVTILITY_H #ifndef __XVTILITY_H
#define __XVTILITY_H #define __XVTILITY_H
#ifndef XVT_INCL #ifndef XVT_INCL
#include <xvt.h> #include <xvt.h>
#endif #endif
#ifndef __STDTYPES_H #ifndef __STDTYPES_H
#include <stdtypes.h> #include <stdtypes.h>
#endif #endif
#ifndef __KEYS_H #ifndef __KEYS_H
#include <keys.h> #include <keys.h>
#endif #endif
/* @FPUB */ /* @FPUB */
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent); RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
void xvt_draw_rect(WINDOW w, const RCT& r, COLOR c1, COLOR c2, short depth = 1); void xvt_draw_rect(WINDOW w, const RCT& r, COLOR c1, COLOR c2, short depth = 1);
WINDOW xvt_create_window(WIN_TYPE wt, WINDOW xvt_create_window(WIN_TYPE wt,
short x, short y, short dx, short dy, short x, short y, short dx, short dy,
const char* caption, WINDOW parent, const char* caption, WINDOW parent,
long flags, long flags,
EVENT_HANDLER eh, EVENT_HANDLER eh,
long app_data); long app_data);
WINDOW xvt_create_control(WIN_TYPE wt, WINDOW xvt_create_control(WIN_TYPE wt,
short x, short y, short dx, short dy, short x, short y, short dx, short dy,
const char* caption, const char* caption,
WINDOW parent, WINDOW parent,
long flags, long flags,
long app_data, long app_data,
int id); int id);
WINDOW xvt_create_statbar(); WINDOW xvt_create_statbar();
void xvt_statbar_set(const char* text); void xvt_statbar_set(const char* text);
void xvt_statbar_refresh(); void xvt_statbar_refresh();
void beep(); void beep();
void do_events(); void do_events();
void customize_controls(bool on); void customize_controls(bool on);
KEY e_char_to_key(const EVENT* ep); KEY e_char_to_key(const EVENT* ep);
void dispatch_e_char(WINDOW win, KEY key); void dispatch_e_char(WINDOW win, KEY key);
void dispatch_e_scroll(WINDOW win, KEY key); void dispatch_e_scroll(WINDOW win, KEY key);
void xvt_set_font(WINDOW win, int family, int style, int dim = 0); void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
void xvt_set_front_control(WINDOW win); void xvt_set_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win); const char* xvt_get_title(WINDOW win);
void xvt_enable_control(WINDOW win, bool on); void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on); void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win); bool xvt_get_checked_state(WINDOW win);
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count); void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
int xvt_get_checked_radio(const WINDOW* ctls, int count); int xvt_get_checked_radio(const WINDOW* ctls, int count);
bool xvt_test_menu_tag(MENU_TAG tag); bool xvt_test_menu_tag(MENU_TAG tag);
COLOR trans_color(char c); COLOR trans_color(char c);
PAT_STYLE trans_brush(char p); PAT_STYLE trans_brush(char p);
PEN_STYLE trans_pen (char p); PEN_STYLE trans_pen (char p);
/* @END */ /* @END */
extern short CHARX, CHARY, COLX, ROWY; extern short CHARX, CHARY, COLX, ROWY;
/* @END */ /* @END */
#endif #endif