From 76f5246fabfbf4fe03c88041498ed11ec8e7b5c3 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 22 Aug 1994 09:47:35 +0000 Subject: [PATCH] Commentata parte inutile o incompatibile per FOXPRO git-svn-id: svn://10.65.10.50/trunk@43 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/files.cpp | 313 ++++++++++++++++++++++++---------------------- 1 file changed, 161 insertions(+), 152 deletions(-) diff --git a/include/files.cpp b/include/files.cpp index f7c5c70fc..8fc098b7e 100755 --- a/include/files.cpp +++ b/include/files.cpp @@ -1,14 +1,18 @@ #include #include -#include -#include #include #include + +#ifndef FOXPRO #include +#endif + #ifndef __EXTCDECL_H #include #endif + +#include #include #define BLOCKLEN 512 @@ -99,11 +103,11 @@ write (char *record, TRecnotype recnum, TReclock lock) int TFile :: status () - const + const - { - return _file->IOR; - } +{ + return _file->IOR; +} TDir :: TDir () @@ -124,49 +128,49 @@ TDir ::~TDir () const char *TDir :: name () - const + const - { - return _dir->SysName; - } +{ + return _dir->SysName; +} - const char *TDir ::des () - const +const char *TDir ::des () + const - { - return _dir->Des; - } +{ + return _dir->Des; +} - const char *TDir ::expr () - const +const char *TDir ::expr () + const - { - return _dir->FCalc; - } +{ + return _dir->FCalc; +} TRecnotype & TDir :: eod () - const + const - { - return _dir->EOD; - } +{ + return _dir->EOD; +} TRecnotype & TDir :: eox () - const + const - { - return _dir->EOX; - } +{ + return _dir->EOX; +} TRecnotype & TDir :: flags () - const + const - { - return _dir->Flags; - } +{ + return _dir->Flags; +} word & TDir :: len () @@ -177,13 +181,13 @@ len () int TDir :: status (TDirtype dirop) - const + const - { - return fdir[dirop].IOR; - } +{ + return fdir[dirop].IOR; +} - void TDir ::set_len (const UINT16 len) +void TDir ::set_len (const UINT16 len) { _dir->LenR = len; } @@ -240,15 +244,15 @@ zero () int TDir :: items (TDirtype dirtype) - const + const - { - FileDes f; - int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR); +{ + FileDes f; + int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR); - CGetFile (1, &f, _nolock, _whichdir); - return (int) f.EOD; - } + CGetFile (1, &f, _nolock, _whichdir); + return (int) f.EOD; +} TTrec :: TTrec () @@ -269,15 +273,15 @@ TTrec ::~TTrec () int TTrec :: compare (const TSortable & a) - const + const - { - const TTrec & r = (const TTrec &) a; - const int res = memcmp ((const void *) _rec, (const void *) r._rec, sizeof (*_rec)); - return res; - } +{ + const TTrec & r = (const TTrec &) a; + const int res = memcmp ((const void *) _rec, (const void *) r._rec, sizeof (*_rec)); + return res; +} - void TTrec ::rehash () +void TTrec ::rehash () { setrdes (_rec); @@ -321,56 +325,59 @@ zero () int TTrec :: status (TDirtype dirop) - const + const - { - return rdir[dirop].IOR; - } +{ + return rdir[dirop].IOR; +} - int TTrec ::field (const char *name) - const +int TTrec ::field (const char *name) + const - { - return findfld (_rec, (char *) name); +{ + return findfld (_rec, (char *) 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; - } +{ + 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 char *TTrec ::keydef (int key) - const +const char *TTrec ::keydef (int key) + const - { - TFixed_string s (_files_tmp_string, 128); +{ + TFixed_string s (_files_tmp_string, 128); - s = ""; - for (int j = 0; j < _rec->Ky[key].NkFields; j++) - { - const bool upper = _rec->Ky[key].FieldSeq[j] > MaxFields; - const int nfld = _rec->Ky[key].FieldSeq[j] - (upper ? MaxFields : 0); + s = ""; + for (int j = 0; j < _rec->Ky[key].NkFields; j++) + { + const bool upper = _rec->Ky[key].FieldSeq[j] > MaxFields; + const int nfld = _rec->Ky[key].FieldSeq[j] - (upper ? MaxFields : 0); - if (j) - s << "+"; - if (upper) - s << "UPPER("; - s << _rec->Fd[nfld].Name; - if (_rec->Ky[key].FromCh[j] < INVFLD) - s << format ("[%d,%d]", _rec->Ky[key].FromCh[j] + 1, - _rec->Ky[key].ToCh[j] + 1); - if (upper) - s << ")"; - } - s << (_rec->Ky[key].DupKeys ? "|X" : "| "); - return (const char *) s; - } + if (j) + s << "+"; + if (upper) + s << "UPPER("; + s << _rec->Fd[nfld].Name; + if (_rec->Ky[key].FromCh[j] < INVFLD) + s << format ("[%d,%d]", _rec->Ky[key].FromCh[j] + 1, + _rec->Ky[key].ToCh[j] + 1); + if (upper) + s << ")"; + } + s << (_rec->Ky[key].DupKeys ? "|X" : "| "); + return (const char *) s; +} + + +#ifndef FOXPRO void TTrec :: update_fielddef (int nfld, const char *desc) @@ -392,71 +399,71 @@ update_keydef (int key, const char *desc) TString ke (s.get ()); if (expr.set ((const char *) ke, _strexpr)) + { + _rec->Ky[key].DupKeys = (*s.get () != ' '); + TCodearray & c = expr.code (); + c.begin (); + int n = 0; + while (!c.end ()) { - _rec->Ky[key].DupKeys = (*s.get () != ' '); - TCodearray & c = expr.code (); - c.begin (); - int n = 0; - while (!c.end ()) - { - TCode & inst = c.step (); - TCodesym sym = inst.getsym (); + TCode & inst = c.step (); + TCodesym sym = inst.getsym (); - if (sym == _variable) - { - const char *s = inst.string (); + if (sym == _variable) + { + const char *s = inst.string (); - for (int i = 0; i < _rec->NFields; i++) - if (strcmp (_rec->Fd[i].Name, s) == 0) - break; + for (int i = 0; i < _rec->NFields; i++) + if (strcmp (_rec->Fd[i].Name, s) == 0) + break; - _rec->Ky[key].FieldSeq[n] = i; - _rec->Ky[key].FromCh[n] = INVFLD; - _rec->Ky[key].FromCh[n] = INVFLD; - inst = c.step (); - sym = inst.getsym (); - if (sym == _upper) - _rec->Ky[key].FieldSeq[n] += MaxFields; - else if (sym == _number) - { - _rec->Ky[key].FromCh[n] = inst.number ().integer () - 1; - inst = c.step (); - _rec->Ky[key].ToCh[n] = _rec->Ky[key].FromCh[n] + inst.number ().integer () - 1; - inst = c.step (); - } - else - c.backtrace (); - n++; - } - } - _rec->Ky[key].NkFields = n; + _rec->Ky[key].FieldSeq[n] = i; + _rec->Ky[key].FromCh[n] = INVFLD; + _rec->Ky[key].FromCh[n] = INVFLD; + inst = c.step (); + sym = inst.getsym (); + if (sym == _upper) + _rec->Ky[key].FieldSeq[n] += MaxFields; + else if (sym == _number) + { + _rec->Ky[key].FromCh[n] = inst.number ().integer () - 1; + inst = c.step (); + _rec->Ky[key].ToCh[n] = _rec->Ky[key].FromCh[n] + inst.number ().integer () - 1; + inst = c.step (); + } + else + c.backtrace (); + n++; + } } + _rec->Ky[key].NkFields = n; + } } void TTrec :: print_on (ostream & out) - const + const - { - out << num () << '\n'; - const int nfields = fields (); - TToken_string s (80); +{ + out << num () << '\n'; + const int nfields = fields (); + TToken_string s (80); - out << nfields << '\n'; - for (int i = 0; i < nfields; i++) - { - s = fielddef (i); - out << s << '\n'; - } - const int nkeys = keys (); + out << nfields << '\n'; + for (int i = 0; i < nfields; i++) + { + s = fielddef (i); + out << s << '\n'; + } + const int nkeys = keys (); - out << nkeys << '\n'; - for (i = 0; i < nkeys; i++) - { - s = keydef (i); - out << s << '\n'; - } - } + out << nkeys << '\n'; + for (i = 0; i < nkeys; i++) + { + s = keydef (i); + out << s << '\n'; + } +} void TTrec :: read_from (istream & in) @@ -474,19 +481,21 @@ read_from (istream & in) nfields = atoi (_files_tmp_string); set_fields (nfields); for (int i = 0; i < nfields; i++) - { - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - update_fielddef (i, _files_tmp_string); - } + { + in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); + update_fielddef (i, _files_tmp_string); + } int nkeys; in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); nkeys = atoi (_files_tmp_string); set_keys (nkeys); for (i = 0; i < nkeys; i++) - { - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - update_keydef (i, _files_tmp_string); - } + { + in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); + update_keydef (i, _files_tmp_string); + } rehash (); } + +#endif // FOXPRO