ccommon.h Tolto prototipo della funzione prefname()
cfiles.h Aggiunto prototipo della funzione CGetPrawinName() cfiles.c Aggiunto supporto del file prawin.ini al posto dei files prefix.txt e pathpref.txt. Permane l'uso della variabile d'ambiente PREFPATH codeb.c Tolti tutti i warning csort.c Tolti tutti i warning mask.cpp Migliorata generazione del file di help netsock.cpp Aggiunto :: davanti alle funzioni di winsock.dll prefix.cpp Supporto prawin.ini prefix.h Eliminato metodo protetto put() progind.* Corretto prototipo funzione extern "C" proging_create git-svn-id: svn://10.65.10.50/trunk@5685 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
74a8b1e097
commit
909769349e
@ -191,7 +191,7 @@ typedef struct {
|
||||
char explic[82];
|
||||
} MenuItem;
|
||||
typedef MenuItem MenuArray[MAXMENUITEM + 1];
|
||||
typedef char PathSt[42];
|
||||
typedef char PathSt[82];
|
||||
|
||||
extern Str80 cprefix;
|
||||
extern TDitta cditta;
|
||||
|
268
include/cfiles.c
268
include/cfiles.c
@ -3,15 +3,29 @@
|
||||
#include "cfiles.h"
|
||||
#include "fldtypes.h"
|
||||
|
||||
#ifdef DOS
|
||||
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WINAPI _far _pascal
|
||||
#define LPSTR char*
|
||||
#define LPCSTR const LPSTR
|
||||
int WINAPI GetPrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
|
||||
int WINAPI WritePrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
|
||||
UINT WINAPI GetDriveType(int);
|
||||
|
||||
#endif // DOS
|
||||
|
||||
int hashfun(const char *);
|
||||
void setdec(char *, int);
|
||||
char *prefname(void);
|
||||
const char* prefname();
|
||||
|
||||
HIDDEN BOOLEAN pathpread = FALSE;
|
||||
|
||||
BOOLEAN dispferr = TRUE;
|
||||
int dirfl[2] = {0, 0}, recfl[2] = {0, 0} ;
|
||||
char __ptprf[80] = "";
|
||||
PathSt __ptprf = "";
|
||||
|
||||
/*
|
||||
@(#) COpenDir FILES
|
||||
@ -225,7 +239,7 @@ void CPutFile(logicname,filed,dirflg)
|
||||
int dirflg; /* flag per file comuni */
|
||||
|
||||
{
|
||||
CWrite(&fdir[dirflg],(RecType) filed,(long) logicname, UnLock);
|
||||
CWrite(&fdir[dirflg],(RecType)filed,(long) logicname, UnLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -373,20 +387,87 @@ void CPutRec(logicname,recd,dirflg)
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
||||
char *prefname()
|
||||
|
||||
HIDDEN const char* prefname()
|
||||
{
|
||||
static PathSt s;
|
||||
static char* s = NULL;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
#ifdef DOS
|
||||
char *s1 = getenv("PREFPATH");
|
||||
if (s1 == NULL) s1 = "prefix.txt";
|
||||
strcpy(s, s1);
|
||||
char *s1 = getenv("PREFPATH");
|
||||
if (s1 == NULL) s1 = "prefix.txt";
|
||||
s = strdup(s1);
|
||||
#else
|
||||
sprintf(s, "prefix.%-d", getuid());
|
||||
s = malloc(32);
|
||||
sprintf(s, "prefix.%-d", getuid());
|
||||
#endif
|
||||
return(s) ;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef DOS
|
||||
|
||||
const char* CGetPrawinName(void)
|
||||
{
|
||||
static char* prawin = NULL;
|
||||
if (prawin == NULL)
|
||||
{
|
||||
char drive[_MAX_DRIVE];
|
||||
char path[_MAX_PATH];
|
||||
char tmp[_MAX_PATH];
|
||||
_splitpath(prefname(), drive, path, NULL, NULL);
|
||||
_makepath(tmp, drive, path, "prawin", ".ini");
|
||||
prawin = malloc(_MAX_PATH);
|
||||
_searchenv(tmp, NULL, prawin);
|
||||
}
|
||||
return prawin;
|
||||
}
|
||||
|
||||
HIDDEN BOOLEAN CGetPrawin()
|
||||
{
|
||||
const char* prawin = CGetPrawinName();
|
||||
BOOLEAN good = _access(prawin, 0x00) == 0;
|
||||
if (good)
|
||||
{
|
||||
word len = GetPrivateProfileString("Main", "Study", "", __ptprf, sizeof(__ptprf), prawin);
|
||||
good = len > 0;
|
||||
if (good)
|
||||
{
|
||||
char firm[8];
|
||||
long ditta;
|
||||
|
||||
if (__ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
__ptprf[len] = DIRSEP;
|
||||
__ptprf[len+1] = '\0';
|
||||
}
|
||||
|
||||
GetPrivateProfileString("Main", "Firm", "COM", firm, sizeof(firm), prawin);
|
||||
ditta = atol(firm);
|
||||
if (ditta > 0) sprintf(firm, "%05ldA", ditta);
|
||||
_makepath(cprefix, NULL, __ptprf, firm, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
BOOLEAN CPutPrawin(const char* pref)
|
||||
{
|
||||
const char* prawin = CGetPrawinName();
|
||||
BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
|
||||
if (good)
|
||||
{
|
||||
int disk = toupper(*prawin) - 'A';
|
||||
if (GetDriveType(disk) == 3) // Aggiorna lo studio solo sui dischi locali
|
||||
WritePrivateProfileString("Main", "Study", __ptprf, prawin);
|
||||
}
|
||||
return good;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -407,63 +488,69 @@ char *prefname()
|
||||
@(FN)
|
||||
*/
|
||||
|
||||
char *CGetPref()
|
||||
|
||||
{
|
||||
const char* p = prefname();
|
||||
FILE *f = fopen(p, "r");
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
strcpy(cprefix, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fgets(cprefix, 42, f) != NULL)
|
||||
{
|
||||
const int len = LENGTH(cprefix)-1;
|
||||
if (len >= 0 && cprefix[len] <= ' ') cprefix[len] = '\0';
|
||||
}
|
||||
else
|
||||
*cprefix = '\0';
|
||||
fclose(f);
|
||||
}
|
||||
if (!pathpread)
|
||||
{
|
||||
const char* p = "pathpref.ini";
|
||||
FILE* f = fopen(p, "r");
|
||||
pathpread = TRUE;
|
||||
if (f != NULL)
|
||||
{
|
||||
if (fgets(__ptprf, 42, f) != NULL)
|
||||
{
|
||||
const int len = LENGTH(__ptprf)-1;
|
||||
if (len >= 0 && __ptprf[len] <= ' ')
|
||||
{
|
||||
__ptprf[len] = '\0';
|
||||
// if (len > 0) strcat(__ptprf, "/"); // Guy was here
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
const char* CGetPref()
|
||||
{
|
||||
#ifdef DOS
|
||||
strcat(__ptprf, "\\");
|
||||
#else
|
||||
strcat(__ptprf, "/");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!CGetPrawin())
|
||||
#endif
|
||||
{
|
||||
const char* p = prefname();
|
||||
FILE *f = fopen(p, "r");
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
strcpy(cprefix, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fgets(cprefix, 42, f) != NULL)
|
||||
{
|
||||
int len;
|
||||
for (len = LENGTH(cprefix)-1; len >= 0 && cprefix[len] <= ' '; len--)
|
||||
cprefix[len] = '\0';
|
||||
}
|
||||
else
|
||||
*__ptprf = '\0';
|
||||
*cprefix = '\0';
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
if (*__ptprf)
|
||||
{
|
||||
char ws[200];
|
||||
sprintf(ws, "%s%s", __ptprf, cprefix);
|
||||
strcpy(cprefix, ws);
|
||||
}
|
||||
return(cprefix);
|
||||
|
||||
if (!pathpread)
|
||||
{
|
||||
FILE* f = fopen("pathpref.ini", "r");
|
||||
pathpread = TRUE;
|
||||
if (f != NULL)
|
||||
{
|
||||
if (fgets(__ptprf, 42, f) != NULL)
|
||||
{
|
||||
const int len = LENGTH(__ptprf)-1;
|
||||
if (len >= 0 && __ptprf[len] <= ' ')
|
||||
{
|
||||
__ptprf[len] = '\0';
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
#ifdef DOS
|
||||
strcat(__ptprf, "\\");
|
||||
#else
|
||||
strcat(__ptprf, "/");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
*__ptprf = '\0';
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
if (*__ptprf)
|
||||
{
|
||||
char* copy_of_prefix = strdup(cprefix);
|
||||
strcpy(cprefix, __ptprf);
|
||||
strcat(cprefix, copy_of_prefix);
|
||||
free(copy_of_prefix);
|
||||
}
|
||||
}
|
||||
|
||||
return cprefix;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -484,18 +571,21 @@ char *CGetPref()
|
||||
@(FN)
|
||||
*/
|
||||
|
||||
void CPutPref(pref)
|
||||
char *pref; /* stringa contenente il nuovo prefisso */
|
||||
|
||||
void CPutPref(const char* pref) /* stringa contenente il nuovo prefisso */
|
||||
{
|
||||
FILE *f;
|
||||
const int l = strlen(__ptprf);
|
||||
|
||||
if (l && strncmp(pref, __ptprf, l) == 0) pref += l;
|
||||
if ((f = fopen(prefname(), "w")) == NULL)
|
||||
fatal_box("Put prefix. Error number : %d ", errno);
|
||||
fprintf(f, "%s\n", pref);
|
||||
fclose(f);
|
||||
#ifdef DOS
|
||||
CPutPrawin(pref);
|
||||
#endif
|
||||
{
|
||||
FILE *f;
|
||||
const int l = strlen(__ptprf);
|
||||
if (l && strncmp(pref, __ptprf, l) == 0) pref += l;
|
||||
if ((f = fopen(prefname(), "w")) == NULL)
|
||||
fatal_box("Put prefix. Error number : %d ", errno);
|
||||
fprintf(f, "%s\n", pref);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -520,7 +610,7 @@ char *CAddPref(name)
|
||||
char *name; /* nome file */
|
||||
|
||||
{
|
||||
static PathSt s;
|
||||
static char* s = NULL;
|
||||
|
||||
if (*name == '$')
|
||||
{
|
||||
@ -528,6 +618,7 @@ char *CAddPref(name)
|
||||
return(CInsPref(name, NORDIR)) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*name == '%')
|
||||
{
|
||||
name++;
|
||||
@ -535,12 +626,15 @@ char *CAddPref(name)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s == NULL)
|
||||
s = malloc(_MAX_PATH);
|
||||
if (strncmp(__ptprf, name, strlen(__ptprf)) != 0)
|
||||
sprintf(s, "%s%s", __ptprf, name);
|
||||
else
|
||||
strcpy(s, name);
|
||||
return(s);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -566,15 +660,21 @@ char *CInsPref(name,dirflg)
|
||||
int dirflg; /* flag per file comuni */
|
||||
|
||||
{
|
||||
static PathSt s;
|
||||
static char* s = NULL;
|
||||
if (s == NULL)
|
||||
s = malloc(_MAX_PATH);
|
||||
|
||||
if (dirflg == NORDIR)
|
||||
{
|
||||
if (LENGTH(cprefix) == 0) sprintf(s,"%s", name);
|
||||
else sprintf(s,"%s%c%s",cprefix, DIRSEP, name);
|
||||
if (*cprefix == '\0')
|
||||
strcpy(s, name);
|
||||
else
|
||||
// sprintf(s,"%s%c%s",cprefix, DIRSEP, name);
|
||||
_makepath(s, NULL, cprefix, name, NULL);
|
||||
}
|
||||
else sprintf(s,"%scom%c%s", __ptprf, DIRSEP, name);
|
||||
return(s);
|
||||
else
|
||||
sprintf(s,"%scom%c%s", __ptprf, DIRSEP, name);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -602,9 +702,11 @@ char *CGetIdxName(s)
|
||||
char *s; /* stringa contenente il nome file */
|
||||
|
||||
{
|
||||
static PathSt fdst;
|
||||
static char* fdst = NULL;
|
||||
char *s1, *s2;
|
||||
|
||||
|
||||
if (fdst == NULL)
|
||||
fdst = malloc(_MAX_PATH);
|
||||
strcpy(fdst, s) ;
|
||||
s1 = strrchr(fdst,DIRSEP) ;
|
||||
if (s1 == NULL) s1 = fdst;
|
||||
|
@ -121,14 +121,16 @@ extern "C" {
|
||||
/* @(:) 2.3.01.144 */
|
||||
void zerordes(RecDes *);
|
||||
word setrdes(RecDes *);
|
||||
char *CGetPref(void);
|
||||
void CPutPref(char *);
|
||||
const char* CGetPref(void);
|
||||
void CPutPref(const char *);
|
||||
char *CAddPref(char *);
|
||||
/* @(!) 2.3.01.144 */
|
||||
char *CInsPref(char *, int);
|
||||
/* @(:) 2.3.01.144 */
|
||||
char *CGetIdxName(char *);
|
||||
|
||||
const char* CGetPrawinName(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -57,8 +57,8 @@ static DATA4 *dbdata[CB4FILES];
|
||||
|
||||
static char * find_slash_backslash(char * str)
|
||||
{
|
||||
static char* xstr = NULL;
|
||||
int l=strlen(str);
|
||||
static char * xstr ;
|
||||
xstr = str + l;
|
||||
|
||||
while (xstr-- && l--)
|
||||
@ -630,7 +630,7 @@ int DB_packfile(short vis, const char * filename, long eod)
|
||||
strcpy(s,"Compattamento dati file : ");
|
||||
strcat(s,(char*)filename);
|
||||
#ifndef FOXPRO
|
||||
progind_create(10L,s,1,1,1);
|
||||
progind_create(100L,s,0,0,60);
|
||||
#endif
|
||||
}
|
||||
if (eod < d4recCount(dbdata[handle]))
|
||||
@ -641,7 +641,6 @@ int DB_packfile(short vis, const char * filename, long eod)
|
||||
if (vis)
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
progind_set_status((long)10);
|
||||
progind_destroy();
|
||||
#endif
|
||||
}
|
||||
@ -671,14 +670,13 @@ int DB_packmemo(short vis, const char * filename)
|
||||
strcpy(s,"Compattamento memo file : ");
|
||||
strcat(s,(char*)filename);
|
||||
#ifndef FOXPRO
|
||||
progind_create(10L,s,1,1,1);
|
||||
progind_create(100L,s,0,0,60);
|
||||
#endif
|
||||
}
|
||||
rt=d4memoCompress(dbdata[handle]);
|
||||
if (vis)
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
progind_set_status((long)10);
|
||||
progind_destroy();
|
||||
#endif
|
||||
}
|
||||
@ -719,7 +717,7 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis)
|
||||
l = lt - 9;
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create(items,"Ricerca record duplicati",1,1,1);
|
||||
progind_create(items,"Ricerca record duplicati",0,1,60);
|
||||
#endif
|
||||
|
||||
rt = tfile4bottom(t->tagFile);
|
||||
@ -775,7 +773,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
||||
char *ff = find_slash_backslash((char *)filename);
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create((long)r->NKeys,s,1,1,1);
|
||||
progind_create((long)r->NKeys,s,0,1,60);
|
||||
#endif
|
||||
if ((ff == NULL) || *ff == '\0')
|
||||
ff = (char *)filename;
|
||||
@ -802,7 +800,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create((long)r->NKeys,s,1,1,1);
|
||||
progind_create((long)r->NKeys,s,0,1,60);
|
||||
#endif
|
||||
w = i4create(dbdata[handle],(char*)filename,tags);
|
||||
if (w == NULL) rt = code_base.errorCode;
|
||||
@ -1102,17 +1100,20 @@ long DB_index_next(int handle)
|
||||
|
||||
char* DB_index_getkey(int handle)
|
||||
{
|
||||
static char* key = NULL;
|
||||
TAG4 *t;
|
||||
static char key[MAXLEN];
|
||||
int klen;
|
||||
|
||||
if(dbdata[handle]==0) return(NULL);
|
||||
|
||||
if (key == NULL)
|
||||
key = malloc(MAXLEN);
|
||||
if(dbdata[handle]==0)
|
||||
return(NULL);
|
||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(NULL);
|
||||
klen=a4tagKeyLen(dbdata[handle]);
|
||||
if (klen > (MAXLEN-1)) klen=MAXLEN-1;
|
||||
memcpy(key,a4tagKey(dbdata[handle]),klen); /* tfile4key non restituisce una null terminated string */
|
||||
key[klen]='\0';
|
||||
return(key);
|
||||
return key;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -1236,8 +1237,8 @@ static X4FILTER xdb[CB4FILES];
|
||||
|
||||
static char * find_slash_backslash(char * str)
|
||||
{
|
||||
static char* xstr = NULL;
|
||||
int l=strlen(str);
|
||||
static char * xstr ;
|
||||
xstr = str + l;
|
||||
|
||||
while (xstr-- && l--)
|
||||
@ -1900,10 +1901,10 @@ int DB_packfile(short vis, const char * filename, long eod)
|
||||
|
||||
if (vis)
|
||||
{
|
||||
strcpy(s,"Compattamento dati file : ");
|
||||
strcat(s,(char*)filename);
|
||||
strcpy(s, "Compattamento dati file : ");
|
||||
strcat(s, filename);
|
||||
#ifndef FOXPRO
|
||||
progind_create(10L,s,1,1,1);
|
||||
progind_create(100L,s,0,0,60);
|
||||
#endif
|
||||
}
|
||||
if (eod < d4reccount(dbdata[handle]))
|
||||
@ -1914,7 +1915,6 @@ int DB_packfile(short vis, const char * filename, long eod)
|
||||
if (vis)
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
progind_set_status((long)10);
|
||||
progind_destroy();
|
||||
#endif
|
||||
}
|
||||
@ -1944,14 +1944,13 @@ int DB_packmemo(short vis, const char * filename)
|
||||
strcpy(s,"Compattamento memo file : ");
|
||||
strcat(s,(char*)filename);
|
||||
#ifndef FOXPRO
|
||||
progind_create(10L,s,1,1,1);
|
||||
progind_create(100L,s,0,0,60);
|
||||
#endif
|
||||
}
|
||||
rt=d4memo_compress(dbdata[handle]);
|
||||
if (vis)
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
progind_set_status((long)10);
|
||||
progind_destroy();
|
||||
#endif
|
||||
}
|
||||
@ -1992,7 +1991,7 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis)
|
||||
l = lt - 9;
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create(items,"Ricerca record duplicati",1,1,1);
|
||||
progind_create(items,"Ricerca record duplicati",0,1,60);
|
||||
#endif
|
||||
|
||||
rt = t4bottom(t);
|
||||
@ -2049,7 +2048,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
||||
char *ff = find_slash_backslash((char *)filename);
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create((long)r->NKeys,s,1,1,1);
|
||||
progind_create((long)r->NKeys,s,0,1,60);
|
||||
#endif
|
||||
if ((ff == NULL) || *ff == '\0')
|
||||
ff = (char *)filename;
|
||||
@ -2076,7 +2075,7 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a
|
||||
{
|
||||
#ifndef FOXPRO
|
||||
if (vis)
|
||||
progind_create((long)r->NKeys,s,1,1,1);
|
||||
progind_create((long)r->NKeys,s,0,1,60);
|
||||
#endif
|
||||
w = i4create(dbdata[handle],(char*)filename,tags);
|
||||
if (w == NULL) rt = code_base.error_code;
|
||||
@ -2382,17 +2381,22 @@ long DB_index_next(int handle)
|
||||
|
||||
char* DB_index_getkey(int handle)
|
||||
{
|
||||
static char* key = NULL;
|
||||
TAG4 *t;
|
||||
static char key[MAXLEN];
|
||||
int klen;
|
||||
|
||||
if (key == NULL)
|
||||
key = malloc(MAXLEN);
|
||||
|
||||
if(dbdata[handle]==0) return(NULL);
|
||||
if(dbdata[handle]==0)
|
||||
return NULL;
|
||||
|
||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(NULL);
|
||||
klen=expr4key_len(t->expr);
|
||||
if (klen > (MAXLEN-1)) klen=MAXLEN-1;
|
||||
memcpy(key,t4key(t),klen); /* t4key non restituisce una null terminated string */
|
||||
key[klen]='\0';
|
||||
return(key);
|
||||
return key;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -37,7 +37,8 @@ static FILE *fp1, *fp2;
|
||||
static char fdname [42];
|
||||
static char f2name [42];
|
||||
|
||||
static int sortcomp(char **, char **);
|
||||
//static int sortcomp(char **, char **);
|
||||
static int sortcomp(const void*, const void*);
|
||||
static char *appr_mem(unsigned *);
|
||||
/* @(!) 2.3.00.112 */
|
||||
static FILE *wopen(char *);
|
||||
@ -142,7 +143,7 @@ void sort(s_rcd)
|
||||
|
||||
static void prep_merge()
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
struct bp *rr;
|
||||
unsigned n_bfsz;
|
||||
|
||||
@ -260,12 +261,12 @@ void dummy()
|
||||
|
||||
static void merge()
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
int needy, needx; /* true = need a rcd from (x/y) */
|
||||
/* @(!) 2.3.00.112 */
|
||||
unsigned xcnt, ycnt; /* # rcds left each sequence */
|
||||
/* @(:) 2.3.00.112 */
|
||||
int x, y; /* sequence counters */
|
||||
unsigned x, y; /* sequence counters */
|
||||
long adx, ady; /* sequence record disk addresses */
|
||||
/* @(!) 2.3.00.112 */
|
||||
char *ysptr = init_sptr + sp->rc_len;
|
||||
@ -614,10 +615,16 @@ static FILE *wopen(name)
|
||||
@(FN)
|
||||
*/
|
||||
|
||||
static int sortcomp(a,b)
|
||||
char **a; char **b; /* puntatori ai puntatori ai record da confrontare */
|
||||
|
||||
// static int sortcomp(a,b)
|
||||
// char **a; char **b; /* puntatori ai puntatori ai record da confrontare */
|
||||
|
||||
static int sortcomp(const void* pa, const void* pb)
|
||||
{
|
||||
int i, k;
|
||||
|
||||
const char** a = (const char**)pa;
|
||||
const char** b = (const char**)pb;
|
||||
|
||||
if (**a == 127 || **b == 127)
|
||||
return (int) **a - (int) **b;
|
||||
|
@ -94,10 +94,10 @@ extern "C" {
|
||||
void CPutRec(int, RecDes *, int);
|
||||
void zerordes(RecDes *);
|
||||
word setrdes(RecDes *);
|
||||
char *prefname(void);
|
||||
const char* CGetPrawinName(void);
|
||||
char *CAddPref(char *);
|
||||
char *CGetPref(void);
|
||||
void CPutPref(char *);
|
||||
const char* CGetPref(void);
|
||||
void CPutPref(const char *);
|
||||
char *CInsPref(char *, int);
|
||||
char *CGetIdxName(char *);
|
||||
int init_sort(struct s_prm *);
|
||||
|
@ -743,13 +743,13 @@ bool TMask::on_key(
|
||||
char mkKeyphrase[16];
|
||||
} mk;
|
||||
|
||||
TFilename topic(source_file()); topic.ext("");
|
||||
mk.mkSize = sizeof(MULTIGUY);
|
||||
mk.mkKeylist = 'M';
|
||||
strcpy(mk.mkKeyphrase, topic);
|
||||
_splitpath(source_file(), NULL, NULL, mk.mkKeyphrase, NULL);
|
||||
|
||||
TFilename hlp("prassi.hlp");
|
||||
const TString16 mod(topic.left(2));
|
||||
TString16 mod(mk.mkKeyphrase);
|
||||
mod.cut(2); mod.lower();
|
||||
if (mod != "ba") hlp.insert(mod, 0);
|
||||
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
|
@ -253,7 +253,7 @@ void skstream::open( const char *addr, const service port, const role side )
|
||||
}
|
||||
|
||||
sa.sin_addr.S_un.S_addr = *(unsigned long *)( he->h_addr_list[ 0 ] ) ;
|
||||
sa.sin_port = htons( port ) ;
|
||||
sa.sin_port = ::htons( port ) ;
|
||||
|
||||
if( SOCKET_ERROR == ::connect( _socket, (sockaddr *)&sa, sizeof( sa ) ) )
|
||||
{
|
||||
@ -334,8 +334,8 @@ unsigned short skstream::getport( void ) const
|
||||
int sasize = sizeof( sa ) ;
|
||||
if( SOCKET_ERROR ==::getpeername( getsocket(), (sockaddr *)&sa, &sasize ) )
|
||||
// Cannot get peer port
|
||||
return ntohs( IPPORT_RESERVED ) ;
|
||||
return ntohs( sa.sin_port ) ;
|
||||
return ::ntohs( IPPORT_RESERVED ) ;
|
||||
return ::ntohs( sa.sin_port ) ;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -5,10 +5,6 @@
|
||||
#define __PREFIX_CPP
|
||||
#include <prefix.h>
|
||||
|
||||
#ifndef FOXPRO
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#include <extcdecl.h>
|
||||
#include <tabutil.h>
|
||||
#include <scanner.h>
|
||||
@ -86,26 +82,26 @@ TPrefix::TPrefix() : _filelevel(0), _items(0)
|
||||
_rdir = rdir;
|
||||
|
||||
CGetPref();
|
||||
const TFilename dir(cprefix);
|
||||
|
||||
const TFilename dir(cprefix);
|
||||
const long primaditta = atol(dir.name());
|
||||
|
||||
if (primaditta > 0 && !exist(primaditta))
|
||||
{
|
||||
ofstream out_pr(prefname());
|
||||
out_pr << "com" << endl;
|
||||
// ofstream out_pr(prefname());
|
||||
// out_pr << "com" << endl;
|
||||
set("com", TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TPrefix::~TPrefix()
|
||||
|
||||
{
|
||||
set();
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int closeall(bool changestudy, TBit_array& excl, TBit_array& toclose)
|
||||
|
||||
{
|
||||
if (!openf) return 0;
|
||||
TDir d;
|
||||
@ -247,16 +243,25 @@ void TPrefix::set(
|
||||
if (strcmp(name, "DEF") == 0)
|
||||
{
|
||||
CGetPref();
|
||||
_prefix = cprefix;
|
||||
const int l = strlen(__ptprf);
|
||||
if (l > 0) _prefix.ltrim(l);
|
||||
// _prefix = cprefix;
|
||||
// const int l = strlen(__ptprf);
|
||||
// if (l > 0) _prefix.ltrim(l);
|
||||
_splitpath(cprefix, NULL, NULL, _prefix.get_buffer(), NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
_prefix = name;
|
||||
if (*__ptprf && *name) strcpy(cprefix, __ptprf);
|
||||
else strcpy(cprefix, "");
|
||||
/*
|
||||
if (*__ptprf && *name)
|
||||
strcpy(cprefix, __ptprf);
|
||||
else
|
||||
strcpy(cprefix, "");
|
||||
strcat(cprefix, name);
|
||||
*/
|
||||
if (*name)
|
||||
_makepath(cprefix, NULL, __ptprf, name, NULL);
|
||||
else
|
||||
strcpy(cprefix, "");
|
||||
}
|
||||
|
||||
if (!test(_prefix))
|
||||
@ -311,29 +316,21 @@ bool TPrefix::test(const char* s) const
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TPrefix::put()
|
||||
{
|
||||
CPutPref((char*)(const char*)_prefix);
|
||||
}
|
||||
|
||||
|
||||
bool TPrefix::test(long codditta) const
|
||||
{
|
||||
TString16 s("com");
|
||||
if (codditta > 0L)
|
||||
s.format("%05lda", codditta);
|
||||
s.format("%05ldA", codditta);
|
||||
return test(s);
|
||||
}
|
||||
|
||||
|
||||
long TPrefix::get_codditta() const
|
||||
{
|
||||
const long codditta = atol((const char*)_prefix);
|
||||
const long codditta = atol(_prefix);
|
||||
return codditta;
|
||||
}
|
||||
|
||||
|
||||
bool TPrefix::set_codditta(long codditta, bool force)
|
||||
{
|
||||
if (force || test(codditta))
|
||||
@ -342,12 +339,44 @@ bool TPrefix::set_codditta(long codditta, bool force)
|
||||
if (codditta > 0L)
|
||||
s.format("%05lda", codditta);
|
||||
set(s, force);
|
||||
put();
|
||||
CPutPref(_prefix);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char* TPrefix::get_studio() const
|
||||
{
|
||||
return __ptprf;
|
||||
}
|
||||
|
||||
bool TPrefix::set_studio(const char* study, long ditta)
|
||||
{
|
||||
if (!fexist(study))
|
||||
return FALSE;
|
||||
|
||||
const TString old_study(__ptprf);
|
||||
const TString old_firm(_prefix);
|
||||
|
||||
strcpy(__ptprf, study);
|
||||
const word len = strlen(__ptprf);
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
__ptprf[len] = SLASH;
|
||||
__ptprf[len+1] = '\0';
|
||||
}
|
||||
if (!test(ditta))
|
||||
ditta = 0L;
|
||||
|
||||
bool ok = set_codditta(ditta, TRUE);
|
||||
if (!ok)
|
||||
{
|
||||
strcpy(__ptprf, old_study);
|
||||
set(old_firm, TRUE);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Ritorna la descrizione del file passato
|
||||
@ -362,7 +391,7 @@ const char* TPrefix::description(
|
||||
// <nl>Passando il nome di una tabella in <p cod> si ottiene la stessa cosa della
|
||||
// funzione <mf TDir::Tab_des>, ma viene cercato la descrizione nel titolo della maschera.
|
||||
{
|
||||
TString80 n(cod);
|
||||
TFilename n(cod);
|
||||
|
||||
if (n[0] == '%')
|
||||
n.ltrim(1);
|
||||
@ -402,18 +431,18 @@ const char* TPrefix::description(int cod) const
|
||||
const char* firm2dir(
|
||||
long codditta) // @parm Codice ditta da convertire
|
||||
{
|
||||
TFixed_string dir(__tmp_string, 256);
|
||||
TString16 firm;
|
||||
switch (codditta)
|
||||
{
|
||||
case -2: // Dati generali campione
|
||||
case -1: // Dati di studio
|
||||
dir = ""; break;
|
||||
firm = ""; break;
|
||||
case 0: // Dati comuni
|
||||
dir = "com"; break;
|
||||
firm = "com"; break;
|
||||
default: // Dati ditta
|
||||
dir.format("%05lda", codditta); break;
|
||||
firm.format("%05lda", codditta); break;
|
||||
}
|
||||
dir.insert(__ptprf, 0);
|
||||
_makepath(__tmp_string, NULL, __ptprf, firm, NULL);
|
||||
return __tmp_string;
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,6 @@ protected:
|
||||
// @cmember Verifica l'effettiva esistenza della directory <p s> sotto
|
||||
// la directory dati
|
||||
bool test(const char* s) const ;
|
||||
// @cmember Copia fisicamente la stringa <p _prefix> nel file "prefix.txt"
|
||||
void put();
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -60,6 +58,10 @@ public:
|
||||
long get_codditta() const ;
|
||||
// @cmember Setta il codice della ditta corrente
|
||||
bool set_codditta(long codditta, bool force = FALSE);
|
||||
// @cmember Ritorna lo studio corrente
|
||||
const char* get_studio() const;
|
||||
// @cmember Setta lo studio corrente
|
||||
bool set_studio(const char* study, long firm = 0);
|
||||
// @cmember Ritorna il contenuto della variabile <p _prefix>
|
||||
const char* name() const
|
||||
{ return _prefix;}
|
||||
|
@ -218,7 +218,7 @@ TTimerind::~TTimerind()
|
||||
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||
void progind_create(long m, const char* t, bool b, bool c, int n)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m,t,b,c,n);
|
||||
@ -250,7 +250,7 @@ void progind_destroy()
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||
void timerind_create(long l, const char* title, bool bar, bool cancel,
|
||||
int divisions, int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifdef __cplusplus
|
||||
#ifndef __PROGIND_H
|
||||
#define __PROGIND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
@ -143,20 +144,19 @@ public:
|
||||
virtual ~TTimerind();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// Non commentate perche' destinate a sparire
|
||||
void progind_create(long, char*, bool, bool, int);
|
||||
void progind_create(long, const char*, bool, bool, int);
|
||||
void progind_set_status(long);
|
||||
void progind_cancel();
|
||||
bool progind_iscancelled();
|
||||
bool progind_isfinished();
|
||||
void progind_destroy();
|
||||
void timerind_create(long, char*, bool, bool, int, int);
|
||||
void timerind_create(long, const char*, bool, bool, int, int);
|
||||
void timerind_cancel();
|
||||
bool timerind_iscancelled();
|
||||
bool timerind_isfinished();
|
||||
|
Loading…
x
Reference in New Issue
Block a user