archives.cpp Aggiustate indentazioni
cfiles.cpp Corretta costruzione della stringa __ptprf (senza doppi slash e controlslash consecutivi) config.cpp Megafigata: Dopo anni e anni le chiavi vengono salvate in ordine alfabetico e non in disordine hash! execp.cpp Aggiunti due flag al metodo TExternal_app::run Uno per specificare l'iconizzazione del programma chiamante e uno per la visibilita' del programma chiamato prefix.cpp Migliorata costruzione path dei dati strings.cpp Aggiunta #define della dimensione di default delle stringhe Corretto metodo TFilename::add utility.cpp Megafigata: Dopo anni e anni aggiunto il metodo fsize(const char*) git-svn-id: svn://10.65.10.50/trunk@5498 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
401759040a
commit
937fcbfe58
@ -66,7 +66,8 @@ FILE* TArchive::ask_disk(
|
||||
else
|
||||
{
|
||||
const bool ok = yesno_box("Inserire il disco %d nel drive %c\n"
|
||||
"Estrarre il disco %d e continuare?", disk, floppy, disk-1);
|
||||
"Estrarre il disco %d e continuare?",
|
||||
disk, floppy, disk-1);
|
||||
if (!ok) return NULL;
|
||||
}
|
||||
} while (fexist(prev)); // Non facciamo i furbetti!
|
||||
@ -185,7 +186,7 @@ bool TArchive::fsplit(
|
||||
TFilename work;
|
||||
work << floppy << ":/" << from.name(); // File su dischetto
|
||||
|
||||
TString256 msg("Archiviazione di "); msg << work << " (" << (tot/1024) << "K)";
|
||||
TString msg("Archiviazione di "); msg << work << " (" << (tot/1024) << "K)";
|
||||
TProgind w(tot, msg, TRUE, TRUE, 40);
|
||||
|
||||
int disk = 0;
|
||||
@ -285,7 +286,7 @@ bool TArchive::fbuild(
|
||||
name << floppy << ":/" << work.name();
|
||||
|
||||
TString256 msg("Ripristino da "); msg << name;
|
||||
TProgind w(max, msg, TRUE, TRUE, 32);
|
||||
TProgind w(max, msg, TRUE, TRUE, 40);
|
||||
|
||||
int disk = 0;
|
||||
TString buffer(BUFSIZE);
|
||||
@ -339,7 +340,8 @@ bool TArchive::fbuild(
|
||||
totale += letti;
|
||||
ok = !w.iscancelled();
|
||||
}
|
||||
else error_box("Impossibile scrivere i dati sul file %s", (const char*)work);
|
||||
else
|
||||
error_box("Impossibile scrivere i dati sul file %s", (const char*)work);
|
||||
}
|
||||
|
||||
if (!ok || totale == max) // Esci in caso di errore o se hai finito
|
||||
@ -383,7 +385,7 @@ bool TArchive::backup(
|
||||
|
||||
_arc = new ALArchive(work);
|
||||
|
||||
TString256 title("Archiviazione di "); title << name;
|
||||
TString title("Archiviazione di "); title << name;
|
||||
TProgress_win w(title, this);
|
||||
ALEntryList list(w.monitor());
|
||||
_arc->AddWildCardFiles(list, "*.*");
|
||||
@ -512,9 +514,7 @@ bool TArchive::restore(long firm, char floppy, bool temp, bool pr_set)
|
||||
ok = restore(fl.row(f), floppy, temp, pr_set);
|
||||
if (!ok) break;
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
void TArchive::stop_job()
|
||||
@ -528,7 +528,7 @@ void TArchive::stop_job()
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TProgress_win::TProgress_win(const char* title, TArchive* arc)
|
||||
: TMask(title, 1, 60, 6), _arc(arc)
|
||||
: TMask(title, 1, 60, 6), _arc(arc)
|
||||
{
|
||||
RCT rct;
|
||||
xvt_rect_set(&rct, CHARX, CHARY, 58*CHARX, 5*CHARY/2);
|
||||
|
@ -441,7 +441,15 @@ char *CGetPref()
|
||||
if (len >= 0 && __ptprf[len] <= ' ')
|
||||
{
|
||||
__ptprf[len] = '\0';
|
||||
if (len > 0) strcat(__ptprf, "/");
|
||||
// if (len > 0) strcat(__ptprf, "/"); // Guy was here
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
#ifdef DOS
|
||||
strcat(__ptprf, "\\");
|
||||
#else
|
||||
strcat(__ptprf, "/");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -68,11 +68,20 @@ void TConfig::_write_paragraph(
|
||||
if (_data.items() > 0) // Inutile scrivere paragrafi vuoti!
|
||||
{
|
||||
out << '[' << _paragraph << ']' << endl;
|
||||
|
||||
/*
|
||||
_data.restart();
|
||||
for (THash_object* o = _data.get_hashobj(); o; o = _data.get_hashobj())
|
||||
out << o->key() << " = " << (TString&)(o->obj()) << '\n';
|
||||
|
||||
*/
|
||||
TString_array a; list_variables(a, TRUE);
|
||||
a.sort();
|
||||
for (int i = 0; i < a.items(); i++)
|
||||
{
|
||||
TToken_string& row = a.row(i);
|
||||
out << row.get(0) << " = ";
|
||||
out << row.get() << endl;
|
||||
}
|
||||
|
||||
out << endl;
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,10 @@ bool TExternal_app::can_run() const
|
||||
//
|
||||
// @rdesc Ritorna il codice di uscita del processo (-1 in caso di errore).
|
||||
word TExternal_app::run(
|
||||
bool async, // @parm Per eseguire il processo in parallelo (default FALSE)
|
||||
bool utente) // @parm Permette di inserire il nome dell'utente nella riga
|
||||
// di comando(default TRUE)
|
||||
bool async, // @parm Per eseguire il processo in parallelo
|
||||
bool utente, // @parm Permette di inserire il nome dell'utente nella riga di comando
|
||||
bool iconize, // @parm Iconizza il programma chiamante
|
||||
bool show) // @parm Mostra o nascondi il programma chiamato
|
||||
|
||||
// @comm Se <p asyn> e' FALSE aspetta che termini il processo in esecuzione prima di iniziare il nuovo
|
||||
|
||||
@ -155,15 +156,18 @@ word TExternal_app::run(
|
||||
TWait_cursor hourglass;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HL_LOGOUT();
|
||||
_exitcode = WinExec((char*)(const char*)path, SW_SHOW);
|
||||
_exitcode = WinExec(path.get_buffer(), show ? SW_SHOWNORMAL : SW_HIDE);
|
||||
|
||||
if (_exitcode >= 32)
|
||||
{
|
||||
if (!async)
|
||||
{
|
||||
TTemp_window tw(TASK_WIN);
|
||||
tw.iconize();
|
||||
tw.deactivate();
|
||||
if (iconize)
|
||||
{
|
||||
tw.iconize();
|
||||
tw.deactivate();
|
||||
}
|
||||
|
||||
HTASK child = NULL;
|
||||
TASKENTRY te; te.dwSize = sizeof(TASKENTRY);
|
||||
@ -188,8 +192,11 @@ word TExternal_app::run(
|
||||
xvt_app_process_pending_events();
|
||||
}
|
||||
|
||||
tw.maximize();
|
||||
tw.activate();
|
||||
if (iconize)
|
||||
{
|
||||
tw.maximize();
|
||||
tw.activate();
|
||||
}
|
||||
xvt_app_process_pending_events();
|
||||
}
|
||||
xvt_statbar_refresh();
|
||||
|
@ -36,16 +36,16 @@ public:
|
||||
// @cmember Controlla se il processo puo' essere eseguito
|
||||
bool can_run() const;
|
||||
// @cmember Esegue il processo
|
||||
word run(bool async = FALSE, bool user = TRUE);
|
||||
word run(bool async = FALSE, bool user = TRUE, bool iconize = TRUE, bool show = TRUE);
|
||||
// @cmember Ritorna il codice dell'ultimo errore
|
||||
int error()
|
||||
{ return _error;};
|
||||
{ return _error; }
|
||||
// @cmember Ritorna l'ultimo codice di uscita
|
||||
word exitcode()
|
||||
{ return _exitcode;};
|
||||
{ return _exitcode; }
|
||||
// @cmember Ritorna il numero di chiamate effettuate
|
||||
int count()
|
||||
{ return _count; };
|
||||
{ return _count; }
|
||||
|
||||
// @cmember Costruttore
|
||||
TExternal_app(const char* p);
|
||||
|
@ -280,12 +280,13 @@ void TPrefix::set(
|
||||
bool TPrefix::exist(long codditta) const
|
||||
{
|
||||
CHECKD(codditta > 0, "Solo le ditte con codice maggiore di zero possono esistere : codice ", codditta);
|
||||
TFilename s(firm2dir(codditta)); s << "/dir.gen";
|
||||
TFilename s(firm2dir(codditta));
|
||||
s.add("dir.gen");
|
||||
|
||||
if (fexist(s))
|
||||
{
|
||||
s = s.path();
|
||||
s << "/trc.gen";
|
||||
s.add("trc.gen");
|
||||
return fexist(s);
|
||||
}
|
||||
return FALSE;
|
||||
@ -296,7 +297,9 @@ bool TPrefix::test(const char* s) const
|
||||
if (s && *s && strcmp(s, "DEF"))
|
||||
{
|
||||
TFilename s1(__ptprf);
|
||||
s1 << s << "/dir.gen";
|
||||
s1.add(s);
|
||||
s1.add("dir.gen");
|
||||
|
||||
if (!fexist(s1))
|
||||
return error_box("Impossibile trovare il file '%s'", (const char*)s1);
|
||||
}
|
||||
@ -310,7 +313,6 @@ bool TPrefix::test(const char* s) const
|
||||
|
||||
|
||||
void TPrefix::put()
|
||||
|
||||
{
|
||||
CPutPref((char*)(const char*)_prefix);
|
||||
}
|
||||
@ -326,7 +328,6 @@ bool TPrefix::test(long codditta) const
|
||||
|
||||
|
||||
long TPrefix::get_codditta() const
|
||||
|
||||
{
|
||||
const long codditta = atol((const char*)_prefix);
|
||||
return codditta;
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// Most descriptions will fit in fifty characters
|
||||
const int DEFAULT_SIZE = 50;
|
||||
|
||||
#ifdef FOXPRO
|
||||
class TString512 : public TFixed_string
|
||||
{
|
||||
@ -74,7 +77,6 @@ void TString512::strncpy(const char* s, int n)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
HIDDEN TString512 spark;
|
||||
|
||||
inline bool is_space(char c)
|
||||
@ -155,11 +157,11 @@ TString::TString(int size, char c) : _str(NULL), _size(0)
|
||||
if (size > 0)
|
||||
fill(c, size); // Guy: Much simpler and faster (uses memset)
|
||||
else
|
||||
resize(15, FALSE);
|
||||
resize(DEFAULT_SIZE, FALSE);
|
||||
}
|
||||
|
||||
TString::TString() : _str(NULL), _size(0)
|
||||
{ resize(15, FALSE); }
|
||||
{ resize(DEFAULT_SIZE, FALSE); }
|
||||
|
||||
TString::~TString()
|
||||
{
|
||||
@ -1016,7 +1018,7 @@ const char* TFilename::path() const
|
||||
|
||||
TFilename& TFilename::add(const char* n)
|
||||
{
|
||||
if (not_empty() && is_not_slash(_str[len()-1]))
|
||||
if (not_empty() && is_not_slash(_str[len()-1]) && is_not_slash(*n))
|
||||
*this << SLASH;
|
||||
*this << n;
|
||||
return *this;
|
||||
@ -1545,7 +1547,6 @@ const TString& TParagraph_string::operator =(const char* s)
|
||||
|
||||
void TParagraph_string::tokenize()
|
||||
{
|
||||
|
||||
int last_space = 0, last_start = 0;
|
||||
int num_chars = 0;
|
||||
const int l = len();
|
||||
|
@ -57,7 +57,9 @@ bool fcopy(
|
||||
|
||||
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
|
||||
// creati dei box di comunicazione che indicano la causa del problema
|
||||
{
|
||||
{
|
||||
CHECK(orig && *orig && dest && *dest, "fcopy: Invalid file name");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
const char* const rflag = "rb";
|
||||
const char* wflag = append ? "ab" : "wb";
|
||||
@ -65,6 +67,10 @@ bool fcopy(
|
||||
const char* const rflag = "r";
|
||||
const char* wflag = append ? "a" : "w";
|
||||
#endif
|
||||
|
||||
// Copia il file su se stesso?
|
||||
if (stricmp(orig, dest) == 0)
|
||||
return TRUE; // Or FALSE?
|
||||
|
||||
FILE* i = fopen(orig, rflag);
|
||||
if (!i) return error_box("Impossibile leggere il file %s", orig);
|
||||
@ -117,7 +123,24 @@ bool fexist(
|
||||
}
|
||||
}
|
||||
return err == 0;
|
||||
}
|
||||
}
|
||||
|
||||
long fsize(const char* name)
|
||||
{
|
||||
long s = 0;
|
||||
if (name && *name)
|
||||
{
|
||||
FILE* f = fopen(name, "r");
|
||||
if (f != NULL)
|
||||
{
|
||||
fseek(f, 0, SEEK_END);
|
||||
s = ftell(f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -158,10 +181,10 @@ int list_files(
|
||||
TWait_cursor hourglass;
|
||||
TFilename dir(filelist);
|
||||
for (int i = dir.len()-1; i >= 0; i--)
|
||||
if (dir[i] == '/' || dir[i] == '\\') break;
|
||||
if (dir[i] == '/' || dir[i] == '\\' || dir[i] == ':') break;
|
||||
|
||||
TFilename mask(dir.mid(i+1));
|
||||
dir.cut(i > 0 ? i : 0);
|
||||
dir.cut(i > 0 ? i+1 : 0);
|
||||
|
||||
xvt_fsys_save_dir();
|
||||
|
||||
|
@ -11,6 +11,7 @@ int rtoi(const char * roman);
|
||||
const char* itor(int i);
|
||||
bool fcopy(const char* orig, const char* dest, bool append=FALSE);
|
||||
bool fexist(const char* file);
|
||||
long fsize(const char* file);
|
||||
|
||||
enum os_type { os_Windows, os_Win32s, os_Windows95, os_WindowsNT };
|
||||
os_type get_os_type();
|
||||
|
Loading…
x
Reference in New Issue
Block a user