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
#define __ANAFIS_H
#define ANF_CODANAGR "CODANAGR"
#define ANF_DATANASC "DATANASC"
#define ANF_SESSO "SESSO"
#define ANF_STATONASC "STATONASC"
#define ANF_COMNASC "COMNASC"
#define ANF_COMRES "COMRES"
#define ANF_TIPOA "TIPOA"
#endif
#ifndef __ANAFIS_H
#define __ANAFIS_H
#define ANF_CODANAGR "CODANAGR"
#define ANF_DATANASC "DATANASC"
#define ANF_SESSO "SESSO"
#define ANF_STATONASC "STATONASC"
#define ANF_COMNASC "COMNASC"
#define ANF_COMRES "COMRES"
#define ANF_TIPOA "TIPOA"
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ bool TConfig_application::menu(MENU_TAG m)
_last_choice = m;
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -426,9 +426,9 @@ update_keydef (int key, const char *desc)
_rec->Ky[key].FieldSeq[n] += MaxFields;
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 ();
_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 ();
}
else

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,7 +48,7 @@ public:
int precision() ;
bool is_zero() 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& trunc(int prec = 0) ;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,70 +1,70 @@
#ifndef __XVTILITY_H
#define __XVTILITY_H
#ifndef XVT_INCL
#include <xvt.h>
#endif
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifndef __KEYS_H
#include <keys.h>
#endif
/* @FPUB */
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);
WINDOW xvt_create_window(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption, WINDOW parent,
long flags,
EVENT_HANDLER eh,
long app_data);
WINDOW xvt_create_control(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption,
WINDOW parent,
long flags,
long app_data,
int id);
WINDOW xvt_create_statbar();
void xvt_statbar_set(const char* text);
void xvt_statbar_refresh();
void beep();
void do_events();
void customize_controls(bool on);
KEY e_char_to_key(const EVENT* ep);
void dispatch_e_char(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_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win);
void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win);
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
int xvt_get_checked_radio(const WINDOW* ctls, int count);
bool xvt_test_menu_tag(MENU_TAG tag);
COLOR trans_color(char c);
PAT_STYLE trans_brush(char p);
PEN_STYLE trans_pen (char p);
/* @END */
extern short CHARX, CHARY, COLX, ROWY;
/* @END */
#endif
#ifndef __XVTILITY_H
#define __XVTILITY_H
#ifndef XVT_INCL
#include <xvt.h>
#endif
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifndef __KEYS_H
#include <keys.h>
#endif
/* @FPUB */
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);
WINDOW xvt_create_window(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption, WINDOW parent,
long flags,
EVENT_HANDLER eh,
long app_data);
WINDOW xvt_create_control(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption,
WINDOW parent,
long flags,
long app_data,
int id);
WINDOW xvt_create_statbar();
void xvt_statbar_set(const char* text);
void xvt_statbar_refresh();
void beep();
void do_events();
void customize_controls(bool on);
KEY e_char_to_key(const EVENT* ep);
void dispatch_e_char(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_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win);
void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win);
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
int xvt_get_checked_radio(const WINDOW* ctls, int count);
bool xvt_test_menu_tag(MENU_TAG tag);
COLOR trans_color(char c);
PAT_STYLE trans_brush(char p);
PEN_STYLE trans_pen (char p);
/* @END */
extern short CHARX, CHARY, COLX, ROWY;
/* @END */
#endif