cfiles, isam Correzioni gestione date su file
controls Corretta sottolineatura dell'acceleratore dei bottoni config Risolto conflitto sulla correzione di prassis.ini checks Editato per errore default.url Aggiunto acceleratore ALT-F git-svn-id: svn://10.65.10.50/trunk@1547 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
55394b9fac
commit
2fbfb0a6b5
255
include/cfiles.c
255
include/cfiles.c
@ -820,53 +820,6 @@ Si osservi che "fout" deve essere un puntatore a una variabile di tipo coerente
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
||||
int CGetField(fieldname,recd,recin,fout)
|
||||
char *fieldname; /* nome del campo */
|
||||
RecDes *recd; /* descrittore record */
|
||||
RecType recin; /* buffer contenente il record */
|
||||
void *fout; /* contenuto del campo in output */
|
||||
|
||||
{
|
||||
int r,p;
|
||||
char *s, frm[30], *wp = (char *) fout;
|
||||
|
||||
s = malloc(256);
|
||||
p = findfld(recd, fieldname);
|
||||
getfrmt(recd, p, frm);
|
||||
if ((r = CGetFieldBuff(fieldname, recd, recin, s)) != -1)
|
||||
if (recd->Fd[p].TypeF == AlfaF) strcpy((char *) fout, s);
|
||||
else
|
||||
if ((recd->Fd[p].TypeF == IntF) || (recd->Fd[p].TypeF == ZeroF))
|
||||
{
|
||||
if (LENGTH(s)) *((int *) fout) = CCONVINT(s);
|
||||
else *((int *) fout) = 0;
|
||||
}
|
||||
else
|
||||
if ((recd->Fd[p].TypeF == Int4F) || (recd->Fd[p].TypeF == EZeroF))
|
||||
{
|
||||
if (LENGTH(s)) *((long *) fout) = CONVLONG(s);
|
||||
else *((long *) fout) = 0L;
|
||||
}
|
||||
else
|
||||
if (recd->Fd[p].TypeF == RealF) atod((DEC *) fout, s);
|
||||
else
|
||||
if (recd->Fd[p].TypeF == DateF) *((TrDate *) fout) = cpackdata(s);
|
||||
else
|
||||
if (recd->Fd[p].TypeF == WordF)
|
||||
{
|
||||
if (LENGTH(s)) *((unsigned *) fout) = (unsigned)CONVLONG(s);
|
||||
else *((unsigned *) fout) = 0;
|
||||
}
|
||||
else
|
||||
if (recd->Fd[p].TypeF == CharF)
|
||||
*wp = *s;
|
||||
else
|
||||
if (recd->Fd[p].TypeF == BoolF)
|
||||
*((BOOLEAN *) fout) = (*s == 'X');
|
||||
free(s);
|
||||
return(r);
|
||||
}
|
||||
|
||||
/*
|
||||
@(#) CPutField FILES
|
||||
|
||||
@ -913,22 +866,20 @@ Si osservi che "fin" deve essere un puntatore a una variabile di tipo coerente c
|
||||
sprintf(s, frm, *((long *) fin)) ;
|
||||
else
|
||||
if (recd->Fd[p].TypeF == RealF) dsprintf(s, frm, (DEC *) fin);
|
||||
else
|
||||
if (recd->Fd[p].TypeF == DateF) ceditdata(*((TrDate *) fin), s);
|
||||
else
|
||||
if (recd->Fd[p].TypeF == WordF) sprintf(s, frm, *((unsigned *) fin)) ;
|
||||
else
|
||||
if (recd->Fd[p].TypeF == CharF)
|
||||
{
|
||||
s[0] = *((char *) fin);
|
||||
s[1] = '\0';
|
||||
}
|
||||
else
|
||||
if (recd->Fd[p].TypeF == BoolF)
|
||||
{
|
||||
s[0] = *((BOOLEAN*) fin) ? 'X' : ' ';
|
||||
s[1] = '\0';
|
||||
}
|
||||
else
|
||||
if (recd->Fd[p].TypeF == WordF) sprintf(s, frm, *((unsigned *) fin)) ;
|
||||
else
|
||||
if (recd->Fd[p].TypeF == CharF)
|
||||
{
|
||||
s[0] = *((char *) fin);
|
||||
s[1] = '\0';
|
||||
}
|
||||
else
|
||||
if (recd->Fd[p].TypeF == BoolF)
|
||||
{
|
||||
s[0] = *((BOOLEAN*) fin) ? 'X' : ' ';
|
||||
s[1] = '\0';
|
||||
}
|
||||
return CPutFieldBuff(fieldname, recd, s, recout);
|
||||
}
|
||||
|
||||
@ -1023,12 +974,7 @@ Utilizzato per il Data Entry.
|
||||
while ((len) && (s[len - 1] == ' ')) s[--len] = '\0';
|
||||
}
|
||||
else strcpy(s, "");
|
||||
if ((recd->Fd[p].TypeF == DateF))
|
||||
{
|
||||
if (LENGTH(s)) d = atol(s); /* sscanf(s, "%ld", &d); */
|
||||
else d = 0 ;
|
||||
ceditdata(d, s);
|
||||
}
|
||||
|
||||
if ((recd->Fd[p].TypeF == RealF))
|
||||
if ((s1 = strchr(s, ',')) != NULL) *s1 = '.';
|
||||
return(0);
|
||||
@ -1088,11 +1034,6 @@ Utilizzato per il Data Entry
|
||||
{
|
||||
off = recd->Fd[p].RecOff;
|
||||
len = recd->Fd[p].Len;
|
||||
if (recd->Fd[p].TypeF == DateF)
|
||||
{
|
||||
d = cpackdata(s2);
|
||||
sprintf(s2,"%06ld", d);
|
||||
}
|
||||
if (recd->Fd[p].TypeF == RealF) setdec(s2, recd->Fd[p].Dec);
|
||||
l = LENGTH(s2);
|
||||
if (l > len)
|
||||
@ -1216,172 +1157,6 @@ junk = variabile spazzatura per la chiamata di CZeroField.
|
||||
recd, recout);
|
||||
}
|
||||
|
||||
/*
|
||||
@($) CBuildKey FILES
|
||||
|
||||
@(ID)
|
||||
Costruisce la chiave corrispondente al numero chiave.
|
||||
@(FD)
|
||||
|
||||
@(ISV)
|
||||
i = contatore.
|
||||
|
||||
nf = numero campi che compongono la chiave.
|
||||
|
||||
len = lunghezza del campo.
|
||||
|
||||
off = offest in byte all'interno del record per il campo in oggetto.
|
||||
|
||||
l = variabile di lavoro.
|
||||
|
||||
up = variabile di lavoro per rendere maiuscola la stringa.
|
||||
|
||||
wd = variabile per la data.
|
||||
|
||||
s1 = stringa di lavoro.
|
||||
@(FSV)
|
||||
|
||||
@(IN)
|
||||
NON UTILIZZARE !!.
|
||||
|
||||
Se si utilizza spiegarne dettagliatamente il motivo.
|
||||
@(FN)
|
||||
*/
|
||||
|
||||
int CBuildKey(recd,numkey,recin,key)
|
||||
RecDes *recd; /* descrittore record */
|
||||
int numkey; /* numero chiave */
|
||||
RecType recin; /* buffer contenente il record */
|
||||
char *key; /* valore della chiave */
|
||||
|
||||
{
|
||||
int i, nf, l = 0, len, off;
|
||||
TrDate wd ;
|
||||
char s1[10];
|
||||
BOOLEAN upp = FALSE;
|
||||
|
||||
strcpy(key, "");
|
||||
if (numkey-- <= recd->NKeys)
|
||||
{
|
||||
for (i = 0; i < recd->Ky[numkey].NkFields; i++)
|
||||
{
|
||||
if ((upp = (recd->Ky[numkey].FieldSeq[i] > MaxFields)) == TRUE)
|
||||
nf = recd->Ky[numkey].FieldSeq[i] - MaxFields;
|
||||
else
|
||||
nf = recd->Ky[numkey].FieldSeq[i];
|
||||
if (recd->Ky[numkey].FromCh[i] == INVFLD)
|
||||
{
|
||||
off = recd->Fd[nf].RecOff;
|
||||
len = recd->Fd[nf].Len;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (recd->Fd[nf].TypeF == DateF)
|
||||
{
|
||||
off = recd->Fd[nf].RecOff;
|
||||
len = recd->Fd[nf].Len;
|
||||
strncpy(s1, (recin + off), len);
|
||||
s1[len] = '\0';
|
||||
wd = 0;
|
||||
if (s1[0] <= '0')
|
||||
{
|
||||
for(len = 0; len < LENGTH(s1); len++)
|
||||
if (isdigit(s1[len])) wd = (wd * 10) + (s1[len] - '0');
|
||||
ceditdata(wd, s1);
|
||||
s1[2] = s1[3];
|
||||
s1[3] = s1[4];
|
||||
s1[4] = s1[6];
|
||||
s1[5] = s1[7];
|
||||
s1[6] = '\0';
|
||||
}
|
||||
off = recd->Ky[numkey].FromCh[i];
|
||||
len = recd->Ky[numkey].ToCh[i] -
|
||||
recd->Ky[numkey].FromCh[i] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
off = recd->Fd[nf].RecOff + recd->Ky[numkey].FromCh[i];
|
||||
len = recd->Ky[numkey].ToCh[i] -
|
||||
recd->Ky[numkey].FromCh[i] + 1;
|
||||
}
|
||||
}
|
||||
if ((l + len) > 80)
|
||||
{
|
||||
strcpy(key, "");
|
||||
return(BTrKeyLenErr);
|
||||
}
|
||||
if ((recd->Fd[nf].TypeF == DateF) && (recd->Ky[numkey].FromCh[i] != INVFLD))
|
||||
strncpy((key + l), &s1[off], len);
|
||||
else
|
||||
{
|
||||
strncpy((key + l), (recin + off), len);
|
||||
if (recin[off] == '\0') memset(key + l, ' ', len);
|
||||
else
|
||||
if ((recd->Fd[nf].TypeF == IntF) ||
|
||||
(recd->Fd[nf].TypeF == Int4F) ||
|
||||
(recd->Fd[nf].TypeF == WordF))
|
||||
{
|
||||
int w = l, j = l + len;
|
||||
while (w < j && key[w] == ' ') w++;
|
||||
while (w < j && key[w] == '0')
|
||||
key[w++] = ' ';
|
||||
}
|
||||
}
|
||||
l += len;
|
||||
}
|
||||
key[l] = '\0';
|
||||
crtrim(key);
|
||||
if (upp) CUpString(key) ;
|
||||
return(NoErr);
|
||||
}
|
||||
return(BTrPathErr);
|
||||
}
|
||||
|
||||
/*
|
||||
@($) CCalcLenKey FILES
|
||||
|
||||
@(ID)
|
||||
Ritorna la lunghezza della chiave.
|
||||
@(FD)
|
||||
|
||||
@(ISV)
|
||||
nf = numero campi chiave.
|
||||
|
||||
i = contatore.
|
||||
|
||||
l = variabile di lavoro.
|
||||
@(FSV)
|
||||
|
||||
@(IN)
|
||||
NON UTILIZZARE !!.
|
||||
|
||||
Se si utilizza spiegarne dettagliatamente il motivo.
|
||||
@(FN)
|
||||
*/
|
||||
|
||||
int CCalcLenKey(recd,numkey)
|
||||
RecDes *recd; /* descrittore record */
|
||||
int numkey; /* numero della chiave */
|
||||
|
||||
{
|
||||
register int l = 0, i, nf;
|
||||
|
||||
if (numkey-- <= recd->NKeys)
|
||||
{
|
||||
for (i = 0; i < recd->Ky[numkey].NkFields; i++)
|
||||
{
|
||||
if (recd->Ky[numkey].FieldSeq[i] > MaxFields)
|
||||
nf = (int) recd->Ky[numkey].FieldSeq[i] - MaxFields;
|
||||
else
|
||||
nf = (int) recd->Ky[numkey].FieldSeq[i];
|
||||
if (recd->Ky[numkey].FromCh[i] == INVFLD) l += (int) recd->Fd[nf].Len;
|
||||
else l += (int) (recd->Ky[numkey].ToCh[i] - recd->Ky[numkey].FromCh[i] + 1);
|
||||
}
|
||||
return(l);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@($) prefname FILES
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifdef XVT
|
||||
#ifndef XVT_INCL_XVT
|
||||
#include <xvt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#define STRICT
|
||||
|
@ -446,14 +446,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
case CONFIG_STUDIO:
|
||||
case CONFIG_USER:
|
||||
case CONFIG_STAMPE:
|
||||
_file = firm2dir(0);
|
||||
if (_file.not_empty())
|
||||
{
|
||||
for (int i = _file.len()-1; i >= 0; i--)
|
||||
if (_file[i] == '/' || _file[i] == '\\') break;
|
||||
_file.cut(i+1);
|
||||
}
|
||||
_file << "config";
|
||||
_file = firm2dir(-1); // Directory dati
|
||||
_file.add("config");
|
||||
if (!fexist(_file))
|
||||
make_dir(_file);
|
||||
|
||||
|
@ -611,10 +611,10 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
TFixed_string c(capt);
|
||||
_accel = c.find('~');
|
||||
if (_accel > 0)
|
||||
_accel *= CHARX;
|
||||
_accel = xvt_dwin_get_text_width(win(), (char*)capt, _accel);
|
||||
|
||||
_dx = (width - xvt_dwin_get_text_width(win(), (char*)caption(), -1)) >> 1;
|
||||
_dy = (height-CHARY)/2 + BASEY - DEPTH;
|
||||
_dy = (height- CHARY)/2 + BASEY - DEPTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,7 @@ SEPARATOR
|
||||
ITEM M_EDIT_SEARCH "Cerca...\tF7"
|
||||
ITEM M_EDIT_DELETE "Cerca il prossimo\tF8" DISABLED
|
||||
|
||||
|
||||
ACCEL MENU_FILE "f" ALT
|
||||
ACCEL MENU_FILE "f" alt
|
||||
|
||||
#if XVTWS == WINWS
|
||||
image BMP_OK "f:/p.due/bmp/ok.bmp"
|
||||
|
@ -962,8 +962,11 @@ int TBaseisamfile::_open(unsigned int mode)
|
||||
filehnd()->ln = num();
|
||||
openf[num() - 1] = filehnd();
|
||||
_recno = -1L;
|
||||
|
||||
CHECKD(filehnd()->r->NKeys > 0, "File senza indici: ", num());
|
||||
_lasterr = NOERR;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
_lasterr = get_error(filehnd()->fhnd);
|
||||
relisfd(_isamfile);
|
||||
@ -1029,7 +1032,7 @@ TLocalisamfile::TLocalisamfile(int logicnum, bool linkrecinst)
|
||||
if (linkrecinst <= TRUE)
|
||||
{
|
||||
open();
|
||||
if (_was_open)
|
||||
if (_was_open)
|
||||
_oldkey = getkey();
|
||||
setkey(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user