From 9718a515ed5623f3b1f0fd834a8ebb4cdc9dbccf Mon Sep 17 00:00:00 2001 From: guy <guy@c028cbd2-c16b-5b4b-a496-9718f37d4682> Date: Mon, 22 Apr 2002 15:07:09 +0000 Subject: [PATCH] Patch level : v32 nopatch Files correlati : tutti Ricompilazione Demo : [ ] Commento : supporto path custom git-svn-id: svn://10.65.10.50/trunk@10176 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/execp.cpp | 1 + include/form.cpp | 5 ++++- include/mask.cpp | 1 + include/relation.cpp | 17 +++++++++-------- include/relation.h | 3 ++- include/strings.cpp | 31 ++++++++++++++++++------------- include/strings.h | 2 ++ 7 files changed, 37 insertions(+), 23 deletions(-) diff --git a/include/execp.cpp b/include/execp.cpp index e538cfcce..0c288e525 100755 --- a/include/execp.cpp +++ b/include/execp.cpp @@ -24,6 +24,7 @@ word TExternal_app::run( const int p = comm_name.find(' '); if (p >= 0) comm_name.cut(p); + comm_name.custom_path(); TString name(comm_name.name()); if (utente == TRUE) // utente puo' essere 0 = No, 1 = Si, 3 = Forzatura diff --git a/include/form.cpp b/include/form.cpp index 2f33c54bb..a067806e2 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -4472,6 +4472,7 @@ void TForm::read( const char* desc) // @parm Descrizione del formato da leggere { _name= name; + _code= code; _editlevel= lev; _desc= desc; @@ -4519,7 +4520,9 @@ void TForm::read( // read base form TFilename n(_name); n.ext("frm"); - if (!fexist(n)) fatal_box("Il file %s non esiste.",(const char *) n); + n.custom_path(); + if (!n.exist()) + fatal_box("Il form %s non esiste.",(const char*)n); TScanner scanner(n); bool ok = TRUE; diff --git a/include/mask.cpp b/include/mask.cpp index 03534e5dc..7ac80f729 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -150,6 +150,7 @@ void TMask::read_mask( _source_file = name; _source_file.ext(MASK_EXT); _source_file.lower(); + _source_file.custom_path(); TScanner scanner(_source_file); long start_t = clock(); diff --git a/include/relation.cpp b/include/relation.cpp index 3a5c58c9a..435951936 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -13,7 +13,7 @@ #define NOTFOUND (-1) // *** maximum number of elements in a cursor working page -#define CMAXELPAGE 8000 +#define CMAXELPAGE 8192 #define print_name(out, f) out << (f.num() == LF_TABCOM ? "%" : "") << f.name() @@ -1017,7 +1017,7 @@ TRecnotype TCursor::buildcursor(TRecnotype rp) if (junk < 0) junk=get_error(junk); if (junk == _iseof) return 0; - TRecnotype* page = new TRecnotype [CMAXELPAGE]; + TRecnotype* page = new TRecnotype[CMAXELPAGE]; DB_index_recno(fhnd); _pos=-1; @@ -1057,11 +1057,6 @@ TRecnotype TCursor::buildcursor(TRecnotype rp) page[pagecnt++] = recno; DB_index_next(fhnd); -/* - int rt=get_error(-1); // Get Last Codebase Error - if (rt != NOERR) - fatal_box("Can't read index n. %d - file n. %d",DB_tagget(fhnd), file().num()); -*/ } // while if (pagecnt) { @@ -1077,8 +1072,14 @@ TRecnotype TCursor::buildcursor(TRecnotype rp) } ap += pagecnt; } - delete page; close_index(_f); + + if (ap > CMAXELPAGE) + { + delete page; + page = NULL; + } + return ap; } diff --git a/include/relation.h b/include/relation.h index f57543516..94ce7311f 100755 --- a/include/relation.h +++ b/include/relation.h @@ -259,7 +259,8 @@ class TCursor : public TContainer int _filter_limit; // @cmember:(INTERNAL) Funzione filtro FILTERFUNCTION _filterfunction; - // @cmember:(INTERNAL) Nome del file indice + + // @cmember:(INTERNAL) Nome del file indice TFilename _indexname; // @access Protected Member diff --git a/include/strings.cpp b/include/strings.cpp index 7b7f9dc6f..6bfb77c62 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -1207,18 +1207,6 @@ const TFilename& TFilename::temp( { set(prefix); // Copia prefisso e ... strip("$#*?."); // ... toglie caratteri jolly - - const TFixed_string f(prefix); - if (f.find("$$") >= 0) - { - NFCHECK("Unsupported metacharacter $$"); -/* - char pid[8]; - sprintf(pid, "%d", getpid()); - pid[3] = '\0'; - *this << pid; -*/ - } } else cut(0); @@ -1271,7 +1259,24 @@ bool TFilename::input() return input_filename(*this); } - +bool TFilename::custom_path(const char* path_list) +{ + TToken_string pl = path_list; + if (pl.empty()) + pl = "custom"; + TFilename cust; + FOR_EACH_TOKEN(pl, path) + { + cust = path; + cust.add(name()); + if (cust.exist()) + { + set(cust); + return true; + } + } + return false; +} /////////////////////////////////////////////////////////// // Token string diff --git a/include/strings.h b/include/strings.h index 2ee3e7af4..932572310 100755 --- a/include/strings.h +++ b/include/strings.h @@ -504,6 +504,8 @@ public: const TFilename& tempdir(); // @cmember Genera il nome della directory corrente const TFilename& currdir(); + // @cmember Prepone il nome della dir custom + bool custom_path(const char* path_list = NULL); }; // Forward declaration for TToken_string::get(int n, real& r) const