Patch level : 10.0

Files correlati     : lv0
Ricompilazione Demo : [ ]
Commento            :
Corretta interpretazione tabelle di modulo in stampa


git-svn-id: svn://10.65.10.50/trunk@17387 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-10-08 10:23:29 +00:00
parent 7ff61ff37b
commit 66c5543e7a
2 changed files with 30 additions and 27 deletions

View File

@ -1,19 +1,15 @@
#include <stdio.h>
#include <applicat.h>
#include <expr.h>
#include <files.h>
#include <lffiles.h>
#include <utility.h>
#include <config.h>
#include <extcdecl.h>
#include <lffiles.h>
#define BLOCKLEN 512
#define INVFLD 255
HIDDEN char _files_tmp_string[256];
TFile::TFile (int lenrec, int base)
{
_file = new SecDef;
@ -138,25 +134,26 @@ const char *TDir::name () const
return _dir->SysName;
}
const char *TDir::filename () const
const char* TDir::filename() const
{
strcpy(_files_tmp_string, CAddPref(_dir->SysName));
for (int i=strlen(_files_tmp_string); i>0; i--)
TString& tmp = get_tmp_string();
tmp = CAddPref(_dir->SysName);
for (int i=tmp.len()-1; i>=0; i--)
{
const char c = _files_tmp_string[i-1];
if (c == '\\' || c == '/')
const char c = tmp[i];
if (is_slash(c))
{
strcat(_files_tmp_string, ".dbf");
tmp << ".dbf";
break;
}
else
if (c == '.')
break;
}
return _files_tmp_string;
return tmp;
}
void TDir::set_name (const char * name)
void TDir::set_name(const char* name)
{
CHECK(name != NULL, "NULL Filename");
CHECK(strlen(name) < 42, "Name too long");
@ -316,12 +313,16 @@ void TDir::print_on (ostream & out) const
void TDir::read_from (istream & in)
{
CHECK(_dir,"Can't read into a NULL _dir");
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
_num = atoi(_files_tmp_string);
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
_com = atoi(_files_tmp_string) != 0;
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
TToken_string line(_files_tmp_string,'|');
TToken_string line(256, '|');
char* buf = line.get_buffer();
const int bufsize = line.size();
in.getline (buf, bufsize, '\n');
_num = atoi(buf);
in.getline (buf, bufsize, '\n');
_com = atoi(buf) != 0;
in.getline (buf, bufsize, '\n');
line.restart();
strcpy(_dir->SysName,line.get());
_dir->EOD = line.get_long();
@ -531,17 +532,17 @@ int TTrec::field(const char *name) const
return findfld(_rec, name);
}
const char *TTrec ::fielddef (int fld) const
const char* TTrec::fielddef(int fld) const
{
sprintf (_files_tmp_string, "%s|%d|%d|%d", _rec->Fd[fld].Name,
(int) _rec->Fd[fld].TypeF, (int) _rec->Fd[fld].Len,
(int) _rec->Fd[fld].Dec);
return _files_tmp_string;
const RecFieldDes& fd = _rec->Fd[fld];
TString& tmp = get_tmp_string(50);
tmp.format("%s|%d|%d|%d", fd.Name, (int)fd.TypeF, (int)fd.Len, (int)fd.Dec);
return tmp;
}
const char *TTrec ::keydef (int key) const
{
TFixed_string s (_files_tmp_string, 128);
TString& s = get_tmp_string(128);
s = "";
for (int j = 0; j < _rec->Ky[key].NkFields; j++)
@ -561,7 +562,7 @@ const char *TTrec ::keydef (int key) const
s << ")";
}
s << (_rec->Ky[key].DupKeys ? "|X" : "| ");
return (const char *) s;
return s;
}
int TTrec::len() const

View File

@ -1030,6 +1030,7 @@ void TCursor_parser::parse_region(TRectype& rec)
{
field = ass.left(equal);
value = ass.mid(equal+1);
value.trim();
if (value[0] == '"' || value[0] == '\'')
{
value.rtrim(1);
@ -1217,7 +1218,7 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
if (logicnum == LF_MAG && tok == "MAG") // Faccio prevalere la tabella MAG sul file MAG
logicnum = LF_TAB;
if (logicnum == LF_TAB || logicnum == LF_TABCOM)
if (logicnum == LF_TAB || logicnum == LF_TABCOM || logicnum == LF_TABMOD)
_relation = new TRelation(tok);
else
_relation = new TRelation(logicnum);
@ -1257,6 +1258,7 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
if (_cursor == NULL)
_cursor = new TCursor(_relation, "", key);
_relation->lfile().zero(); // Azzera correttamente tabelle normali e di modulo!
TRectype rec_start(_relation->curr());
TRectype rec_stop(rec_start);