FIles fnormati
git-svn-id: svn://10.65.10.50/trunk@4171 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
831763f4fb
commit
5861624bfc
@ -1,3 +1,3 @@
|
||||
109
|
||||
0
|
||||
$mag|0|0|477|32|Giacenze di magazzino|||
|
||||
109
|
||||
0
|
||||
$mag|0|0|477|32|Giacenze di magazzino|||
|
||||
|
78
mg/f109.trr
78
mg/f109.trr
@ -1,39 +1,39 @@
|
||||
109
|
||||
34
|
||||
CODMAG|1|5|0|Codice magazzino e deposito
|
||||
CODART|1|20|0|Codice articolo
|
||||
LIVELLO|1|15|0|Livello di magazzino
|
||||
NRIGA|2|3|0|-numero riga per sheet anagrafica-
|
||||
ANNOES|2|4|0|Codice esercizio
|
||||
DATARIF|5|8|0|Data di riferimento
|
||||
UBICAZ|1|12|0|Codice ubicazione
|
||||
RIM|4|15|5|Rimanenze iniziali
|
||||
VALRIM|4|18|3|Valore rimanenze iniziali
|
||||
ACQ|4|15|5|Acquistato
|
||||
VALACQ|4|18|3|Valore acquistato
|
||||
ENT|4|15|5|Entrato
|
||||
VALENT|4|18|3|Valore entrato
|
||||
VEN|4|15|5|Venduto
|
||||
VALVEN|4|18|3|Valore venduto
|
||||
USC|4|15|5|Uscito
|
||||
VALUSC|4|18|3|Valore uscito
|
||||
GIAC|4|15|5|Giacenza
|
||||
ORDF|4|15|5|Ordinato fornitori
|
||||
VALORDF|4|18|3|Valore ordinato fornitori
|
||||
ORDC|4|15|5|Ordinato clienti
|
||||
VALORDC|4|18|3|Valore ordinato clienti
|
||||
INCL|4|15|5|In conto lavorazione
|
||||
ACL|4|15|5|A conto lavorazione
|
||||
PRODCOMP|4|15|5|Componenti in produzione
|
||||
PRODFIN|4|15|5|Assemblati in produzione
|
||||
NLABEL|4|10|0|Numero etichette da stampare
|
||||
NDIST|4|15|5|Distinte da scaricare
|
||||
SCARTI|4|15|5|Scarti
|
||||
VALSCARTI|4|15|5|Valore scarti
|
||||
LIVRIOR|4|15|3|Livello di riordino
|
||||
LOTTORIOR|4|15|3|Lotto minimo di riordino
|
||||
GIORNIRIOR|1|3|0|Numero di giorni di riordino
|
||||
SCORTAMIN|4|15|5|Scorta minima
|
||||
2
|
||||
ANNOES+CODART+NRIGA|
|
||||
ANNOES+CODMAG+CODART+LIVELLO|X
|
||||
109
|
||||
34
|
||||
CODMAG|1|5|0|Codice magazzino e deposito
|
||||
CODART|1|20|0|Codice articolo
|
||||
LIVELLO|1|15|0|Livello di magazzino
|
||||
NRIGA|2|3|0|-numero riga per sheet anagrafica-
|
||||
ANNOES|2|4|0|Codice esercizio
|
||||
DATARIF|5|8|0|Data di riferimento
|
||||
UBICAZ|1|12|0|Codice ubicazione
|
||||
RIM|4|15|5|Rimanenze iniziali
|
||||
VALRIM|4|18|3|Valore rimanenze iniziali
|
||||
ACQ|4|15|5|Acquistato
|
||||
VALACQ|4|18|3|Valore acquistato
|
||||
ENT|4|15|5|Entrato
|
||||
VALENT|4|18|3|Valore entrato
|
||||
VEN|4|15|5|Venduto
|
||||
VALVEN|4|18|3|Valore venduto
|
||||
USC|4|15|5|Uscito
|
||||
VALUSC|4|18|3|Valore uscito
|
||||
GIAC|4|15|5|Giacenza
|
||||
ORDF|4|15|5|Ordinato fornitori
|
||||
VALORDF|4|18|3|Valore ordinato fornitori
|
||||
ORDC|4|15|5|Ordinato clienti
|
||||
VALORDC|4|18|3|Valore ordinato clienti
|
||||
INCL|4|15|5|In conto lavorazione
|
||||
ACL|4|15|5|A conto lavorazione
|
||||
PRODCOMP|4|15|5|Componenti in produzione
|
||||
PRODFIN|4|15|5|Assemblati in produzione
|
||||
NLABEL|4|10|0|Numero etichette da stampare
|
||||
NDIST|4|15|5|Distinte da scaricare
|
||||
SCARTI|4|15|5|Scarti
|
||||
VALSCARTI|4|15|5|Valore scarti
|
||||
LIVRIOR|4|15|3|Livello di riordino
|
||||
LOTTORIOR|4|15|3|Lotto minimo di riordino
|
||||
GIORNIRIOR|1|3|0|Numero di giorni di riordino
|
||||
SCORTAMIN|4|15|5|Scorta minima
|
||||
2
|
||||
ANNOES+CODART+NRIGA|
|
||||
ANNOES+CODMAG+CODART+LIVELLO|X
|
||||
|
@ -1,3 +1,3 @@
|
||||
110
|
||||
0
|
||||
$movmag|0|0|125|32|Movimenti di magazzino (?)|||
|
||||
110
|
||||
0
|
||||
$movmag|0|0|125|32|Movimenti di magazzino (?)|||
|
||||
|
46
mg/f110.trr
46
mg/f110.trr
@ -1,23 +1,23 @@
|
||||
110
|
||||
16
|
||||
NUMREG|3|7|0|Numero di registrazione
|
||||
ANNOES|2|4|0|Codice esercizio
|
||||
DATAREG|5|8|0|Data registrazione
|
||||
DATACOMP|5|8|0|Data competenza
|
||||
DOCPROVV|1|1|0|Flag numeraz. provvisiora sul documento
|
||||
ANNODOC|5|8|0|Anno documento
|
||||
CODNUM|1|4|0|Codice numerazione documento
|
||||
NUMDOC|1|7|0|Numero documento
|
||||
CODLIST|1|3|0|Codice listino
|
||||
CODCONT|1|3|0|Codice contratto
|
||||
CODCAMP|1|3|0|Codcie campagna
|
||||
CODCAUS|1|4|0|Codice causale di magazzino
|
||||
DESCR|1|50|0|Descrizione
|
||||
TIPOCF|1|1|0|Tipo <C>liente / <F>ornitore
|
||||
CODCF|3|6|0|Codice cliente /fornitore
|
||||
NUMREGST|3|7|0|Numero di registrazione sul giornale
|
||||
4
|
||||
NUMREG|
|
||||
ANNOES+NUMREG|
|
||||
DATAREG+NUMREG|
|
||||
DATACOMP+NUMREG|
|
||||
110
|
||||
16
|
||||
NUMREG|3|7|0|Numero di registrazione
|
||||
ANNOES|2|4|0|Codice esercizio
|
||||
DATAREG|5|8|0|Data registrazione
|
||||
DATACOMP|5|8|0|Data competenza
|
||||
DOCPROVV|1|1|0|Flag numeraz. provvisiora sul documento
|
||||
ANNODOC|5|8|0|Anno documento
|
||||
CODNUM|1|4|0|Codice numerazione documento
|
||||
NUMDOC|1|7|0|Numero documento
|
||||
CODLIST|1|3|0|Codice listino
|
||||
CODCONT|1|3|0|Codice contratto
|
||||
CODCAMP|1|3|0|Codcie campagna
|
||||
CODCAUS|1|4|0|Codice causale di magazzino
|
||||
DESCR|1|50|0|Descrizione
|
||||
TIPOCF|1|1|0|Tipo <C>liente / <F>ornitore
|
||||
CODCF|3|6|0|Codice cliente /fornitore
|
||||
NUMREGST|3|7|0|Numero di registrazione sul giornale
|
||||
4
|
||||
NUMREG|
|
||||
ANNOES+NUMREG|
|
||||
DATAREG+NUMREG|
|
||||
DATACOMP+NUMREG|
|
||||
|
@ -1,3 +1,3 @@
|
||||
111
|
||||
0
|
||||
$rmovmag|0|0|87|32|Righe movimenti di magazzino|||
|
||||
111
|
||||
0
|
||||
$rmovmag|0|0|87|32|Righe movimenti di magazzino|||
|
||||
|
26
mg/f111.trr
26
mg/f111.trr
@ -1,13 +1,13 @@
|
||||
111
|
||||
8
|
||||
NUMREG|3|7|0|Numero di registrazione
|
||||
NRIG|2|4|0|Numero di riga
|
||||
CODMAG|1|5|0|Codice magazzino e deposito
|
||||
CODART|1|20|0|Codice articolo
|
||||
LIVGIAC|1|15|0|Livello di giacenza
|
||||
UM|1|2|0|Unita' di misura
|
||||
QUANT|4|15|5|Quantita'
|
||||
PREZZO|4|18|3|Prezzo
|
||||
2
|
||||
NUMREG+NRIG|
|
||||
CODMAG+CODART+NUMREG|X
|
||||
111
|
||||
8
|
||||
NUMREG|3|7|0|Numero di registrazione
|
||||
NRIG|2|4|0|Numero di riga
|
||||
CODMAG|1|5|0|Codice magazzino e deposito
|
||||
CODART|1|20|0|Codice articolo
|
||||
LIVGIAC|1|15|0|Livello di giacenza
|
||||
UM|1|2|0|Unita' di misura
|
||||
QUANT|4|15|5|Quantita'
|
||||
PREZZO|4|18|3|Prezzo
|
||||
2
|
||||
NUMREG+NRIG|
|
||||
CODMAG+CODART+NUMREG|X
|
||||
|
@ -1,3 +1,3 @@
|
||||
114
|
||||
0
|
||||
$stomag|0|0|64|32|Storico di magazzino|||
|
||||
114
|
||||
0
|
||||
$stomag|0|0|64|32|Storico di magazzino|||
|
||||
|
20
mg/f114.trr
20
mg/f114.trr
@ -1,10 +1,10 @@
|
||||
114
|
||||
6
|
||||
ANNOESRIF|2|4|0|Anno esercizio di riferimento
|
||||
CODART|1|20|0|Codice Articolo
|
||||
ANNOES|2|4|0|Anno di esercizio
|
||||
UM|1|2|0|Unita' di misura
|
||||
QUANT|4|15|5|Quantita'
|
||||
VALORE|4|18|3|Valore
|
||||
1
|
||||
ANNOESRIF+CODART+ANNOES|
|
||||
114
|
||||
6
|
||||
ANNOESRIF|2|4|0|Anno esercizio di riferimento
|
||||
CODART|1|20|0|Codice Articolo
|
||||
ANNOES|2|4|0|Anno di esercizio
|
||||
UM|1|2|0|Unita' di misura
|
||||
QUANT|4|15|5|Quantita'
|
||||
VALORE|4|18|3|Valore
|
||||
1
|
||||
ANNOESRIF+CODART+ANNOES|
|
||||
|
44
mg/mg0.cpp
44
mg/mg0.cpp
@ -1,22 +1,22 @@
|
||||
#include <xvt.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mg0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int rt = -1;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
rt = mg0100(argc,argv) ; break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
|
||||
return rt ;
|
||||
}
|
||||
#include <xvt.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mg0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int rt = -1;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
rt = mg0100(argc,argv) ; break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
|
||||
return rt ;
|
||||
}
|
||||
|
12
mg/mg0.h
12
mg/mg0.h
@ -1,6 +1,6 @@
|
||||
#ifndef __MG0_H
|
||||
#define __MG0_H
|
||||
|
||||
int mg0100(int argc, char* argv[]);
|
||||
|
||||
#endif // __MG0_H
|
||||
#ifndef __MG0_H
|
||||
#define __MG0_H
|
||||
|
||||
int mg0100(int argc, char* argv[]);
|
||||
|
||||
#endif // __MG0_H
|
||||
|
622
mg/mg0100.cpp
622
mg/mg0100.cpp
@ -1,311 +1,311 @@
|
||||
// gestione tabelle di magazzino
|
||||
#include <execp.h>
|
||||
#include <config.h>
|
||||
#include <printer.h>
|
||||
#include <tabapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <recarray.h>
|
||||
#include <utility.h>
|
||||
#include "batbcau.h"
|
||||
#include "batbfca.h"
|
||||
|
||||
#include "../cg/cglib03.h"
|
||||
#include "mglib01.h"
|
||||
|
||||
|
||||
#define MAXMETACH 20
|
||||
// maschere delle tabelle di magazzino
|
||||
class TMask_tabmag : public TMask
|
||||
{
|
||||
TTable *aux_tabf;
|
||||
TFile_cache *tab_cache;
|
||||
TMetachar * metac[MAXMETACH];
|
||||
|
||||
static bool sumsign_handler(TMask_field &, KEY); // handler
|
||||
static bool format_handler(TMask_field &, KEY); // handler dei metacaratteri
|
||||
static bool codliv_handler(TMask_field &, KEY); // handler del numero formato
|
||||
static bool numform_handler(TMask_field &, KEY); // handler del numero formato
|
||||
static bool codlivgca_handler(TMask_field &, KEY); // handler del numero formato
|
||||
|
||||
|
||||
public:
|
||||
TMask_tabmag(const char * ,const TString16 &);
|
||||
virtual ~TMask_tabmag();
|
||||
};
|
||||
|
||||
// costruttore della maschera
|
||||
TMask_tabmag::TMask_tabmag(const char * _maskname,const TString16 &tabname):
|
||||
TMask(_maskname)
|
||||
{
|
||||
aux_tabf=NULL;
|
||||
for (int i=0;i<MAXMETACH;i++)
|
||||
metac[i]=NULL;
|
||||
if (tabname == "CAU")
|
||||
{
|
||||
set_handler(F_SGNGIAC, sumsign_handler);
|
||||
}
|
||||
if (tabname == "FCA") // FORMATO CODICE ARTICOLI
|
||||
{
|
||||
metac[0]=new TMetachar;
|
||||
aux_tabf = new TTable("FCA");
|
||||
set_handler(F_FORMLIV, format_handler);
|
||||
set_handler(F_CODLIV, codliv_handler);
|
||||
}
|
||||
if (tabname == "GCA") // GRUPPI CODICE ARTICOLI
|
||||
{
|
||||
tab_cache = new TDecoder("FCA","S1");
|
||||
tab_cache->fill();
|
||||
// crea i riconoscitori del formato
|
||||
for (int i=1; ((TDecoder *)tab_cache)->decode(i)!="";i++)
|
||||
{
|
||||
metac[i-1]=new TMetachar(((TDecoder *)tab_cache)->decode(i));
|
||||
}
|
||||
set_handler(F_CODLIV, codlivgca_handler);
|
||||
set_handler(F_CODGROUP, numform_handler);
|
||||
}
|
||||
if (tabname == "FCG") // FORMATO CODICE GIACENZE
|
||||
{
|
||||
metac[0]=new TMetachar;
|
||||
aux_tabf = new TTable("FCG");
|
||||
set_handler(F_FORMLIV, format_handler);
|
||||
set_handler(F_CODLIV, codliv_handler);
|
||||
}
|
||||
if (tabname == "GCG") // GRUPPI CODICE GIACENZE
|
||||
{
|
||||
tab_cache = new TDecoder("FCG","S1");
|
||||
tab_cache->fill();
|
||||
for (int i=1; ((TDecoder *)tab_cache)->decode(i)!="";i++)
|
||||
{
|
||||
metac[i-1]=new TMetachar(((TDecoder *)tab_cache)->decode(i));
|
||||
}
|
||||
set_handler(F_CODGROUP, numform_handler);
|
||||
}
|
||||
}
|
||||
|
||||
TMask_tabmag::~TMask_tabmag()
|
||||
{
|
||||
if (aux_tabf!=NULL)
|
||||
delete aux_tabf;
|
||||
for (int i=0;i<MAXMETACH;i++) {
|
||||
if (metac[i]!=NULL)
|
||||
delete metac[i];
|
||||
}
|
||||
}
|
||||
|
||||
// tabella causali: handler della somma segni
|
||||
bool TMask_tabmag::sumsign_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
if (f.mask().get_int(F_SUMSIGN)!=0)
|
||||
{
|
||||
f.error_box("La somma dei segni ((GIAC-RIM)-(ACQ+ENTR)+(VEN+USC)+(ACL-INCL)+(PRODF-PRODC)) deve essere uguale a zero");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// HANDLER DEL FORMATO DEL LIVELLO
|
||||
bool TMask_tabmag::format_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TString s(f.get());
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
TTable * aux_tabf=mymask.aux_tabf;
|
||||
|
||||
s.strip_spaces();
|
||||
f.set(s);
|
||||
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",mymask.get_int(F_CODLIV)+1);
|
||||
if (aux_tabf->read()==NOERR)
|
||||
{
|
||||
// esiste il seguente:solo caratteri obbligatori
|
||||
if (mymask.metac[0]->has_opzchars(s))
|
||||
{
|
||||
f.error_box("I caratteri di formato opzionali ('%s') sono consentiti solo per l'ultimo livello",mymask.metac[0]->opz_chars());
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
// ultimo livello: almeno un carattere obbligatorio
|
||||
if (!mymask.metac[0]->has_mandchars(s))
|
||||
{
|
||||
f.error_box("Il codice dell'ultimo livello deve includere almeno un carattere obbligatorio (letterali o '%s') ",mymask.metac[0]->mand_chars());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// setta il campo con la lunghezza massima della stringa di formato
|
||||
mymask.field(F_LENFORM).set(mymask.metac[0]->maxstrlen(f.get()));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// HANDLER DEL CODICE LIVELLO
|
||||
bool TMask_tabmag::codliv_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
TTable * aux_tabf=mymask.aux_tabf;
|
||||
int codliv=atoi((const char *)f.get());
|
||||
|
||||
if (codliv>1)
|
||||
// Non è il primo codice
|
||||
{
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",codliv-1);
|
||||
if (aux_tabf->read()==NOERR)
|
||||
// esiste un precedente
|
||||
{
|
||||
TString prevformat(aux_tabf->get("S1"));
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",codliv+1);
|
||||
if (aux_tabf->read()!=NOERR && mymask.metac[0]->has_opzchars(prevformat))
|
||||
{
|
||||
f.error_box("Il livello precedente include caratteri opzionali nel formato");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
f.error_box("Non si possono inserire salti nel livello del codice");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// gestisce l'introduzione del codice del livello articoli
|
||||
bool TMask_tabmag::codlivgca_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if ((k == K_TAB && f.focusdirty())||k == K_ENTER )
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
|
||||
if (((TDecoder *)mymask.tab_cache)->decode(atoi((const char *)f.get())+1)=="")
|
||||
// non esiste un seguente
|
||||
{
|
||||
f.error_box("Non è possibile definire gruppi per l'ultimo livello di codice");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// HANDLER DEL CODICE LIVELLO giacenza
|
||||
// HANDLER DEL CODICE LIVELLO anagrafica
|
||||
bool TMask_tabmag::numform_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if ((k == K_TAB && f.focusdirty())||k == K_ENTER )
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
|
||||
if (!(mymask.metac[mymask.get_int(F_CODLIV)-1])->recognized(f.get()))
|
||||
{
|
||||
f.error_box("Codice non corrispondente al formato previsto");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// applicazione per la gestione delle tabelle di magazzino
|
||||
class Tab_app_mag : public Tab_application
|
||||
{
|
||||
|
||||
protected: // TRelation_application
|
||||
virtual bool user_destroy() ;
|
||||
virtual bool user_create() ;
|
||||
virtual bool protected_record(TRectype& rec) ;
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
virtual TMask * set_mask(TMask * _m=NULL);
|
||||
|
||||
public:
|
||||
Tab_app_mag();
|
||||
virtual ~Tab_app_mag() {}
|
||||
};
|
||||
|
||||
|
||||
HIDDEN inline Tab_app_mag& app() { return (Tab_app_mag&)main_app(); }
|
||||
// costruttore
|
||||
Tab_app_mag::Tab_app_mag() {}
|
||||
|
||||
|
||||
bool Tab_app_mag::protected_record(TRectype& rec)
|
||||
{
|
||||
bool prot = rec.get_bool(FPC);
|
||||
|
||||
if (!prot)
|
||||
{
|
||||
if (get_tabname()=="FCA" ||get_tabname()=="FCG" )
|
||||
{
|
||||
// non si possono cancellare i livelli intermedi:se non è l'ultimo livello, proteggilo
|
||||
TTable aux_tabf(get_tabname());
|
||||
aux_tabf.put("CODTAB",rec.get_int("CODTAB")+1);
|
||||
if (aux_tabf.read()==NOERR)
|
||||
prot=TRUE;
|
||||
}
|
||||
}
|
||||
return prot;
|
||||
}
|
||||
|
||||
// alloca/cambia la maschera dell'applicazione
|
||||
TMask * Tab_app_mag::set_mask(TMask * _m)
|
||||
{
|
||||
if (_m != NULL)
|
||||
return Tab_application::set_mask(_m);
|
||||
else
|
||||
return Tab_application::set_mask(new TMask_tabmag((const char *)mask_name(),get_tabname()));
|
||||
}
|
||||
|
||||
bool Tab_app_mag::user_create()
|
||||
{
|
||||
/*
|
||||
la Tab_application::user_create() apre la maschera TMask in modo automatico
|
||||
basandosi sul parametro passato sulla linea di comando e sulla convenzione
|
||||
nome = "BATB"+parametro;
|
||||
ORA:
|
||||
- questa convenzione cambierà per separare i programmi (e le maschere)
|
||||
dei vari pacchetti
|
||||
In tal caso ridefinire il metodo virtual mask_name()
|
||||
- secondo il nuovo stile, gli handler vanno posti in maschere derivate
|
||||
dalla TMask (TMask_tabmag, TMask_tabcau, ecc), pertanto occorre che
|
||||
la maschera aperta sia del tipo corretto
|
||||
per questo motivo la maschera viene creata dalla user_create()
|
||||
*/
|
||||
|
||||
bool ok = Tab_application::user_create();
|
||||
|
||||
if (ok)
|
||||
{
|
||||
//TMask& mask = *set_mask();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Tab_app_mag::user_destroy()
|
||||
{
|
||||
return Tab_application::user_destroy();
|
||||
}
|
||||
|
||||
int Tab_app_mag::rewrite(const TMask& m)
|
||||
{
|
||||
return Tab_application::rewrite(m);
|
||||
}
|
||||
|
||||
|
||||
int mg0100(int argc, char* argv[])
|
||||
{
|
||||
Tab_app_mag a;
|
||||
a.run(argc, argv, "Tabella");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// gestione tabelle di magazzino
|
||||
#include <execp.h>
|
||||
#include <config.h>
|
||||
#include <printer.h>
|
||||
#include <tabapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <recarray.h>
|
||||
#include <utility.h>
|
||||
#include "batbcau.h"
|
||||
#include "batbfca.h"
|
||||
|
||||
#include "../cg/cglib03.h"
|
||||
#include "mglib01.h"
|
||||
|
||||
|
||||
#define MAXMETACH 20
|
||||
// maschere delle tabelle di magazzino
|
||||
class TMask_tabmag : public TMask
|
||||
{
|
||||
TTable *aux_tabf;
|
||||
TFile_cache *tab_cache;
|
||||
TMetachar * metac[MAXMETACH];
|
||||
|
||||
static bool sumsign_handler(TMask_field &, KEY); // handler
|
||||
static bool format_handler(TMask_field &, KEY); // handler dei metacaratteri
|
||||
static bool codliv_handler(TMask_field &, KEY); // handler del numero formato
|
||||
static bool numform_handler(TMask_field &, KEY); // handler del numero formato
|
||||
static bool codlivgca_handler(TMask_field &, KEY); // handler del numero formato
|
||||
|
||||
|
||||
public:
|
||||
TMask_tabmag(const char * ,const TString16 &);
|
||||
virtual ~TMask_tabmag();
|
||||
};
|
||||
|
||||
// costruttore della maschera
|
||||
TMask_tabmag::TMask_tabmag(const char * _maskname,const TString16 &tabname):
|
||||
TMask(_maskname)
|
||||
{
|
||||
aux_tabf=NULL;
|
||||
for (int i=0;i<MAXMETACH;i++)
|
||||
metac[i]=NULL;
|
||||
if (tabname == "CAU")
|
||||
{
|
||||
set_handler(F_SGNGIAC, sumsign_handler);
|
||||
}
|
||||
if (tabname == "FCA") // FORMATO CODICE ARTICOLI
|
||||
{
|
||||
metac[0]=new TMetachar;
|
||||
aux_tabf = new TTable("FCA");
|
||||
set_handler(F_FORMLIV, format_handler);
|
||||
set_handler(F_CODLIV, codliv_handler);
|
||||
}
|
||||
if (tabname == "GCA") // GRUPPI CODICE ARTICOLI
|
||||
{
|
||||
tab_cache = new TDecoder("FCA","S1");
|
||||
tab_cache->fill();
|
||||
// crea i riconoscitori del formato
|
||||
for (int i=1; ((TDecoder *)tab_cache)->decode(i)!="";i++)
|
||||
{
|
||||
metac[i-1]=new TMetachar(((TDecoder *)tab_cache)->decode(i));
|
||||
}
|
||||
set_handler(F_CODLIV, codlivgca_handler);
|
||||
set_handler(F_CODGROUP, numform_handler);
|
||||
}
|
||||
if (tabname == "FCG") // FORMATO CODICE GIACENZE
|
||||
{
|
||||
metac[0]=new TMetachar;
|
||||
aux_tabf = new TTable("FCG");
|
||||
set_handler(F_FORMLIV, format_handler);
|
||||
set_handler(F_CODLIV, codliv_handler);
|
||||
}
|
||||
if (tabname == "GCG") // GRUPPI CODICE GIACENZE
|
||||
{
|
||||
tab_cache = new TDecoder("FCG","S1");
|
||||
tab_cache->fill();
|
||||
for (int i=1; ((TDecoder *)tab_cache)->decode(i)!="";i++)
|
||||
{
|
||||
metac[i-1]=new TMetachar(((TDecoder *)tab_cache)->decode(i));
|
||||
}
|
||||
set_handler(F_CODGROUP, numform_handler);
|
||||
}
|
||||
}
|
||||
|
||||
TMask_tabmag::~TMask_tabmag()
|
||||
{
|
||||
if (aux_tabf!=NULL)
|
||||
delete aux_tabf;
|
||||
for (int i=0;i<MAXMETACH;i++) {
|
||||
if (metac[i]!=NULL)
|
||||
delete metac[i];
|
||||
}
|
||||
}
|
||||
|
||||
// tabella causali: handler della somma segni
|
||||
bool TMask_tabmag::sumsign_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
if (f.mask().get_int(F_SUMSIGN)!=0)
|
||||
{
|
||||
f.error_box("La somma dei segni ((GIAC-RIM)-(ACQ+ENTR)+(VEN+USC)+(ACL-INCL)+(PRODF-PRODC)) deve essere uguale a zero");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// HANDLER DEL FORMATO DEL LIVELLO
|
||||
bool TMask_tabmag::format_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TString s(f.get());
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
TTable * aux_tabf=mymask.aux_tabf;
|
||||
|
||||
s.strip_spaces();
|
||||
f.set(s);
|
||||
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",mymask.get_int(F_CODLIV)+1);
|
||||
if (aux_tabf->read()==NOERR)
|
||||
{
|
||||
// esiste il seguente:solo caratteri obbligatori
|
||||
if (mymask.metac[0]->has_opzchars(s))
|
||||
{
|
||||
f.error_box("I caratteri di formato opzionali ('%s') sono consentiti solo per l'ultimo livello",mymask.metac[0]->opz_chars());
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
// ultimo livello: almeno un carattere obbligatorio
|
||||
if (!mymask.metac[0]->has_mandchars(s))
|
||||
{
|
||||
f.error_box("Il codice dell'ultimo livello deve includere almeno un carattere obbligatorio (letterali o '%s') ",mymask.metac[0]->mand_chars());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// setta il campo con la lunghezza massima della stringa di formato
|
||||
mymask.field(F_LENFORM).set(mymask.metac[0]->maxstrlen(f.get()));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// HANDLER DEL CODICE LIVELLO
|
||||
bool TMask_tabmag::codliv_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
TTable * aux_tabf=mymask.aux_tabf;
|
||||
int codliv=atoi((const char *)f.get());
|
||||
|
||||
if (codliv>1)
|
||||
// Non è il primo codice
|
||||
{
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",codliv-1);
|
||||
if (aux_tabf->read()==NOERR)
|
||||
// esiste un precedente
|
||||
{
|
||||
TString prevformat(aux_tabf->get("S1"));
|
||||
aux_tabf->zero();
|
||||
aux_tabf->put("CODTAB",codliv+1);
|
||||
if (aux_tabf->read()!=NOERR && mymask.metac[0]->has_opzchars(prevformat))
|
||||
{
|
||||
f.error_box("Il livello precedente include caratteri opzionali nel formato");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
f.error_box("Non si possono inserire salti nel livello del codice");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// gestisce l'introduzione del codice del livello articoli
|
||||
bool TMask_tabmag::codlivgca_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if ((k == K_TAB && f.focusdirty())||k == K_ENTER )
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
|
||||
if (((TDecoder *)mymask.tab_cache)->decode(atoi((const char *)f.get())+1)=="")
|
||||
// non esiste un seguente
|
||||
{
|
||||
f.error_box("Non è possibile definire gruppi per l'ultimo livello di codice");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// HANDLER DEL CODICE LIVELLO giacenza
|
||||
// HANDLER DEL CODICE LIVELLO anagrafica
|
||||
bool TMask_tabmag::numform_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if ((k == K_TAB && f.focusdirty())||k == K_ENTER )
|
||||
{
|
||||
TMask_tabmag & mymask=((TMask_tabmag &)f.mask());
|
||||
|
||||
if (!(mymask.metac[mymask.get_int(F_CODLIV)-1])->recognized(f.get()))
|
||||
{
|
||||
f.error_box("Codice non corrispondente al formato previsto");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// applicazione per la gestione delle tabelle di magazzino
|
||||
class Tab_app_mag : public Tab_application
|
||||
{
|
||||
|
||||
protected: // TRelation_application
|
||||
virtual bool user_destroy() ;
|
||||
virtual bool user_create() ;
|
||||
virtual bool protected_record(TRectype& rec) ;
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
virtual TMask * set_mask(TMask * _m=NULL);
|
||||
|
||||
public:
|
||||
Tab_app_mag();
|
||||
virtual ~Tab_app_mag() {}
|
||||
};
|
||||
|
||||
|
||||
HIDDEN inline Tab_app_mag& app() { return (Tab_app_mag&)main_app(); }
|
||||
// costruttore
|
||||
Tab_app_mag::Tab_app_mag() {}
|
||||
|
||||
|
||||
bool Tab_app_mag::protected_record(TRectype& rec)
|
||||
{
|
||||
bool prot = rec.get_bool(FPC);
|
||||
|
||||
if (!prot)
|
||||
{
|
||||
if (get_tabname()=="FCA" ||get_tabname()=="FCG" )
|
||||
{
|
||||
// non si possono cancellare i livelli intermedi:se non è l'ultimo livello, proteggilo
|
||||
TTable aux_tabf(get_tabname());
|
||||
aux_tabf.put("CODTAB",rec.get_int("CODTAB")+1);
|
||||
if (aux_tabf.read()==NOERR)
|
||||
prot=TRUE;
|
||||
}
|
||||
}
|
||||
return prot;
|
||||
}
|
||||
|
||||
// alloca/cambia la maschera dell'applicazione
|
||||
TMask * Tab_app_mag::set_mask(TMask * _m)
|
||||
{
|
||||
if (_m != NULL)
|
||||
return Tab_application::set_mask(_m);
|
||||
else
|
||||
return Tab_application::set_mask(new TMask_tabmag((const char *)mask_name(),get_tabname()));
|
||||
}
|
||||
|
||||
bool Tab_app_mag::user_create()
|
||||
{
|
||||
/*
|
||||
la Tab_application::user_create() apre la maschera TMask in modo automatico
|
||||
basandosi sul parametro passato sulla linea di comando e sulla convenzione
|
||||
nome = "BATB"+parametro;
|
||||
ORA:
|
||||
- questa convenzione cambierà per separare i programmi (e le maschere)
|
||||
dei vari pacchetti
|
||||
In tal caso ridefinire il metodo virtual mask_name()
|
||||
- secondo il nuovo stile, gli handler vanno posti in maschere derivate
|
||||
dalla TMask (TMask_tabmag, TMask_tabcau, ecc), pertanto occorre che
|
||||
la maschera aperta sia del tipo corretto
|
||||
per questo motivo la maschera viene creata dalla user_create()
|
||||
*/
|
||||
|
||||
bool ok = Tab_application::user_create();
|
||||
|
||||
if (ok)
|
||||
{
|
||||
//TMask& mask = *set_mask();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Tab_app_mag::user_destroy()
|
||||
{
|
||||
return Tab_application::user_destroy();
|
||||
}
|
||||
|
||||
int Tab_app_mag::rewrite(const TMask& m)
|
||||
{
|
||||
return Tab_application::rewrite(m);
|
||||
}
|
||||
|
||||
|
||||
int mg0100(int argc, char* argv[])
|
||||
{
|
||||
Tab_app_mag a;
|
||||
a.run(argc, argv, "Tabella");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
44
mg/mg1.cpp
44
mg/mg1.cpp
@ -1,22 +1,22 @@
|
||||
#include <xvt.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mg1.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int rt = -1;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
rt = mg1100(argc,argv) ; break; // gestione manuale movimenti
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
|
||||
return rt ;
|
||||
}
|
||||
#include <xvt.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mg1.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int rt = -1;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
rt = mg1100(argc,argv) ; break; // gestione manuale movimenti
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
|
||||
return rt ;
|
||||
}
|
||||
|
12
mg/mg1.h
12
mg/mg1.h
@ -1,6 +1,6 @@
|
||||
#ifndef __MG1_H
|
||||
#define __MG1_H
|
||||
|
||||
int mg1100(int argc, char* argv[]);
|
||||
|
||||
#endif // __MG1_H
|
||||
#ifndef __MG1_H
|
||||
#define __MG1_H
|
||||
|
||||
int mg1100(int argc, char* argv[]);
|
||||
|
||||
#endif // __MG1_H
|
||||
|
1020
mg/mg1100.cpp
1020
mg/mg1100.cpp
File diff suppressed because it is too large
Load Diff
1204
mg/mglib01.cpp
1204
mg/mglib01.cpp
File diff suppressed because it is too large
Load Diff
232
mg/mglib01.h
232
mg/mglib01.h
@ -1,116 +1,116 @@
|
||||
// *******************************
|
||||
// *******************************
|
||||
#define MANY_MAG_LEV 10
|
||||
class TMag_livelli {
|
||||
bool _enabled[MANY_MAG_LEV];
|
||||
int _code_lenght[MANY_MAG_LEV];
|
||||
TString _name[MANY_MAG_LEV];
|
||||
TString _picture[MANY_MAG_LEV];
|
||||
int _last_level;
|
||||
|
||||
public:
|
||||
int last_level() const {return _last_level;}; // Ritorna il numero di livelli abilitati
|
||||
const bool enabled(int levnum=1); // Ritorna se il livello è abilitato
|
||||
const TString & name(int levnum); // Ritorna il nome (descrizione) di quel livello
|
||||
const TString & picture(int levnum);// Ritorna la stringa di picture per i codici gruppo di quel livello
|
||||
const int code_lenght(int levnum); // Ritorna la lunghezza dei codici gruppo di quel livello
|
||||
|
||||
void pack_grpcode(TString & pc, const TString &codlev, const int levnum); // Inserisce il codice del gruppo del livello levnum in pc
|
||||
TString unpack_grpcode(const TString & pc, const int levnum); // Estrae il codice del gruppo del livello levnum da pc
|
||||
|
||||
TMag_livelli(const char *tabname); // costruttore
|
||||
~TMag_livelli() {}; // distruttore
|
||||
};
|
||||
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
#define MAXSIMBOLS 256
|
||||
#define MAXSTATES 25
|
||||
class TStateset {
|
||||
unsigned char _container[MAXSTATES];
|
||||
int _current;
|
||||
public:
|
||||
TStateset & empty();
|
||||
TStateset & enclose(int e);
|
||||
TStateset & singleton(int e);
|
||||
TStateset & cap(TStateset & s);
|
||||
int get_first() ;
|
||||
int get_next() ;
|
||||
bool is_empty() const;
|
||||
bool is_member(int e) const;
|
||||
TStateset();
|
||||
~TStateset() {};
|
||||
};
|
||||
|
||||
struct TAutoma_state {
|
||||
short _transaction[MAXSIMBOLS];
|
||||
TString16 * _label;
|
||||
bool _final;
|
||||
};
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
// automa per il riconoscimento di metacaratteri
|
||||
class TR_automa {
|
||||
TAutoma_state st[MAXSTATES];
|
||||
short _maxstate;
|
||||
protected:
|
||||
TStateset union_of_closures(TStateset &s);
|
||||
|
||||
bool is_final(int statenum) const;
|
||||
bool is_final(TStateset states) const;
|
||||
|
||||
TR_automa & set_label(int statenum, const char *label);
|
||||
bool is_state(int statenum);
|
||||
const char *label(int statenum);
|
||||
int label2state(const char * label);
|
||||
|
||||
void del_trans(int statenum,unsigned char symbol);
|
||||
int trans_to(int statenum,unsigned char symbol);
|
||||
bool _isdeterministic;
|
||||
|
||||
public:
|
||||
TR_automa & reset_state(int statenum=-1);
|
||||
|
||||
void add_tran(int statenum,unsigned char symbol,int next);// aggiunge una transizione
|
||||
int add_state(const char * label);// aggiunge uno stato
|
||||
TR_automa & set_final(int statenum,bool v=TRUE); // pone lo stato come finale
|
||||
|
||||
bool is_deterministic() {return _isdeterministic;}; //
|
||||
bool recognized(const char * s); // tenta di riconoscere la stringa passata
|
||||
|
||||
TR_automa(TR_automa *a=NULL,bool makedet=FALSE); // duplica un automa (e lo rende deterministico)
|
||||
~TR_automa();
|
||||
static void set2label(const TStateset ss,TString16 & label);
|
||||
static void label2set(const TString16 & label,TStateset & ss);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
// riconoscimento di metacaratteri
|
||||
class TMetachar {
|
||||
TR_automa * _au;
|
||||
TString _language;
|
||||
char _metach_mand[10];
|
||||
char _metach_opz[10];
|
||||
|
||||
void set_language(const char * language); // setta l'automa che ricosce il linguaggio passato
|
||||
void add_tran(int statenum,unsigned char symbol,int next);// aggiunge le transizioni all'automa
|
||||
public:
|
||||
const char * language() const; // restituisce la stringa di metacaratteri del linguaggio riconosciuto
|
||||
bool recognized(const char * pattern);
|
||||
|
||||
bool has_opzchars(const char * pattern);
|
||||
bool has_mandchars(const char * pattern);
|
||||
|
||||
int maxstrlen(const char * pattern) const;
|
||||
const char *mand_chars() {return _metach_mand;};
|
||||
const char *opz_chars() {return _metach_opz;};
|
||||
TMetachar(const char * str);
|
||||
TMetachar();
|
||||
~TMetachar();
|
||||
};
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
#define MANY_MAG_LEV 10
|
||||
class TMag_livelli {
|
||||
bool _enabled[MANY_MAG_LEV];
|
||||
int _code_lenght[MANY_MAG_LEV];
|
||||
TString _name[MANY_MAG_LEV];
|
||||
TString _picture[MANY_MAG_LEV];
|
||||
int _last_level;
|
||||
|
||||
public:
|
||||
int last_level() const {return _last_level;}; // Ritorna il numero di livelli abilitati
|
||||
const bool enabled(int levnum=1); // Ritorna se il livello è abilitato
|
||||
const TString & name(int levnum); // Ritorna il nome (descrizione) di quel livello
|
||||
const TString & picture(int levnum);// Ritorna la stringa di picture per i codici gruppo di quel livello
|
||||
const int code_lenght(int levnum); // Ritorna la lunghezza dei codici gruppo di quel livello
|
||||
|
||||
void pack_grpcode(TString & pc, const TString &codlev, const int levnum); // Inserisce il codice del gruppo del livello levnum in pc
|
||||
TString unpack_grpcode(const TString & pc, const int levnum); // Estrae il codice del gruppo del livello levnum da pc
|
||||
|
||||
TMag_livelli(const char *tabname); // costruttore
|
||||
~TMag_livelli() {}; // distruttore
|
||||
};
|
||||
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
#define MAXSIMBOLS 256
|
||||
#define MAXSTATES 25
|
||||
class TStateset {
|
||||
unsigned char _container[MAXSTATES];
|
||||
int _current;
|
||||
public:
|
||||
TStateset & empty();
|
||||
TStateset & enclose(int e);
|
||||
TStateset & singleton(int e);
|
||||
TStateset & cap(TStateset & s);
|
||||
int get_first() ;
|
||||
int get_next() ;
|
||||
bool is_empty() const;
|
||||
bool is_member(int e) const;
|
||||
TStateset();
|
||||
~TStateset() {};
|
||||
};
|
||||
|
||||
struct TAutoma_state {
|
||||
short _transaction[MAXSIMBOLS];
|
||||
TString16 * _label;
|
||||
bool _final;
|
||||
};
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
// automa per il riconoscimento di metacaratteri
|
||||
class TR_automa {
|
||||
TAutoma_state st[MAXSTATES];
|
||||
short _maxstate;
|
||||
protected:
|
||||
TStateset union_of_closures(TStateset &s);
|
||||
|
||||
bool is_final(int statenum) const;
|
||||
bool is_final(TStateset states) const;
|
||||
|
||||
TR_automa & set_label(int statenum, const char *label);
|
||||
bool is_state(int statenum);
|
||||
const char *label(int statenum);
|
||||
int label2state(const char * label);
|
||||
|
||||
void del_trans(int statenum,unsigned char symbol);
|
||||
int trans_to(int statenum,unsigned char symbol);
|
||||
bool _isdeterministic;
|
||||
|
||||
public:
|
||||
TR_automa & reset_state(int statenum=-1);
|
||||
|
||||
void add_tran(int statenum,unsigned char symbol,int next);// aggiunge una transizione
|
||||
int add_state(const char * label);// aggiunge uno stato
|
||||
TR_automa & set_final(int statenum,bool v=TRUE); // pone lo stato come finale
|
||||
|
||||
bool is_deterministic() {return _isdeterministic;}; //
|
||||
bool recognized(const char * s); // tenta di riconoscere la stringa passata
|
||||
|
||||
TR_automa(TR_automa *a=NULL,bool makedet=FALSE); // duplica un automa (e lo rende deterministico)
|
||||
~TR_automa();
|
||||
static void set2label(const TStateset ss,TString16 & label);
|
||||
static void label2set(const TString16 & label,TStateset & ss);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// *******************************
|
||||
// *******************************
|
||||
// riconoscimento di metacaratteri
|
||||
class TMetachar {
|
||||
TR_automa * _au;
|
||||
TString _language;
|
||||
char _metach_mand[10];
|
||||
char _metach_opz[10];
|
||||
|
||||
void set_language(const char * language); // setta l'automa che ricosce il linguaggio passato
|
||||
void add_tran(int statenum,unsigned char symbol,int next);// aggiunge le transizioni all'automa
|
||||
public:
|
||||
const char * language() const; // restituisce la stringa di metacaratteri del linguaggio riconosciuto
|
||||
bool recognized(const char * pattern);
|
||||
|
||||
bool has_opzchars(const char * pattern);
|
||||
bool has_mandchars(const char * pattern);
|
||||
|
||||
int maxstrlen(const char * pattern) const;
|
||||
const char *mand_chars() {return _metach_mand;};
|
||||
const char *opz_chars() {return _metach_opz;};
|
||||
TMetachar(const char * str);
|
||||
TMetachar();
|
||||
~TMetachar();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user