Aggiunta documentazione in linea
git-svn-id: svn://10.65.10.50/trunk@1511 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5b330aea2c
commit
47c01f7b0c
@ -12,7 +12,7 @@
|
||||
// @base public | TObject
|
||||
class THash_object : public TObject
|
||||
{
|
||||
// @cfriend TAssoc_array
|
||||
// @friend class TAssoc_array
|
||||
friend class TAssoc_array;
|
||||
|
||||
// @access Private Member
|
||||
|
@ -17,6 +17,8 @@
|
||||
#define BLOCKLEN 512
|
||||
#define INVFLD 255
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
HIDDEN char _files_tmp_string[128];
|
||||
|
||||
TFile::TFile (int lenrec, int base)
|
||||
@ -38,8 +40,11 @@ TFile::~TFile ()
|
||||
delete _file;
|
||||
}
|
||||
|
||||
void TFile::open (const char *name, TFilelock lockmode)
|
||||
|
||||
// @mfunc Apre il file specificato
|
||||
void TFile::open (
|
||||
const char *name, // @parm Nome del file da aprire
|
||||
TFilelock lockmode) // @parm Tipo di lock da attivare durante l'apertura del file
|
||||
// (default _manulock)
|
||||
{
|
||||
COpen (_file, (char *) name, _len, _base, lockmode);
|
||||
}
|
||||
@ -51,7 +56,13 @@ bool TFile::verify (const char *name)
|
||||
return _file->IOR == NOERR;
|
||||
}
|
||||
|
||||
void TFile::create (const char *name, TRecnotype nrecord)
|
||||
// @mfunc Crea il file specificato
|
||||
void TFile::create (
|
||||
const char *name, // @parm Nome del file da creare
|
||||
TRecnotype nrecord) // @parm Numero di recird che deve avere il file al momento
|
||||
// della creazione (default 0)
|
||||
|
||||
// @comm Il file creato avra' dimensioni sufficienti a contenere <p nrecord> record
|
||||
|
||||
{
|
||||
CCreate (_file, (char *) name, _len, _base, (nrecord * _len) / BLOCKLEN + 1);
|
||||
@ -75,7 +86,11 @@ void TFile::unlink (const char *name)
|
||||
CDelete (_file, (char *) name);
|
||||
}
|
||||
|
||||
void TFile::read (char *record, TRecnotype recnum, TReclock lock)
|
||||
// @mfunc Legge un record dal file
|
||||
void TFile::read (
|
||||
char *record, // @parm Record letto
|
||||
TRecnotype recnum, // @parm Numero del record da leggere
|
||||
TReclock lock) // @parm Tipo di blocco da attivare durante la letture (default _nolock)
|
||||
|
||||
{
|
||||
_file->LenRec = _len;
|
||||
@ -83,7 +98,11 @@ void TFile::read (char *record, TRecnotype recnum, TReclock lock)
|
||||
CRead (_file, record, recnum, lock);
|
||||
}
|
||||
|
||||
void TFile::write (char *record, TRecnotype recnum, TReclock lock)
|
||||
// @mfunc Scrive un record sul file
|
||||
void TFile::write (
|
||||
char *record, // @parm Record da scrivere
|
||||
TRecnotype recnum, // @parm Numero del record da scrivere
|
||||
TReclock lock) // @parm Tipo di blocco da attivare durante la letture (default _nolock)
|
||||
|
||||
{
|
||||
_file->LenRec = _len;
|
||||
@ -189,7 +208,12 @@ void TDir::set (const char *name, const RecNoType eod, const RecNoType flag, con
|
||||
strncpy (_dir->FCalc, calc, sizeof (_dir->FCalc));
|
||||
}
|
||||
|
||||
void TDir::get (int nfile, TReclock lock, TDirtype dirtype, TDirop op)
|
||||
// @mfunc Aggiorna l'oggetto TDir con i parametri del file
|
||||
void TDir::get (
|
||||
int nfile, // @parm Numero del file con cui aggiornare l'oggetto
|
||||
TReclock lock, // @parm Tipo di blocco (default _nolock)
|
||||
TDirtype dirtype, // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||
TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop)
|
||||
|
||||
{
|
||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||
@ -202,7 +226,11 @@ void TDir::get (int nfile, TReclock lock, TDirtype dirtype, TDirop op)
|
||||
_com = _dir->SysName[0] != '$';
|
||||
}
|
||||
|
||||
void TDir::put (int nfile, TDirtype dirtype, TDirop op)
|
||||
// @mfunc Aggiorna il file indicato con i parametri passati
|
||||
void TDir::put (
|
||||
int nfile, // @parm Numero del file da aggiornare
|
||||
TDirtype dirtype, // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||
TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop)
|
||||
{
|
||||
CHECKD(nfile > 0, "Bad file number ", nfile);
|
||||
|
||||
@ -266,7 +294,10 @@ TTrec & TTrec::operator = (const TTrec & b)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void TTrec::get (int nfile, TDirtype dirtype)
|
||||
// @mfunc Assegna all'oggetto TTrec il tracciato record del file indicato
|
||||
void TTrec::get (
|
||||
int nfile, // @parm Numero del file da cui estrarre il tracciato record
|
||||
TDirtype dirtype) // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||
|
||||
{
|
||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||
@ -275,7 +306,10 @@ void TTrec::get (int nfile, TDirtype dirtype)
|
||||
_num = nfile;
|
||||
}
|
||||
|
||||
void TTrec::put (int nfile, TDirtype dirtype)
|
||||
// @mfunc Setta il file indicato con il tracciato record dell'oggetto
|
||||
void TTrec::put (
|
||||
int nfile, // @parm Numero del file di cui settare il tracciato record
|
||||
TDirtype dirtype) // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||
|
||||
{
|
||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||
|
190
include/files.h
190
include/files.h
@ -17,125 +17,209 @@
|
||||
#define DESCTAB "TabDescr"
|
||||
#define DESCDIR "recdesc"
|
||||
|
||||
// @C
|
||||
// Classe TFile : public TObject
|
||||
//
|
||||
// Il file. I suoi metodi comprendono tutte le procedure per l'accesso
|
||||
// fisico di basso livello ai file.
|
||||
//
|
||||
// @END
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TFile | Classe per la definizione dei metodi che comprendono tutte le
|
||||
// procedure per l'accesso fisico di basso livello ai file.
|
||||
//
|
||||
// @base public | TObject
|
||||
class TFile : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
SecDef* _file;
|
||||
int _len;
|
||||
int _base;
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Descrittore del file
|
||||
SecDef* _file;
|
||||
// @cmember Lunghezza del record
|
||||
int _len;
|
||||
// @cmember Offset iniziale del file in settori
|
||||
int _base;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @FPUB
|
||||
// @cmember Apre il file specificato
|
||||
void open(const char* name, TFilelock lockmode = _manulock);
|
||||
// @cmember Controlla se il file specificato e' corretto (TRUE se non vi sono errori)
|
||||
bool verify(const char* name);
|
||||
// @cmember Crea il file specificato
|
||||
void create(const char* name, TRecnotype nrecord = 10);
|
||||
// @cmember Cambia le dimensioni di un file
|
||||
void chsize(const char* name, TRecnotype nrecord);
|
||||
// @cmember Chiude il file
|
||||
void close();
|
||||
// @cmember Elimina il file specificato
|
||||
void unlink(const char* name);
|
||||
// @cmember Legge un record dal file
|
||||
void read(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
||||
// @cmember Scrive un record sul file
|
||||
void write(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
||||
// @cmember Ritorna lo stato di errore del file
|
||||
int status() const ;
|
||||
int& base() { return _base; }
|
||||
int& len() { return _len; }
|
||||
bool ok() const { return status() == NOERR; }
|
||||
// @cmember Ritorna l'offset di base
|
||||
int& base()
|
||||
{ return _base; }
|
||||
// @cmember Ritorna la lunghezza del record
|
||||
int& len()
|
||||
{ return _len; }
|
||||
// @cmember Controlla che non vi siano errori nel file aperto (TRUE se tutto normale)
|
||||
bool ok() const
|
||||
{ return status() == NOERR; }
|
||||
bool error() const { return status() != NOERR; }
|
||||
|
||||
// @cmember Costruttore
|
||||
TFile(int lenrec = 0, int base = 0);
|
||||
// @cmember Distruttore
|
||||
virtual ~TFile();
|
||||
};
|
||||
|
||||
// @C
|
||||
// Classe TDir : public TObject
|
||||
// @class TDir | Classe per la gestione del file "dir.gen"
|
||||
//
|
||||
// @END
|
||||
|
||||
// @base public | TObject
|
||||
class TDir : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Descrittore del file
|
||||
FileDes* _dir;
|
||||
// @cmember Numero di file presenti
|
||||
int _num;
|
||||
// @cmember Appartenenza al direttorio comune (TRUE) o a quello della ditta
|
||||
bool _com;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @FPUB
|
||||
// @cmember Aggiorna l'oggetto TDir con i paramtri del file indicato
|
||||
void get(int nfile, TReclock lock = _nolock, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
||||
// @cmember Aggiorna il file indicato con i parametri passati
|
||||
void put(int nfile, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
||||
// @cmember Azzera i parametri del file selezionato
|
||||
void zero();
|
||||
|
||||
// @cmember Setta l'EOX del file
|
||||
void set_eox(const RecNoType eox);
|
||||
// @cmember Setta la lunghezza del file
|
||||
void set_len(const UINT16 len);
|
||||
// @cmember Setta il file con i parametri passati
|
||||
void set (const char * name, const RecNoType eod, const RecNoType flag, const char * des, const char * calc);
|
||||
|
||||
// @cmember Ritorna il nome del file selezionato
|
||||
const char* name() const;
|
||||
// @cmember Ritorna la descrizione del file selezionato
|
||||
const char* des() const;
|
||||
const char* expr() const;
|
||||
TRecnotype& eod() const;
|
||||
TRecnotype& eox() const;
|
||||
TRecnotype& flags() const;
|
||||
word& len();
|
||||
int status(TDirtype dirtype = _nordir) const ;
|
||||
int num() const { return _num;}
|
||||
int items(TDirtype dirtype = _nordir) const;
|
||||
FileDes* filedesc() const { return _dir; }
|
||||
bool is_com() const {return _com;} // valido solo se la get e' stata effettuata con _sysdirop
|
||||
bool is_firm() const {return !_com;} // valido solo se la get e' stata effettuata con _sysdirop
|
||||
bool is_valid() {return name()[0] > ' ' && len() > 0;}
|
||||
bool is_active() const; // valido solo se prefhnd e settato a ""
|
||||
|
||||
// @cmember Ritorna la descrizione della tabella
|
||||
static const char* tab_des(const char* tabname);
|
||||
// @cmember Ritorna l'espressione associata al file selezionato
|
||||
const char* expr() const;
|
||||
// @cmember Ritorna l'EOD del file selezioanato
|
||||
TRecnotype& eod() const;
|
||||
// @cmember Ritorna l'EOX del file selezionato
|
||||
TRecnotype& eox() const;
|
||||
// @cmember Ritorna il flag del file selezionato
|
||||
TRecnotype& flags() const;
|
||||
// @cmember Ritorna la lunghezza del tracciato record in bytes
|
||||
word& len();
|
||||
// @cmember Ritorna lo stato d'errore del file
|
||||
int status(TDirtype dirtype = _nordir) const ;
|
||||
// @cmember Ritorna il numero di file presenti
|
||||
int num() const
|
||||
{ return _num;}
|
||||
int items(TDirtype dirtype = _nordir) const;
|
||||
// @cmember Ritorna il descrittore del file "dir.gen"
|
||||
FileDes* filedesc() const
|
||||
{ return _dir; }
|
||||
// @cmember Controlla se il file appartiene ai dati comuni. Valido solo se
|
||||
// la get e' stata effettuata con _sysdirop
|
||||
bool is_com() const
|
||||
{return _com;}
|
||||
// @cmember Controlla se il file appartiene alla ditta. Valido solo se
|
||||
// la get e' stata effettuata con _sysdirop
|
||||
bool is_firm() const
|
||||
{return !_com;}
|
||||
// @cmember Controlle se il file e' valido (nome esistente e dimensione
|
||||
// diversa da 0)
|
||||
bool is_valid()
|
||||
{return name()[0] > ' ' && len() > 0;}
|
||||
// @cmember Controlla se il file e' attivato dalla chiave hardware.
|
||||
// Valido solo se prefhnd e settato a ""
|
||||
bool is_active() const;
|
||||
|
||||
// @cmember Costruttore
|
||||
TDir();
|
||||
// @cmember Distruttore
|
||||
virtual ~TDir();
|
||||
};
|
||||
|
||||
// @C
|
||||
// Classe TTrec : public TObject
|
||||
//
|
||||
// @END
|
||||
|
||||
// @class TTrec | Classe per le gestione dei tracciati record dei file
|
||||
//
|
||||
// @base public | TSortable
|
||||
class TTrec : public TSortable
|
||||
{
|
||||
// @DPRIV
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Descrittore del tracciato record
|
||||
RecDes* _rec;
|
||||
// @cmember Numero del file di appartenenza
|
||||
int _num;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Permette di comparare due oggetti (vedi classe <c TSortable>)
|
||||
int compare(const TSortable& a) const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @FPUB
|
||||
// @cmember Assegna all'oggetto TTrec il tracciato record del file indicato
|
||||
void get(int nfile, TDirtype dirtype = _nordir);
|
||||
// @cmember Setta il file indicato con il tracciato record dell'oggetto
|
||||
void put(int nfile, TDirtype dirtype = _nordir);
|
||||
// @cmember Azzera il tracciato record
|
||||
void zero();
|
||||
// @cmember Costruisce i puntatori per la ricerca dei campi
|
||||
void rehash();
|
||||
// @cmember Ritorna lo stato di errore del file
|
||||
int status(TDirtype dirtype = _nordir) const ;
|
||||
int num() const { return _num;}
|
||||
// @cmember Ritorna il numero del file
|
||||
int num() const
|
||||
{ return _num;}
|
||||
int field(const char* fieldname) const;
|
||||
RecDes* rec() const { return _rec;}
|
||||
// @cmember Ritorna il descrittore del tracciato record
|
||||
RecDes* rec() const
|
||||
{ return _rec;}
|
||||
// @cmember Assegna un oggetto TTrec
|
||||
TTrec& operator =(const TTrec& b);
|
||||
int fields() const { return _rec->NFields; }
|
||||
int keys() const { return _rec->NKeys; }
|
||||
void set_fields(int nfields) { _rec->NFields = nfields;}
|
||||
void set_keys(int nkeys) { _rec->NKeys = nkeys;}
|
||||
const char* fielddef(int fld) const; // ritorna una token string
|
||||
// @cmember Ritorna il numero di campi del tracciato record
|
||||
int fields() const
|
||||
{ return _rec->NFields; }
|
||||
// @cmember Ritorna il numero di chiavi di ordinamento del tracciato record
|
||||
int keys() const
|
||||
{ return _rec->NKeys; }
|
||||
// @cmember Assegna il numero di campi del tracciato record
|
||||
void set_fields(int nfields)
|
||||
{ _rec->NFields = nfields;}
|
||||
// @cmember Assegna il numero di chiavi di ordinamento del tracciato record
|
||||
void set_keys(int nkeys)
|
||||
{ _rec->NKeys = nkeys;}
|
||||
// @cmember Ritorna una token string contenente la descrizione del campo
|
||||
const char* fielddef(int fld) const;
|
||||
// @cmember Ritorna una stringa contenente la chiave
|
||||
const char* keydef(int key) const;
|
||||
int len() const { return _rec->Fd[fields() - 1].RecOff +
|
||||
_rec->Fd[fields() - 1].Len; }
|
||||
// @cmember Ritorna la lunghezza del record
|
||||
int len() const
|
||||
{ return _rec->Fd[fields() - 1].RecOff + _rec->Fd[fields() - 1].Len; }
|
||||
|
||||
#ifndef FOXPRO
|
||||
void update_keydef(int key, const char* desc); //desc e' una token string
|
||||
void update_fielddef(int nfld, const char* desc); //desc e' una token string
|
||||
// @cmember Aggiorna la chiave. <p desc> e' una token string
|
||||
void update_keydef(int key, const char* desc);
|
||||
// @cmember Aggiorna il campo. <p desc> e' una token string
|
||||
void update_fielddef(int nfld, const char* desc);
|
||||
// @cmember Stampa il tracciato record sull'output selezionato
|
||||
virtual void print_on(ostream& out) const;
|
||||
// @cmember Legge il tracciato record da input selezionato
|
||||
virtual void read_from(istream& in);
|
||||
#endif
|
||||
|
||||
// @cmember Costruttore
|
||||
TTrec();
|
||||
// @cmember Distruttore
|
||||
virtual ~TTrec();
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
// $Id: mailbox.cpp,v 1.14 1995-04-26 08:06:41 guy Exp $
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fstream.h>
|
||||
|
||||
@ -10,6 +8,8 @@
|
||||
#define DEF_MSGS_CAPACITY 50
|
||||
#define MAX_TXT_LEN 200
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
TMessage::TMessage(const char* to, const char* sub,
|
||||
const char* text, const char* from)
|
||||
{
|
||||
@ -31,8 +31,6 @@ void TMessage::send()
|
||||
|
||||
|
||||
void TMailbox::reread()
|
||||
// reads new messages from mailbox;
|
||||
// create messages, put messages in _msgs array in cronological order
|
||||
{
|
||||
char buf[MAX_TXT_LEN];
|
||||
|
||||
@ -81,19 +79,28 @@ TMessage* TMailbox::next_read()
|
||||
return this->get(_cnt++);
|
||||
}
|
||||
|
||||
TMessage* TMailbox::next(bool read)
|
||||
// @mfunc Ritorna il prossimo messaggio
|
||||
TMessage* TMailbox::next(
|
||||
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||
// letti (default FALSE)
|
||||
|
||||
// @comm Se <p read> e' TRUE ritorna il prossimo messaggio non letto
|
||||
{
|
||||
// next message, default unread
|
||||
TMessage* m = read ? next_read() : next_unread();
|
||||
if (m)
|
||||
m->setread();
|
||||
return m;
|
||||
}
|
||||
|
||||
// @mfunc Ritorna il prossimo messaggio con lo stesso oggetto
|
||||
TMessage* TMailbox::next_s(
|
||||
char* s, // @parm Oggetto del messaggio da ritornare
|
||||
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||
// letti (default FALSE)
|
||||
|
||||
TMessage* TMailbox::next_s(char* s, bool read)
|
||||
// @comm Ricerca tra i messaggi quello che possiede l'oggetto passato in <p s>.
|
||||
// Se <p read> ritorna il primo messaggio non letto.
|
||||
{
|
||||
// next message with matching subject
|
||||
for (;;)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
@ -113,9 +120,16 @@ TMessage* TMailbox::next_s(char* s, bool read)
|
||||
return this->get(_cnt);
|
||||
}
|
||||
|
||||
TMessage* TMailbox::next_f(char* f, bool read)
|
||||
|
||||
// @mfunc Ritorna il prossimo messaggio con lo stesso mandante
|
||||
TMessage* TMailbox::next_f(
|
||||
char* f, // @parm Oggetto del messaggio da ritornare
|
||||
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||
// letti (default FALSE)
|
||||
|
||||
// @comm Ricerca tra i messaggi quello che possiede il mandate passato in <p f>.
|
||||
// Se <p read> ritorna il primo messaggio non letto.
|
||||
{
|
||||
// next message with matching sender
|
||||
for (;;)
|
||||
{
|
||||
if (_cnt == _msgs.items())
|
||||
|
@ -1,9 +1,3 @@
|
||||
// $Id: mailbox.h,v 1.5 1995-01-16 15:10:24 guy Exp $
|
||||
|
||||
/* si', trattasi di -*-c++-*- */
|
||||
// Mailbox.h
|
||||
// Message passing between applications and command lines
|
||||
|
||||
#ifndef __MAILBOX_H
|
||||
#define __MAILBOX_H
|
||||
|
||||
@ -14,82 +8,147 @@
|
||||
// TMessage flags
|
||||
#define MSG_READ (0x01)
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TMessagge | Classe per il passaggio dei messeggi base tra applicazioni
|
||||
// e linea di comando
|
||||
//
|
||||
// @base public | TObject
|
||||
class TMessage : public TObject
|
||||
// basic message
|
||||
{
|
||||
TString16 _from;
|
||||
TString16 _to;
|
||||
TString80 _subject;
|
||||
TString _text;
|
||||
byte _flags;
|
||||
int _number;
|
||||
|
||||
friend class TMailbox;
|
||||
|
||||
protected:
|
||||
void setread() { _flags |= MSG_READ; }
|
||||
bool isread() { return _flags & MSG_READ; }
|
||||
int number(int n = -1) { return (n == -1 ? _number : (_number = n)); }
|
||||
|
||||
public:
|
||||
const TString& from() const { return _from; }
|
||||
const TString& to() const { return _to; }
|
||||
const TString& subject() const { return _subject; }
|
||||
const TString& body() const { return _text; }
|
||||
|
||||
const TString& from(const char* f) { return _from = f; }
|
||||
const TString& to(const char* t) { return _to = t; }
|
||||
const TString& subject(const char* s) { return _subject = s; }
|
||||
const TString& body(const char* b) { return _text = b; }
|
||||
// @access Private Member
|
||||
|
||||
// @friend class TMailbox
|
||||
friend class TMailbox;
|
||||
|
||||
// @cmember Applicazione che lancia il messaggio
|
||||
TString16 _from;
|
||||
// @cmember Applicazione che deve ricevere il messaggio
|
||||
TString16 _to;
|
||||
// @cmember Oggetto del messaggio
|
||||
TString80 _subject;
|
||||
// @cmember Testo del messaggio
|
||||
TString _text;
|
||||
// @cmember Flag di controllo del messaggio
|
||||
byte _flags;
|
||||
// #cmember Numero (non si sa cosa faccia)
|
||||
// int _number;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Indica che il messaggio e' stato letto
|
||||
void setread()
|
||||
{ _flags |= MSG_READ; }
|
||||
// @cmember Controlla se il messaggio e' stato letto (TRUE se e' stato letto)
|
||||
bool isread()
|
||||
{ return _flags & MSG_READ; }
|
||||
// #cmember Setta il numero. Se viene passato -1 ritorna il valore attuale
|
||||
//int number(int n = -1)
|
||||
//{ return (n == -1 ? _number : (_number = n)); }
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Ritorna il nome dell'applicazione che lancia il messaggio
|
||||
const TString& from() const
|
||||
{ return _from; }
|
||||
// @cmember Ritorna il nome dell'applicazione che deve ricevere il messaggio
|
||||
const TString& to() const
|
||||
{ return _to; }
|
||||
// @cmember Ritorna l'oggetto del messaggio
|
||||
const TString& subject() const
|
||||
{ return _subject; }
|
||||
// @cmember Ritorna il testo del messaggio
|
||||
const TString& body() const
|
||||
{ return _text; }
|
||||
|
||||
// @cmember Assegna il nome dell'applicazione che lancia il messaggio
|
||||
const TString& from(const char* f)
|
||||
{ return _from = f; }
|
||||
// @cmember Assegna il nome dell'applicazione che deve ricevere il messaggio
|
||||
const TString& to(const char* t)
|
||||
{ return _to = t; }
|
||||
// @cmember Assegna l'oggetto del messaggio
|
||||
const TString& subject(const char* s)
|
||||
{ return _subject = s; }
|
||||
// @cmember Assegna il testo del messaggio
|
||||
const TString& body(const char* b)
|
||||
{ return _text = b; }
|
||||
|
||||
// @cmember Manda il messaggio
|
||||
void send();
|
||||
|
||||
TMessage(const char* to, const char* sub, const char* text,
|
||||
const char* from = NULL);
|
||||
// @cmember Costruttore
|
||||
TMessage(const char* to, const char* sub, const char* text, const char* from = NULL);
|
||||
};
|
||||
|
||||
// @class TMailbox | Classe per controllare i messaggi ricevuti da una applicazione
|
||||
//
|
||||
// @base public | TObject
|
||||
class TMailbox : public TObject
|
||||
{
|
||||
TFilename _path;
|
||||
TArray _msgs;
|
||||
int _lastread, n_new;
|
||||
long _lastpos;
|
||||
int _cnt;
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Nome del file che contiene i messaggi
|
||||
TFilename _path;
|
||||
// @cmember Array di messaggi ricevuti
|
||||
TArray _msgs;
|
||||
// @cmember Numero dell'ultimo messaggio letto
|
||||
int _lastread;
|
||||
// @cmember Numero di messaggi in attesa di lettura
|
||||
int n_new;
|
||||
// @cmember Posizione nel file dell'ultimo messaggio letto
|
||||
long _lastpos;
|
||||
// @cmember Indice dei messaggi letti e non letti
|
||||
int _cnt;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
|
||||
// @cmember Legge un nuovo messaggio dalla mailbox. Crea messaggi, mette i
|
||||
// messaggi nell'array in ordine cronologico
|
||||
void reread();
|
||||
// @cmember Ritorna il prossimo messaggio letto (NULL se non e' stato letto)
|
||||
TMessage* next_read();
|
||||
// @cmember Ritorna il prossimo messaggio non letto
|
||||
TMessage* next_unread();
|
||||
|
||||
// @access Public Member
|
||||
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
|
||||
|
||||
// @cmember Ritorna il numero di messaggi in attesa
|
||||
int check()
|
||||
{ reread(); return n_new; }
|
||||
// @cmember Reinizalizza la fase di lettura
|
||||
void restart()
|
||||
{ _cnt = 0;}
|
||||
// @cmember Ritorna in numero di messaggi, letti e da leggere, presenti nella mailbox
|
||||
int items()
|
||||
{ return _msgs.items(); }
|
||||
// @cmember Ritorna il prossimo messaggio
|
||||
TMessage* next(bool read = FALSE);
|
||||
// @cmember Ritorna il prossimo messaggio con lo stesso oggetto
|
||||
TMessage* next_s(char* s, bool read = FALSE);
|
||||
// @cmember Ritorna il prossimo messaggio con lo stesso mandante
|
||||
TMessage* next_f(char* f, bool read = FALSE);
|
||||
// @cmember Manda un messaggio
|
||||
void send(TMessage& m);
|
||||
// @cmember Trasforma gli argomenti della command line in messaggi mail (NON IMPLEMENTATA)
|
||||
void sendcmd(int argc, char* argv[],char* to);
|
||||
// @cmember Trasforma una mailbox in parametri per la command line per la
|
||||
// chaimata di applicazioni non compilanti (NON IMPLEMENTATA)
|
||||
char* readcmd(char* to = NULL);
|
||||
// @cmember Ritorna l'<p n>-esimo messaggio
|
||||
TMessage* get(int n)
|
||||
{ return (TMessage*)_msgs.objptr(n); }
|
||||
|
||||
// @cmember Costruttore
|
||||
TMailbox::TMailbox(const char* appname = NULL);
|
||||
// @cmember Distruttore
|
||||
virtual ~TMailbox();
|
||||
};
|
||||
|
||||
|
||||
// @todo Da implementare in futuro
|
||||
//
|
||||
// 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
|
||||
|
@ -150,7 +150,18 @@ HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array&
|
||||
}
|
||||
|
||||
|
||||
void TPrefix::set(const char* name, bool force, TFilelock mode)
|
||||
// @mfunc Setta la ditta corrente
|
||||
void TPrefix::set(
|
||||
const char* name, // @parm Nome del direttorio dati da attivare (default NULL)
|
||||
bool force, // @parm Permette di settarla anche se non esiste (default FALSE)
|
||||
TFilelock mode) // @parm Permette di aprire la ditta in modo esclusico (default _manulock)
|
||||
|
||||
// @comm Il parametro <p name> puo' assumere i seguenti valori:
|
||||
//
|
||||
// @flag NULL | Chiude tutti i files
|
||||
// @flag COM | Apre il direttorio con i dati comuni
|
||||
// @flga DEF | Riapre la ditta indicata nel file prefix.txt
|
||||
// @flag codice ditta | Apre la ditta indicata
|
||||
{
|
||||
if (name == NULL)
|
||||
{
|
||||
@ -282,7 +293,17 @@ bool TPrefix::set_codditta(long codditta, bool force)
|
||||
}
|
||||
|
||||
|
||||
const char* TPrefix::description(const char* cod) const
|
||||
// @mfunc Ritorna la descrizione del file passato
|
||||
const char* TPrefix::description(
|
||||
const char* cod) const // @parm Nome del file di cui si vuole conoscere la descrizione
|
||||
|
||||
// @syntax const char* description(const char* cod);
|
||||
// @syntax const char* description(int cod);
|
||||
//
|
||||
// @comm Il parametro <p cod> puo' indicare anche il nome di una tabella. In questo caso ne
|
||||
// ritorna la descrizione.
|
||||
// <nl>Passando il nome di una tabella in <p cod> si ottiene la stessa cosa della
|
||||
// funzione <mf TDir::Tab_des>, ma viene cercato la descrizione nel titolo della maschera.
|
||||
{
|
||||
TString80 n(cod);
|
||||
|
||||
|
@ -13,42 +13,75 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
// @C
|
||||
// class TPrefix : public TObject
|
||||
// @END
|
||||
|
||||
// @class TPrefix | Classe contenente le informazioni sulla ditta correntemente in uso
|
||||
//
|
||||
// @base public | TObject
|
||||
class TPrefix : public TObject
|
||||
|
||||
// @author:(INTERNAL) Alex-Guido
|
||||
{
|
||||
// @DPRIV
|
||||
TString _prefix;
|
||||
int* _dirfl;
|
||||
int* _recfl;
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Contenuto del file "prefix.txt"
|
||||
TString _prefix;
|
||||
// @cmember Array di flag di apertura dei file (dir.gen)
|
||||
int* _dirfl;
|
||||
// @cmember Array di flag di apertura dei file (trc.gen)
|
||||
int* _recfl;
|
||||
// @cmember Livello degli archivi
|
||||
long _filelevel;
|
||||
// @cmember Numero di files esitenti
|
||||
int _items;
|
||||
|
||||
// @cmember Puntatore alla lista dei file (dir.gen)
|
||||
SecDef* _fdir;
|
||||
// @cmember Puntatore alla lista dei record (trc.gen)
|
||||
SecDef* _rdir;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Verifica l'effettiva esistenza della directory <p s> sotto
|
||||
// la directory dati
|
||||
bool test(const char* s) const ;
|
||||
// @cmember Copia fisicamente la stringa <p _prefix> nel file "prefix.txt"
|
||||
void put();
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Setta la ditta corrente
|
||||
void set(const char* name = NULL, bool force = FALSE, TFilelock mode = _manulock);
|
||||
// @cmember Controlla l'esistenza di un codice ditta
|
||||
bool exist(long codditta) const;
|
||||
// @cmember Controlla l'esistenza di un codice ditta e che non sia in uso
|
||||
bool test(long codditta) const;
|
||||
// @cmember Ritorna il codice della ditta corrente
|
||||
long get_codditta() const ;
|
||||
// @cmember Setta il codice della ditta corrente
|
||||
bool set_codditta(long codditta, bool force = FALSE);
|
||||
const char* name() const { return _prefix;}
|
||||
long filelevel() const {return _filelevel;}
|
||||
|
||||
int items() const { return _items; }
|
||||
// @cmember Ritorna il contenuto della variabile <p _prefix>
|
||||
const char* name() const
|
||||
{ return _prefix;}
|
||||
// @cmember Ritorna il livello degli archivi
|
||||
long filelevel() const
|
||||
{return _filelevel;}
|
||||
|
||||
// @cmember Ritorna il numero di archivi
|
||||
int items() const
|
||||
{ return _items; }
|
||||
// @cmember Ritorna la descrizione del file passato
|
||||
const char* description(const char* cod) const;
|
||||
// @cmember Ritorna la descrizione del file passato
|
||||
const char* description(int cod) const;
|
||||
bool is_firm() const { return _prefix.len() == 6 && _prefix[5] == 'a';}
|
||||
bool is_com() const { return !is_firm();}
|
||||
// @cmember Controlla che la ditta attiva sia una ditta (e non es. dati comuni)
|
||||
bool is_firm() const
|
||||
{ return _prefix.len() == 6 && _prefix[5] == 'a';}
|
||||
// @cmember Controlla che siano attivi i dati comuni (e non una ditta)
|
||||
bool is_com() const
|
||||
{ return !is_firm();}
|
||||
|
||||
// @cmember Costruttore
|
||||
TPrefix();
|
||||
// @cmember Distruttore
|
||||
virtual ~TPrefix();
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// $Id: progind.cpp,v 1.5 1995-03-22 11:38:57 guy Exp $
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
const char* const CANCEL_TEXT = "Annulla";
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
@ -55,7 +55,14 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
do_events();
|
||||
}
|
||||
|
||||
void TIndwin::set_text(const char* t)
|
||||
// @mfunc Setta il testo della finestra
|
||||
void TIndwin::set_text(
|
||||
const char* t) // @parm Testo della finestra
|
||||
|
||||
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
||||
// le dimensioni della finestra sono calcolate sul primo testo
|
||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||
{
|
||||
xvt_vobj_set_title(_text, (char*)t);
|
||||
}
|
||||
|
@ -1,13 +1,3 @@
|
||||
/* $Id: progind.h,v 1.4 1994-12-01 14:49:33 villa Exp $ */
|
||||
|
||||
/* @N
|
||||
progind.h
|
||||
program status and timer boxes
|
||||
fv 20/8/93
|
||||
works for both C and C++
|
||||
@END
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef __PROGIND_H
|
||||
#define __PROGIND_H
|
||||
@ -20,112 +10,135 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
@C
|
||||
class TIndwin : public TWindow
|
||||
@END
|
||||
*/
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TIndwin | Classe base per la gestione delle finestre con le barre di attesa
|
||||
//
|
||||
// @base public | TWindow
|
||||
class TIndwin : public TWindow
|
||||
// @author:(INTERNAL) Villa
|
||||
{
|
||||
/* @DPRIV */
|
||||
enum { IND_CANCELLED = 0x01, IND_FINISHED= 0x02 };
|
||||
// @access Private Member
|
||||
|
||||
enum {
|
||||
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
||||
IND_CANCELLED = 0x01,
|
||||
// @cmember Controlla se l'operazione e' terminata
|
||||
IND_FINISHED= 0x02 };
|
||||
|
||||
WINDOW _text; // Static text
|
||||
WINDOW _cancel; // CANCEL button
|
||||
WINDOW _bar; // Moving bar and percentage
|
||||
byte _flags;
|
||||
/* @END */
|
||||
// @cmember Testo da inserire nella finestra
|
||||
WINDOW _text;
|
||||
// @cmember Bottone "Annulla"
|
||||
WINDOW _cancel;
|
||||
// @cmember Movimento della barra e percentuale
|
||||
WINDOW _bar;
|
||||
// @cmember Flage che indica quali operazioni sono state effettuate
|
||||
byte _flags;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
/* @FPROT */
|
||||
|
||||
long _max; // maximum value to reach
|
||||
long _status; // current status (set by user)
|
||||
void draw_window();
|
||||
word measure_text(TToken_string& t, word& len) const;
|
||||
// @cmember Massima valore da ricercare
|
||||
long _max;
|
||||
// @cmember Stato corrente dell'esecuzione (settato dell'utente)
|
||||
long _status;
|
||||
// @cmember Ritorna il numero di linee necessarie per scrivere il testo nella finestra
|
||||
word measure_text(TToken_string& t, word& len) const;
|
||||
|
||||
// @cmember Gestisce gli eventi della finestra
|
||||
virtual void handler(WINDOW w, EVENT* e);
|
||||
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
||||
virtual void update();
|
||||
|
||||
|
||||
// @cmember Aggiorna la barra di attesa
|
||||
void update_bar();
|
||||
// @cmember Controlla se ha terminato la barra di attesa
|
||||
KEY check_stop();
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
/* @FPUB */
|
||||
bool iscancelled() const { do_events(); return _flags & IND_CANCELLED; }
|
||||
bool isfinished() const { do_events(); return _flags & IND_FINISHED; }
|
||||
long status() const { do_events(); return _status; }
|
||||
void cancel() { _flags |= IND_CANCELLED; do_events(); check_stop(); }
|
||||
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
||||
bool iscancelled() const
|
||||
{ do_events(); return _flags & IND_CANCELLED; }
|
||||
// @cmember Controlla se e' finito l'operazione
|
||||
bool isfinished() const
|
||||
{ do_events(); return _flags & IND_FINISHED; }
|
||||
// @cmember Ritorna lo stato dell'operazione (quantita' dell'applicazione gia' fatta)
|
||||
long status() const
|
||||
{ do_events(); return _status; }
|
||||
// @cmember Ferma l'operazione (chiude la finestra)
|
||||
void cancel()
|
||||
{ _flags |= IND_CANCELLED; do_events(); check_stop(); }
|
||||
|
||||
// @cmember Controlla se l'operazione puo' essere chiusa
|
||||
virtual bool can_be_closed() const;
|
||||
/* @END */
|
||||
|
||||
/* @LONGDES
|
||||
si puo' chiamare settext() per cambiare il testo, ma
|
||||
le dimensioni della finestra sono calcolate sul primo
|
||||
passato, quindi occorre dare spazi se se ne prevede
|
||||
uno piu' lungo
|
||||
@END */
|
||||
// @cmember Setta il testo della finestra
|
||||
void set_text(const char* t);
|
||||
|
||||
/* FPUB */
|
||||
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16);
|
||||
// @cmember Costruttore
|
||||
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16);
|
||||
// @cmember Distruttore
|
||||
virtual ~TIndwin();
|
||||
};
|
||||
|
||||
/*
|
||||
@C
|
||||
class TProgind : public TIndwin
|
||||
@END
|
||||
*/
|
||||
|
||||
// @class TProgind | Classe per la gestione della barra di attesa di una applicazione
|
||||
//
|
||||
// @base public | TIndwin
|
||||
class TProgind : public TIndwin
|
||||
// @author:(INTERNAL) Villa
|
||||
{
|
||||
// @access Public Member
|
||||
public:
|
||||
/* @FPUB */
|
||||
void setmax(long m) { _max = m; }
|
||||
void setstatus(long l) { _status = l; update_bar(); do_events(); }
|
||||
void addstatus(long l) { setstatus(_status+l); }
|
||||
TProgind(long max, const char* txt = NULL, bool cancel = TRUE,
|
||||
bool bar = TRUE, int div = 10);
|
||||
virtual ~TProgind() {}
|
||||
// @cmember Setta il valore massimo della barra d'attesa
|
||||
void setmax(long m)
|
||||
{ _max = m; }
|
||||
// @cmember Setta lo stato della barra d'attesa
|
||||
void setstatus(long l)
|
||||
{ _status = l; update_bar(); do_events(); }
|
||||
// @cmember Aggiorna la barra d'attesa aggiungendo l'incremento fatto dell'applicazione
|
||||
void addstatus(long l)
|
||||
{ setstatus(_status+l); }
|
||||
// @cmember Costruttore
|
||||
TProgind(long max, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10);
|
||||
// @cmember Distruttore
|
||||
virtual ~TProgind()
|
||||
{}
|
||||
};
|
||||
|
||||
/*
|
||||
@C
|
||||
class TTimerind : public TIndwin
|
||||
@END
|
||||
*/
|
||||
|
||||
// @class TTimerind | Classe per la definizione di una barra d'attesa gestita
|
||||
// dal tempo e non dallo stato dell'applicazione
|
||||
//
|
||||
// @base public | TIndwin
|
||||
class TTimerind : public TIndwin
|
||||
// @author:(INTERNAL) Villa
|
||||
{
|
||||
/* @DPRIV */
|
||||
// @access Private Member
|
||||
|
||||
// @cmember Intervallo di tempo
|
||||
int _interval;
|
||||
// @cmember Indice di tempo
|
||||
static long _timer_id;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
/* @FPROT */
|
||||
// @cmember Gestisce gli eventi della finestra
|
||||
virtual void handler(WINDOW w, EVENT* e);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
/* @FPUB */
|
||||
TTimerind(long msec, const char* txt = NULL, bool cancel = TRUE,
|
||||
bool bar = TRUE, int div = 10, int interval = 1000);
|
||||
// @cmember Costruttore
|
||||
TTimerind(long msec, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10, int interval = 1000);
|
||||
// @cmember Distruttore
|
||||
virtual ~TTimerind();
|
||||
};
|
||||
|
||||
|
||||
/* @DPRIV */
|
||||
/* extern TIndwin* __indwin__p; */
|
||||
|
||||
/* @FPUB */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Non commentate perche' destinate a sparire
|
||||
void progind_create(long, char*, bool, bool, int);
|
||||
void progind_set_status(long);
|
||||
void progind_cancel();
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <scanner.h>
|
||||
|
||||
//@doc EXTERNAL
|
||||
|
||||
HIDDEN const char* strlwr (const char* str)
|
||||
{
|
||||
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
|
||||
@ -46,7 +48,9 @@ const TString& TScanner::pop()
|
||||
return _token;
|
||||
}
|
||||
|
||||
TString& TScanner::line(char eol)
|
||||
// @mfunc Ritorna la linea letta dal file
|
||||
TString& TScanner::line(
|
||||
char eol) //@parm Carattere fino al quale leggere la riga (default EOL)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -13,35 +13,71 @@
|
||||
#include <xvt.h>
|
||||
#endif
|
||||
|
||||
// @C
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TScanner | Classe per le lettura e la traduzione dei file
|
||||
//
|
||||
// @base private | ifstream
|
||||
class TScanner : private ifstream
|
||||
// @author:(INTERNAL) Guido
|
||||
{
|
||||
// @DPRIV
|
||||
TString _token, _key, _buffer;
|
||||
// @access Private Member
|
||||
// @cmember Prossimo teoken
|
||||
TString _token;
|
||||
// @cmember Chiave del token (prime due lettere)
|
||||
TString _key;
|
||||
// @cmember Buffer utilizzato per la lettura della riga da file
|
||||
TString _buffer;
|
||||
// @cmember Indica se il token e' stato ritornato al file
|
||||
bool _pushed;
|
||||
// @cmember Numero della linea in corso di lettura
|
||||
word _line;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @FPUB
|
||||
TScanner(const char* filename);
|
||||
~TScanner() {}
|
||||
// @cmember Costruttore
|
||||
TScanner(const char* filename);
|
||||
// @cmember Distruttore
|
||||
~TScanner()
|
||||
{}
|
||||
// @cmember Legge il token dal file e lo ritorna
|
||||
const TString& pop();
|
||||
const TString& key() const { return _key; }
|
||||
const TString& popkey() { pop(); return key(); }
|
||||
// @cmember Ritorna la chiave del token attivo
|
||||
const TString& key() const
|
||||
{ return _key; }
|
||||
// @cmember Legge il token dal file e ne ritorna la chiave
|
||||
const TString& popkey()
|
||||
{ pop(); return key(); }
|
||||
// @cmember Legge una stringa (la stringa deve essere tra apici) dal file
|
||||
const TString& string();
|
||||
// @cmember Ritorna la linea letta dal file
|
||||
TString& line(char eol = '\n');
|
||||
const TString& equal() { return line('='); }
|
||||
// @cmember Ritorna il contenuto della linea fino al segno di uguale (chiama <mf TScanner::line>)
|
||||
const TString& equal()
|
||||
{ return line('='); }
|
||||
// @cmember Legge le coordinate del campo dal file e ne setta le dimensioni
|
||||
void rectangle(RCT& rect);
|
||||
// @cmember Ritorna un intero letto dal file
|
||||
int integer();
|
||||
// @cmember Ritorna un float letto dal file
|
||||
double number();
|
||||
// @cmember Ritorna un operando letto dal file
|
||||
const TString& operand();
|
||||
// @cmember Cerca il paragrafo specificato e ci si posiziona sopra
|
||||
bool paragraph(const char* name);
|
||||
|
||||
bool ok() { return good(); }
|
||||
// @cmember Ritorno TRUE se il file non e' in nessun stato di errore
|
||||
bool ok()
|
||||
{ return good(); }
|
||||
|
||||
// @cmember Mette nel file l'ultima stringa letta o quella specificata
|
||||
void push(const char* tok = NULL);
|
||||
const TString& token() const { return _token; }
|
||||
word linenum() { return _line; }
|
||||
// @cmember Ritorna il token letto
|
||||
const TString& token() const
|
||||
{ return _token; }
|
||||
// @cmember Ritorna il numero di linea corrente
|
||||
word linenum()
|
||||
{ return _line; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -90,7 +90,19 @@ void TSort::reset(int len)
|
||||
}
|
||||
|
||||
|
||||
void TSort::addsortkey(int pos, int len, char direction)
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Inizializza una chiave di ordinamento per il sort
|
||||
void TSort::addsortkey(
|
||||
int pos, // @parm Posizione di inizio
|
||||
int len, // @parm Lunghezza della chiave
|
||||
char direction) // @parm Direzione di ordinamento ('a'= ascendente, 'd'=discendente)
|
||||
// @parm TRecfield& | f | Campo di file da utilizzare come criterio di ordinamento
|
||||
|
||||
// @syntax addsortkey(int pos, int len, char direction = 'a');
|
||||
// @syntax addsortkey(TRecfield& f, char direction = 'a');
|
||||
|
||||
// @comm Nel secondo caso viene ordinato il sort utilizzando il campo di un file
|
||||
|
||||
{
|
||||
CHECK(pos >= 0 && pos+len <= _sortvar->rc_len, "Invalid sort key");
|
||||
|
@ -2,48 +2,56 @@
|
||||
#define __SORT_H
|
||||
|
||||
#ifndef __OBJECT_H
|
||||
#include <object.h>
|
||||
#include <object.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
@(SH) Header
|
||||
|
||||
@(C#) PUBBLICHE
|
||||
|
||||
@(C$) PRIVATE
|
||||
@(VG#) PUBBLICHE
|
||||
@(VG$) PRIVATE
|
||||
*/
|
||||
|
||||
// @C
|
||||
// Classe TSort
|
||||
// @END
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TSort | Classe per l'ordinamento di strutture o di record
|
||||
//
|
||||
// @base public | TObject
|
||||
class TSort : public TObject
|
||||
// @author:(INTERNAL) Alex
|
||||
{
|
||||
// @DPRIV
|
||||
friend TRecfield;
|
||||
struct s_prm* _sortvar; // Puntatore alla struttura di un sort
|
||||
int nsortkey; // Indice nella tabella dei campi della chiave
|
||||
public:
|
||||
// @FPUB
|
||||
void init(); // Chiama init_sort
|
||||
void sort(const char * record); // Chiama sort (record)
|
||||
void endsort(); // Chiama sort (NULL)
|
||||
const char* retrieve(); // Chiama sort_op()
|
||||
void stats(); // Chiama sort_stats
|
||||
// @access Private Member
|
||||
|
||||
int length() const; // Ritorna la lunghezza del record di sort
|
||||
void reset(int len); // Imposta la lunghezza del record di sort
|
||||
// e inizializza il sort
|
||||
// @friend TRecfield
|
||||
friend TRecfield;
|
||||
|
||||
// @cmember Puntatore alla struttura di un sort
|
||||
struct s_prm* _sortvar;
|
||||
// @cmember Indice nella tabella dei campi della chiave
|
||||
int nsortkey;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Inizializza il sort
|
||||
void init();
|
||||
// @cmember Aggiunge un record al sort
|
||||
void sort(const char * record);
|
||||
// @cmember Chiude il sort
|
||||
void endsort();
|
||||
// @cmember Restituisce il prossimo record ordinato (ultimo NULL)
|
||||
const char* retrieve();
|
||||
// @cmember Stampa una statistica sul sort
|
||||
void stats();
|
||||
|
||||
// @cmember Ritorna la lunghezza del record di sort
|
||||
int length() const;
|
||||
// @cmember Imposta la lunghezza del record di sort e inizializza il sort
|
||||
void reset(int len);
|
||||
// @cmember Inizializza una chiave di ordinamento per il sort
|
||||
void addsortkey(int pos, int len, char direction = 'a');
|
||||
// @cmember Inizializza una chiave di ordinamento per il sort usando il campo di un file
|
||||
void addsortkey(TRecfield& f, char direction = 'a');
|
||||
|
||||
// @cmember Costruttore
|
||||
TSort(int reclen = 0);
|
||||
// @cmember Distruttore
|
||||
virtual ~TSort();
|
||||
};
|
||||
#endif // __SORT_H
|
||||
|
@ -15,14 +15,38 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
int remove(const char* path)
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Permette di rimuovere un file (chiama unlink)
|
||||
//
|
||||
// @rdesc Ritorna il risultato dell'operazione
|
||||
//
|
||||
// @flag 0 | Se l'operazione ha successo
|
||||
// @flag -1 | Se l'operazione non e' riuscita. Viene inoltre settata la variabile
|
||||
// <p errno> con la causa dell'insuccesso
|
||||
int remove(
|
||||
const char* path) // @parm Nome del file da eliminare (non valgono i caratteri jolly)
|
||||
{ return unlink(path); }
|
||||
|
||||
#endif
|
||||
|
||||
#define __UTILITY_CPP
|
||||
#include <utility.h>
|
||||
|
||||
bool fcopy(const char* orig, const char* dest, bool append)
|
||||
// @func Permette di copiare un file
|
||||
//
|
||||
// @rdesc Ritorna il risultato dell'operazione:
|
||||
//
|
||||
// @flag TRUE | Se l'operazione e' stata effettuata con successo
|
||||
// @flag FALSE | Se l'operazione non e' stata effettuata con successo
|
||||
bool fcopy(
|
||||
const char* orig, // @parm Nome del file di origine
|
||||
const char* dest, // @parm Nome del file di destinazione
|
||||
bool append) // @parm Controllo per aggiungere il contenuto del
|
||||
// file <p dest> in coda al file <p orig> (default FALSE)
|
||||
|
||||
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
|
||||
// creati dei box di comunicazione che indicano la causa del problema
|
||||
{
|
||||
const char* wflag;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
@ -64,14 +88,26 @@ bool fcopy(const char* orig, const char* dest, bool append)
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool fexist(const char* file)
|
||||
// @func Controlla l'esistenza di un file
|
||||
//
|
||||
// @rdesc Ritrona i seguenti valori:
|
||||
//
|
||||
// @flag TRUE | Se il file esiste
|
||||
// @flag FALSE | Se il file non esiste
|
||||
bool fexist(
|
||||
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
|
||||
{
|
||||
return access(file, F_OK) == 0;
|
||||
}
|
||||
|
||||
|
||||
bool make_dir(const char* dir)
|
||||
// @func Permette di creare una directory
|
||||
//
|
||||
// @rdesc Ritorna il risultato dell'operazione
|
||||
//
|
||||
// @flag TRUE | Se l'operazione e' avvenuta con successo
|
||||
// @flag FALSE | Se l'operazione non e' riuscita
|
||||
bool make_dir(
|
||||
const char* dir) // @parm Nome della directory da creare
|
||||
{
|
||||
int res =
|
||||
#if XVT_OS==XVT_OS_WIN
|
||||
@ -84,7 +120,17 @@ bool make_dir(const char* dir)
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
||||
int list_files(TToken_string& filelist)
|
||||
// @func Setta la token string modificando la lista dei file formata con caratteri jolly
|
||||
// in lista con caratteri estesi
|
||||
//
|
||||
// @rdesc Ritorna il numero di file che soddisfano la condizione passata (numero di elementi
|
||||
// della token string)
|
||||
int list_files(
|
||||
TToken_string& filelist) // @parm Stringa contenente la condizione di estrazione
|
||||
// della lista dei file
|
||||
|
||||
// @comm Per comodita' la lista desiderata vine anch'essa messa in <p filelist> in quanto e'
|
||||
// gia' costruita
|
||||
{
|
||||
TFilename dir(filelist.get(0));
|
||||
for (int i = dir.len()-1; i >= 0; i--)
|
||||
@ -124,9 +170,15 @@ int list_files(TToken_string& filelist)
|
||||
|
||||
#endif
|
||||
|
||||
// Best function of the year
|
||||
// Certified 99%
|
||||
char* format(const char* fmt, ...)
|
||||
// @func Permette di ritornare una stringa formata da parametri
|
||||
//
|
||||
// @rdesc Ritorna la stringa desiderata
|
||||
char* format(
|
||||
const char* fmt, ...) // @parm Formato che deve essere dato alla stringa
|
||||
|
||||
// @comm Il funzionamento e' come la <f sprintf> del C, solo che non e' necessario passare la
|
||||
// stringa di destinazione alla funzione
|
||||
{
|
||||
va_list pars;
|
||||
|
||||
@ -139,8 +191,12 @@ char* format(const char* fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
// Converte la coppia nome-parametro in una stringa una che identifica il programma
|
||||
const char* cmd2name(const char* argv0, const char* argv1)
|
||||
// @func Converte la coppia nome-parametro in una stringa che identifica il programma
|
||||
//
|
||||
// @rdesc Ritorna la stringa identificante il programma
|
||||
const char* cmd2name(
|
||||
const char* argv0, // @parm Nome del programma
|
||||
const char* argv1) // @parm Nome del parametro (default "")
|
||||
{
|
||||
TFilename app(argv0);
|
||||
app = app.name();
|
||||
@ -149,7 +205,7 @@ const char* cmd2name(const char* argv0, const char* argv1)
|
||||
app.lower();
|
||||
|
||||
const int par = app.find(" -");
|
||||
const int num = par > 0 ? atoi(app.mid(par+2))+1 : 1;
|
||||
const int num = par > 0 ? atoi(app.mid(par+2))+1 : 1;
|
||||
|
||||
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
||||
app.cut(3);
|
||||
@ -176,8 +232,11 @@ HIDDEN int ctoi(char c)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rtoi(const char * val)
|
||||
// @func Converte una cifra romana in intero normale
|
||||
//
|
||||
// @rdesc Ritorna l'equivalente in numeri della cifra romane
|
||||
int rtoi(
|
||||
const char * val) // @parm Stringa contenente la cifra scritta in numeri romani
|
||||
{
|
||||
if (val == NULL) return 0;
|
||||
|
||||
@ -194,7 +253,11 @@ int rtoi(const char * val)
|
||||
return (value == 0) ? tot : -1;
|
||||
}
|
||||
|
||||
const char* itor(int num)
|
||||
// @func Converte un numero intero nell'equivalente cifra romana
|
||||
//
|
||||
// @rdesc Ritorna una stringa contenente la cifra romana
|
||||
const char* itor(
|
||||
int num) // @parm Intero da convertire in cifra romana
|
||||
{
|
||||
HIDDEN char roman_string[16];
|
||||
int cifra = 0;
|
||||
@ -228,8 +291,13 @@ const char* itor(int num)
|
||||
return roman_string;
|
||||
}
|
||||
|
||||
const char *esc(const char* s)
|
||||
// @func Permette di codificare i caratteri di escape
|
||||
//
|
||||
// @rdesc Ritorna il carattere codificato
|
||||
const char *esc(
|
||||
const char* s) // @parm Carattere da codificare
|
||||
|
||||
// @comm Viene utilizzata soprattuto in UNIX.
|
||||
{
|
||||
const char *s1 = s;
|
||||
char *s2 = __tmp_string;
|
||||
@ -294,7 +362,13 @@ const char *esc(const char* s)
|
||||
|
||||
HIDDEN const char * const key = "QSECOFR-";
|
||||
|
||||
const char * encode( const char * data)
|
||||
// @func Permette di criptare una parola
|
||||
//
|
||||
// @rdesc Ritorna la stringa criptata
|
||||
const char * encode(
|
||||
const char * data) // @parm Stringa da criptare
|
||||
|
||||
// @xref <f decode>
|
||||
{
|
||||
for (int i = 0; data[i]; i++)
|
||||
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
||||
@ -302,7 +376,13 @@ const char * encode( const char * data)
|
||||
return __tmp_string;
|
||||
}
|
||||
|
||||
const char * decode( const char * data)
|
||||
// @func Permette di decodificare una stringa criptata
|
||||
//
|
||||
// @rdesc Ritorna la stringa in chiaro
|
||||
const char * decode(
|
||||
const char * data) // @parm Stringa criptata da tradurre
|
||||
|
||||
// @xref <f encode>
|
||||
{
|
||||
for (int i = 0; data[i]; i++)
|
||||
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
||||
@ -312,7 +392,16 @@ const char * decode( const char * data)
|
||||
|
||||
#if XVT_OS != XVT_OS_WIN
|
||||
|
||||
int stricmp(const char* s1, const char* s2)
|
||||
// @func Permette di confrontare due stringhe ignorando la differenza
|
||||
// tra lettere maiuscole o minuscole
|
||||
//
|
||||
// @rdesc Ritorna il risultato dell'operazione:
|
||||
//
|
||||
// @flag 0 | Se le stringhe sono uguali
|
||||
// @flag >0 | Se le stringhe sono differenti. Il numero indica la lettera diversa
|
||||
int stricmp(
|
||||
const char* s1, // @parm Prima stringa da confrontare
|
||||
const char* s2) // @parm Seconda stringa da confrontare
|
||||
{
|
||||
for(int d = 0 ; (d = toupper(*s1)-toupper(*s2)) == 0; s1++, s2++)
|
||||
if (*s1 == '\0' && *s2 == '\0')
|
||||
@ -324,7 +413,17 @@ int stricmp(const char* s1, const char* s2)
|
||||
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
char * tempnam(const char * dir , const char * prefix)
|
||||
// @func Costruisce il percorso per un file temporaneo
|
||||
//
|
||||
// @rdesc Ritorna il nome assoluto del file temporaneo
|
||||
char * tempnam(
|
||||
const char * dir , // @parm Nome della directory nel quale inserire il file temporaneo
|
||||
const char * prefix) // @parm Evenutale prefisso da dare al file temporaneo
|
||||
|
||||
// @comm Il nome della directory viene letto dalla variabile d'ambiente chiamata
|
||||
// TMP, solo nel caso questa non esista viene utilizzato il nome passato
|
||||
// in <p dir>.
|
||||
// <nl>E' definita solo nel caso si utilizzi il WATCOM C/C++.
|
||||
|
||||
{
|
||||
TFilename tmpdir(getenv("TMP"));
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
/* @FPUB */
|
||||
// @doc EXTERNAL
|
||||
|
||||
char* format (const char* fmt, ...);
|
||||
const char* cmd2name(const char* argv0, const char* argv1 = "");
|
||||
int rtoi(const char * roman);
|
||||
@ -17,7 +18,15 @@ bool make_dir(const char* file);
|
||||
int list_files(TToken_string& names);
|
||||
const char * encode(const char* data);
|
||||
const char * decode(const char* data);
|
||||
inline bool is_not_slash(char s) { return s != '\\' && s != '/'; }
|
||||
// @func Controlla se il carattere passato e' il simbolo di slash ('\\' oppure '/')
|
||||
//
|
||||
// @rdesc Ritorna i seguneti valori:
|
||||
//
|
||||
// @flag TRUE | Se il carattere <p s> e' uno slash
|
||||
// @flag FALSE | Se il carattere <p s> non e' uno slash
|
||||
inline bool is_not_slash(
|
||||
char s) // @parm Carattere da confrontare
|
||||
{ return s != '\\' && s != '/'; }
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
int stricmp(const char*, const char*);
|
||||
@ -38,6 +47,4 @@ extern char __tmp_string[1024];
|
||||
#endif
|
||||
|
||||
|
||||
/* @END */
|
||||
#endif /* __UTILITY_H */
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
extern "C" { long nap(long period); }
|
||||
#endif
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// ERROR HOOK che intercetta errori XVT
|
||||
// put breakpoint here
|
||||
|
||||
@ -295,8 +297,16 @@ static void createwindow_hook(DWORD* exstyle, LPCSTR* classname, LPCSTR* windown
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent)
|
||||
// @func Calcola dimensioni e posizione di un controllo contenuto nella finestra
|
||||
//
|
||||
// @rdesc Ritorna il rettangolo
|
||||
RCT& resize_rect(
|
||||
short x, // @parm Coordinata x del controllo (espresso in caratteri)
|
||||
short y, // @parm Coordinata y del controllo (espresso in caratteri)
|
||||
short dx, // @parm Larghezza del controllo (espresso in caratteri)
|
||||
short dy, // @parm Altezza del controllo (espresso in caratteri)
|
||||
WIN_TYPE wt, // @parm Tipo di controllo da creare
|
||||
WINDOW parent) // @parm Identificatore della finestra padre
|
||||
{
|
||||
static RCT r;
|
||||
|
||||
@ -398,7 +408,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
// @func Emette un suono di default
|
||||
void beep()
|
||||
{ xvt_scr_beep(); }
|
||||
|
||||
@ -452,6 +462,7 @@ void TEvent_manager::pop()
|
||||
}
|
||||
}
|
||||
|
||||
// @func Processa tutti gli eventi rimasti in coda
|
||||
void do_events()
|
||||
{
|
||||
xvt_app_process_pending_events();
|
||||
@ -461,7 +472,14 @@ void do_events()
|
||||
#endif
|
||||
}
|
||||
|
||||
KEY e_char_to_key(const EVENT* ep)
|
||||
// @func Permette di convertire un evento carattere in un codice carattere premuto
|
||||
//
|
||||
// @rdesc Ritorna il codice del carattere corrispondente all'evento
|
||||
KEY e_char_to_key(
|
||||
const EVENT* ep) // @parm Evento da codificare
|
||||
|
||||
// @comm Viene controllato se l'evento e' un e_car e viene tradotto, in caso
|
||||
// controrio viene emesso un segnale d'errore.
|
||||
{
|
||||
CHECK(ep->type == E_CHAR, "I can't convert a Non-E_CHAR event to a key");
|
||||
|
||||
@ -474,7 +492,12 @@ KEY e_char_to_key(const EVENT* ep)
|
||||
return key;
|
||||
}
|
||||
|
||||
void dispatch_e_menu(WINDOW win, MENU_TAG item)
|
||||
// @func Simula la scelta di una voce di menu
|
||||
void dispatch_e_menu(
|
||||
WINDOW win, // @parm Finestra che contiene il menu
|
||||
MENU_TAG item) // @parm Voce del menu da selezionare
|
||||
|
||||
// @xref <f dispatch_e_char> <f dispatch_e_scroll>
|
||||
{
|
||||
EVENT e;
|
||||
|
||||
@ -484,7 +507,12 @@ void dispatch_e_menu(WINDOW win, MENU_TAG item)
|
||||
EM.push(win, e);
|
||||
}
|
||||
|
||||
void dispatch_e_char(WINDOW win, KEY key)
|
||||
// @func Simula la scelta di una combinazione di caratteri
|
||||
void dispatch_e_char(
|
||||
WINDOW win, // @parm Finestra che contiene il menu
|
||||
KEY key) // @parm Combinazione di caratteri da utilizzare
|
||||
|
||||
// @xref <f dispatch_e_menu> <f dispatch_e_scroll>
|
||||
{
|
||||
EVENT e;
|
||||
|
||||
@ -501,7 +529,12 @@ void dispatch_e_char(WINDOW win, KEY key)
|
||||
EM.push(win, e);
|
||||
}
|
||||
|
||||
void dispatch_e_scroll(WINDOW win, KEY key)
|
||||
// @func Simula uno scroll all'interno di una finestra
|
||||
void dispatch_e_scroll(
|
||||
WINDOW win, // @parm Finestra nella quale operare
|
||||
KEY key) // @parm Tasto utilizzato per lo scroll nella finestra
|
||||
|
||||
// @xref <f dispatch_e_menu> <f dispatch_e_char>
|
||||
{
|
||||
EVENT e;
|
||||
EVENT_TYPE& t = e.type;
|
||||
@ -561,8 +594,13 @@ void dispatch_e_scroll(WINDOW win, KEY key)
|
||||
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
||||
}
|
||||
|
||||
void customize_colors()
|
||||
// @func Permette di cambiare i colori attivi del programma
|
||||
void customize_colors()
|
||||
|
||||
// @comm Legge dal file di configurazione i colori scelti dall'utente e
|
||||
// ne setta le variabili in modo da poter personalizzare i colori
|
||||
//
|
||||
// @xref <c TConfig>
|
||||
{
|
||||
TConfig colors(CONFIG_USER, "Colors");
|
||||
|
||||
@ -577,7 +615,9 @@ void customize_colors()
|
||||
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
||||
}
|
||||
|
||||
void customize_controls(bool on)
|
||||
// @func Stabilisce i parametri standard dei controlli
|
||||
void customize_controls(
|
||||
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||
|
||||
{
|
||||
customize_colors();
|
||||
@ -704,7 +744,12 @@ XVT_FNTID xvt_default_font()
|
||||
return DEF_FONT;
|
||||
}
|
||||
|
||||
void xvt_set_font(WINDOW win, const char* family, int style, int dim)
|
||||
// @func Permette di settare il font attivo nella finestra
|
||||
void xvt_set_font(
|
||||
WINDOW win, // @parm Finestra nella quale settare il font
|
||||
const char* family, // @parm Nome del font da settare
|
||||
int style, // @parm Stile da applicare al font
|
||||
int dim) // @parm Dimensione del font
|
||||
{
|
||||
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||
|
||||
@ -731,15 +776,22 @@ void xvt_set_font(WINDOW win, const char* family, int style, int dim)
|
||||
#endif
|
||||
}
|
||||
|
||||
// @func Permette di creare una finestra
|
||||
//
|
||||
// @rdesc Ritorna l'identificatore della finestra creata
|
||||
WINDOW xvt_create_window(
|
||||
WIN_TYPE wt, // @parm Tipo di finestra da creare
|
||||
short x, // @parm Coordinata x della finestra (espresso in caratteri)
|
||||
short y, // @parm Coordinata y della finestra (espresso in caratteri)
|
||||
short dx, // @parm Larghezza della finestra (espresso in caratteri)
|
||||
short dy, // @parm Altezza della finestra (espresso in caratteri)
|
||||
const char* caption, // @parm Titolo da assegnare alla finestra
|
||||
int menu, // @parm Menu della finestra (definito nelle risorse, 0=senza)
|
||||
WINDOW parent, // @parm Identificatore della finestra padre
|
||||
long flags, // @parm Attributi della finestra
|
||||
EVENT_HANDLER eh, // @parm Funzioni per la gestione degli eventi diretti alla finestra
|
||||
long app_data) // @parm Puntatore alla classe C++ che gestisce la finestra
|
||||
|
||||
WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption,
|
||||
int menu,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
EVENT_HANDLER eh, long app_data
|
||||
)
|
||||
{
|
||||
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
||||
|
||||
@ -769,13 +821,20 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
return win;
|
||||
}
|
||||
|
||||
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)
|
||||
// @func Permette di creare i controlli all'interno di una finestra
|
||||
//
|
||||
// @rdesc Ritorna la finestra del controllo
|
||||
WINDOW xvt_create_control(
|
||||
WIN_TYPE wt, // @parm Tipo di controllo da creare
|
||||
short x, // @parm Coordinata x del control
|
||||
short y, // @parm Coordinata y del control
|
||||
short dx, // @parm Larghezza della control
|
||||
short dy, // @parm Altezza della control
|
||||
const char* caption, // @parm Titolo da assegnare alla control
|
||||
WINDOW parent, // @parm Identificatore della finestra padre
|
||||
long flags, // @parm Attributi della finestra
|
||||
long app_data, // @parm Puntatore alla classe C++ che gestisce la finestra
|
||||
int id) // @parm Indentificatore del controlllo
|
||||
{
|
||||
RCT r = resize_rect(x, y, dx, dy, wt, parent);
|
||||
WINDOW win = NULL_WIN;
|
||||
@ -859,8 +918,13 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
||||
return win;
|
||||
}
|
||||
|
||||
// @func Restituisce il titolo della finestra
|
||||
//
|
||||
// @rdesc Stringa contenente il titolo della finestra
|
||||
const char* xvt_get_title(
|
||||
WINDOW win) // @parm Finestra della quale si vuole conoscere il titolo
|
||||
|
||||
const char* xvt_get_title(WINDOW win)
|
||||
// @xref <f xvt_set_title>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
const TControl* c = TControl::WINDOW2TControl(win);
|
||||
@ -871,7 +935,12 @@ const char* xvt_get_title(WINDOW win)
|
||||
#endif
|
||||
}
|
||||
|
||||
void xvt_set_title(WINDOW win, const char* cap)
|
||||
// @func Permette di assegnare il titolo ad una finestra
|
||||
void xvt_set_title(
|
||||
WINDOW win, // @parm Finestra a cui assegnare il titolo
|
||||
const char* cap) // @parm Titolo da assegnare
|
||||
|
||||
// @xref <f xvt_get_title>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
@ -881,8 +950,9 @@ void xvt_set_title(WINDOW win, const char* cap)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void xvt_set_front_control(WINDOW win)
|
||||
// @func Permette di abilitare il focus su un controllo
|
||||
void xvt_set_front_control(
|
||||
WINDOW win) // @parm Finestra nella quale abilitare il focus
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
@ -891,8 +961,10 @@ void xvt_set_front_control(WINDOW win)
|
||||
xvt_scr_set_focus_vobj(win);
|
||||
}
|
||||
|
||||
|
||||
void xvt_enable_control(WINDOW win, bool on)
|
||||
// @func Permette di abilitare o disabilitare un controllo
|
||||
void xvt_enable_control(
|
||||
WINDOW win, // @parm Finestra all'interno della quale abilitare il controllo
|
||||
bool on) // @parm Abilita (TRUE) o disabilita (FALSE) il controllo
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
@ -902,8 +974,10 @@ void xvt_enable_control(WINDOW win, bool on)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void xvt_check_box(WINDOW win, bool on)
|
||||
// @func Permette di gestire un check box all'interno di una finestra
|
||||
void xvt_check_box(
|
||||
WINDOW win, // @parm Finestra all'interno della quale abilitare il check box
|
||||
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||
@ -913,8 +987,14 @@ void xvt_check_box(WINDOW win, bool on)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool xvt_get_checked_state(WINDOW win)
|
||||
// @func Permette di controllare se un controllo e' stato selezionato
|
||||
//
|
||||
// @rdesc Ritorna i seguenti valori:
|
||||
//
|
||||
// @flag TRUE | Se il controllo e' stato selezionato
|
||||
// @flag FALSE | Se il controllo non e' stato selezionato
|
||||
bool xvt_get_checked_state(
|
||||
WINDOW win) // @parm Finestra di cui si vuole conoscere lo stato
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
@ -924,8 +1004,11 @@ bool xvt_get_checked_state(WINDOW win)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
||||
// @func Permette di gestire un radio button all'interno di una finestra
|
||||
void xvt_check_radio_button(
|
||||
WINDOW win, // @parm Finestra all'interno della quale abilitare il radio button
|
||||
const WINDOW* ctls, // @parm Array di stringhe contenenti le scelte del radiobutton
|
||||
int count) // @parm Numero di elementi del radiobutton
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
for (int i = 0; i < count; i++)
|
||||
@ -935,8 +1018,13 @@ void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
||||
#endif
|
||||
}
|
||||
|
||||
// @func Permette di controllare lo stato di un radiobutton
|
||||
//
|
||||
// @rdesc Ritorna il numero dell'elemento del radiobutton selezionato
|
||||
int xvt_get_checked_radio(
|
||||
const WINDOW* ctls, // @parm Array di stringhe contenenti le scelte del radiobutton
|
||||
int count) // @parm Numero di elemnti del radiobutton
|
||||
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
if (xvt_get_checked_state(ctls[i])) return i;
|
||||
@ -955,7 +1043,12 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
||||
|
||||
HIDDEN WINDOW _statbar = NULL_WIN;
|
||||
|
||||
// @func Permette di creare la barra di stato del programma
|
||||
//
|
||||
// @rdesc Ritorna l'identificatore della barra di stato creata
|
||||
WINDOW xvt_create_statbar()
|
||||
|
||||
// @xref <f xvt_statbar_set> <f xvt_statbar_refresh>
|
||||
{
|
||||
CHECK(_statbar == NULL_WIN, "Onli uan stabar, plis");
|
||||
|
||||
@ -981,7 +1074,14 @@ WINDOW xvt_create_statbar()
|
||||
return _statbar;
|
||||
}
|
||||
|
||||
void xvt_statbar_set(const char* text, bool def)
|
||||
// @func Permette di settare una finestra con la barra di stato
|
||||
void xvt_statbar_set(
|
||||
const char* text, // @parm Testo da inserire nella barra di stato
|
||||
bool def) // @parm (default FALSE)
|
||||
|
||||
// @comm Nella barra di stato vi e' sempre presente la data del sistema
|
||||
//
|
||||
// @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
const TDate oggi(TODAY);
|
||||
@ -993,7 +1093,10 @@ void xvt_statbar_set(const char* text, bool def)
|
||||
#endif
|
||||
}
|
||||
|
||||
// @func Permette di cambiare il titolo alla barra di stato presente
|
||||
void xvt_statbar_refresh()
|
||||
|
||||
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
statbar_set_title(_statbar, NULL);
|
||||
@ -1019,8 +1122,15 @@ HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// @func Controlla se e' esiste una voce del menu'
|
||||
//
|
||||
// @rdesc Ritorna i seguenti valori
|
||||
//
|
||||
// @flag TRUE | Se esiste la voce di menu'
|
||||
// @flag FALSE | Se non esiste la voce di menu'
|
||||
bool xvt_test_menu_tag(
|
||||
MENU_TAG tag) // @parm Menu' nel quale cercare la voce
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag)
|
||||
{
|
||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||
const bool ok = test_menu_tag(mi, tag);
|
||||
@ -1029,10 +1139,12 @@ bool xvt_test_menu_tag(MENU_TAG tag)
|
||||
}
|
||||
|
||||
|
||||
// translation of graphics attributes from codes chars
|
||||
// used by print functions
|
||||
|
||||
COLOR trans_color(char c)
|
||||
// @func Permette di convertire in attributi grafici i codici caratteri usati
|
||||
// dalle funzioni di stampa
|
||||
//
|
||||
// @rdesc Ritorna il codice del colore convertito in attributo grafico
|
||||
COLOR trans_color(
|
||||
char c) // @parm Codice carattere da convertire
|
||||
{
|
||||
COLOR col;
|
||||
switch (c)
|
||||
@ -1067,7 +1179,12 @@ COLOR trans_color(char c)
|
||||
return col;
|
||||
}
|
||||
|
||||
PAT_STYLE trans_brush(char p)
|
||||
// @func Permette di converitire lo stile del pattern in attributi grafici da
|
||||
// codici carattere.
|
||||
//
|
||||
// @rdesc Ritorna il pattern convertito
|
||||
PAT_STYLE trans_brush(
|
||||
char p) // @parm Codice carattere da convertire
|
||||
{
|
||||
switch (p)
|
||||
{
|
||||
@ -1095,7 +1212,11 @@ PAT_STYLE trans_brush(char p)
|
||||
return PAT_NONE;
|
||||
}
|
||||
|
||||
PEN_STYLE trans_pen(char p)
|
||||
// @func Permette di convertire lo stile della penna da codice carattere
|
||||
//
|
||||
// @rdesc Ritorna lo stilo convertito
|
||||
PEN_STYLE trans_pen(
|
||||
char p) // @parm Codice carattere da convertire
|
||||
{
|
||||
PEN_STYLE ps = P_SOLID;
|
||||
switch (p)
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <keys.h>
|
||||
#endif
|
||||
|
||||
/* @FPUB */
|
||||
|
||||
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
|
||||
|
||||
@ -29,7 +28,7 @@ WINDOW xvt_create_window
|
||||
EVENT_HANDLER eh,
|
||||
long app_data
|
||||
);
|
||||
|
||||
|
||||
WINDOW xvt_create_control
|
||||
(
|
||||
WIN_TYPE wt,
|
||||
@ -65,6 +64,7 @@ WINDOW xvt_create_window
|
||||
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);
|
||||
// ??? NON LA TROVO NEL CPP ??? //
|
||||
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
@ -75,6 +75,4 @@ WINDOW xvt_create_window
|
||||
|
||||
extern short CHARX, CHARY, BASEY, ROWY;
|
||||
|
||||
/* @END */
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user