Nuntio vobis gaudium magnum: habemus Papam,

cui nomen inditum est Victorius XXXII

Aggiunte maschere senza handler statici, TAutomask
Tolto file inutile libdefs.h
Megafigata per un significativo speed-up dei TCursori


git-svn-id: svn://10.65.10.50/trunk@6304 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-03-05 13:54:51 +00:00
parent d932168794
commit 306e964e2c
60 changed files with 1104 additions and 708 deletions

View File

@ -46,38 +46,37 @@ bool xvt_running()
{ return _xvt_running; }
// Ritorna il nome della ditta che vende il programma attuale
HIDDEN char* prassi_spa()
HIDDEN const char* prassi_spa(TString& firm)
{
TString firm(80);
char* p = NULL;
TConfig ini("install.ini", "Main");
firm = ini.get("Producer");
if (firm.not_empty())
{
p = (char*)decode(firm);
const char* p = decode(firm);
for (const char* c = p; *c; c++)
{
if (*c > '\0' && *c < ' ')
if (*c > '\0' && *c < ' ') // Hand crafted string?
{
p = NULL;
break;
}
}
firm = p;
}
if (p == NULL)
if (firm.empty())
{
ignore_xvt_errors(TRUE);
p = xvt_res_get_str(STR_FIRMNAME, firm.get_buffer(), firm.size());
char* p = firm.get_buffer(80);
xvt_res_get_str(STR_FIRMNAME, p, firm.size());
ignore_xvt_errors(FALSE);
}
if (p == NULL)
p = "PR.A.S.S.I. S.p.A.";
if (firm.empty())
firm = "PR.A.S.S.I. S.p.A.";
return p;
return firm;
}
///////////////////////////////////////////////////////////
@ -144,7 +143,8 @@ void TBanner::handler(WINDOW win, EVENT* ep)
xvt_dwin_draw_text(win, x, y, t, -1);
set_font(XVT_FFN_TIMES);
t = prassi_spa();
TString spa;
t = (char*)prassi_spa(spa);
w = xvt_dwin_get_text_width(win, t, -1);
x = (r.right-r.left-w)>>1; y = BIGY;
xvt_dwin_draw_text(win, x, y, t, -1);
@ -213,7 +213,8 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
// Setta la caption della task window
TString cap;
cap << prassi_spa() << " - " << _application->get_module_name();
prassi_spa(cap);
cap << " - " << _application->get_module_name();
TTemp_window tw(win);
tw.set_caption(cap);
@ -289,7 +290,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
case M_HELP_CONTENTS:
case M_HELP_SEARCH:
case M_HELP_HELPONHELP:
os_exec_help_command(ep->v.cmd.tag);
os_exec_help_command(ep->v.cmd.tag, name());
break;
default:
if (ep->v.cmd.tag > MAX_MENU_TAG)
@ -563,11 +564,6 @@ void TApplication::run(
_name = cmd2name(argv[0]);
}
if (use_files())
init_global_vars();
else
CGetPref();
const int sn = get_serial_number();
if (sn < 0)
@ -581,6 +577,11 @@ void TApplication::run(
return;
}
if (use_files())
init_global_vars();
else
CGetPref();
set_perms();
const TFixed_string mod(get_module_name());
@ -847,14 +848,14 @@ bool TApplication::firm_change_enabled() const
// @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager
{
static bool can = 2;
static int can = 2;
if (can == 2)
#ifdef _DEMO_
can FALSE;
can = FALSE;
#else
can = os_spawn_by_menu();
can = ::os_spawn_by_menu();
#endif
return can;
return can != 0;
}
void TApplication::on_firm_change()

View File

@ -151,8 +151,8 @@ public:
};
#define FOR_EACH_ASSOC_STRING(__ass, __obj, __key, __str) \
const char *__key, *__str; __ass.restart; \
const char *__key, *__str; __ass.restart(); \
for (THash_object* __obj = __ass.get_hashobj(); \
__obj && (__str = (const TString&)__obj->obj(), __key = __obj->key()); \
__obj && ((__str = (const TString&)__obj->obj()) != NULL, (__key = __obj->key()) != NULL); \
__obj = __ass.get_hashobj())
#endif

123
include/automask.cpp Executable file
View File

@ -0,0 +1,123 @@
#include <automask.h>
bool TAutomask::error_box(const char* fmt, ...)
{
TString message(1024);
char* msg = message.get_buffer();
va_list argptr;
va_start(argptr, fmt);
int len = vsprintf(msg, fmt, argptr);
CHECKD(len <= message.size(), "Error message too long: ", len);
va_end(argptr);
if (is_sheetmask() && !is_running())
{
xvt_statbar_set(msg);
beep();
}
else
{
post_error_message(msg, 3);
}
return FALSE;
}
bool TAutomask::universal_handler(TMask_field& f, KEY key)
{
TAutomask& wm = (TAutomask&)f.mask();
TOperable_field& of = (TOperable_field&)f;
TField_event fe = fe_null;
long jolly = key;
switch (key)
{
case K_TAB:
if (wm.is_running() || wm.get_sheet() != NULL)
{
if (f.focusdirty() && f.is_edit())
fe = fe_modify;
}
else
fe = fe_init;
break;
case K_SPACE:
if (!f.is_edit())
{
if (wm.is_running())
{
if (f.is_kind_of(CLASS_BUTTON_FIELD))
fe = fe_button;
else
fe = fe_modify;
}
else
fe = fe_init;
}
break;
case K_ENTER:
fe = fe_close;
break;
case K_F9:
if (f.is_edit())
fe = fe_button;
break;
default:
fe = fe_null;
break;
}
return fe == fe_null ? TRUE : wm.on_field_event(of, fe, jolly);
}
bool TAutomask::universal_notifier(TSheet_field& s, int row, KEY key)
{
TAutomask& wm = (TAutomask&)s.mask();
TField_event fe = fe_null;
switch (key)
{
case K_INS:
fe = se_query_add;
break;
case K_CTRL+K_INS:
fe = se_notify_add;
break;
case K_DEL:
fe = se_query_del;
break;
case K_CTRL+K_DEL:
fe = se_notify_del;
break;
case K_TAB:
fe = se_enter;
break;
case K_CTRL+K_TAB:
fe = se_query_modify;
break;
case K_ENTER:
fe = se_notify_modify;
break;
default:
break;
}
return fe == fe_null ? TRUE : wm.on_field_event(s, fe, row);
}
void TAutomask::set_handlers()
{
for (int i = fields()-1; i >= 0; i--)
{
TMask_field& f = fld(i);
if (f.is_operable())
{
f.set_handler(universal_handler);
if (f.is_sheet())
((TSheet_field&)f).set_notify(universal_notifier);
}
}
}
TAutomask::TAutomask(const char* name, int num)
: TMask(name, num)
{
set_handlers();
}

31
include/automask.h Executable file
View File

@ -0,0 +1,31 @@
#ifndef __AUTOMASK_H
#define __AUTOMASK_H
#ifndef __MSKSHEET_H
#include <msksheet.h>
#endif
enum TField_event { fe_null, fe_init, fe_modify, fe_button, fe_close,
se_enter, se_query_modify, se_notify_modify,
se_query_add, se_notify_add,
se_query_del, se_notify_del };
class TAutomask : public TMask
{
private:
static bool universal_handler(TMask_field& f, KEY k);
static bool universal_notifier(TSheet_field& f, int row, KEY k);
protected:
void set_handlers();
public:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly) pure;
bool error_box(const char* fmt, ...); // No more f.error_box
TAutomask() { }
TAutomask(const char* name, int num = 0);
virtual ~TAutomask() { }
};
#endif

View File

@ -1,34 +1,12 @@
#ifndef __CCOMMON_H
#define __CCOMMON_H
#define M_TERMINFO
#ifdef __WATCOMC__
#pragma aux MS_C "_*" parm caller [] value struct float struct routine [ax] modify [ax bx cx dx es];
#endif
#ifdef XVT
#include <xvt.h>
#undef BOOLEAN
#include <checks.h>
#endif
#ifdef __GNUC__
#define __PACKED__ __attribute__ ((packed))
#define __ALIGNED__ __attribute__ ((aligned(2)))
#define __PACK_1__
#else
#define __PACKED__
#define __ALIGNED__
#endif
#ifdef DOS
#include <stdio.h>
#include <stdlib.h>
#define _NO_STDIO
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <fcntl.h>
#include <signal.h>
@ -61,16 +39,12 @@
#endif
#ifdef __LONGDOUBLE__
typedef unsigned int word;
//typedef unsigned int word;
#define ELLIPSES ...
#else
#include <gm.h>
#endif
#if !defined(__MSHELL_H) && !defined(FOXPRO)
#include "mshell.h"
#endif
#define CHR(c) (c)
#define ORD(c) (c)
#define ODD(c) (((c) % 2) != 0)
@ -92,12 +66,12 @@ typedef unsigned int word;
#define STRCMP(s1,op,s2) (strcmp(s1,s2) op 0)
#define CSTR(n,s) sprintf((s), "%-d", (n))
#define CSTR4(n,s) sprintf((s), "%-ld", (n))
#define MAXDATA cpackdata("31-12-50")
#define MINDATA cpackdata("01-01-51")
#define EMPTYDATA cpackdata(" - - ")
#define MONTHNAME(i) months[(i) - 1]
#define CCONVINT(s) atoi(s)
#define CONVLONG(s) atol(s)
//#define MAXDATA cpackdata("31-12-50")
//#define MINDATA cpackdata("01-01-51")
//#define EMPTYDATA cpackdata(" - - ")
//#define MONTHNAME(i) months[(i) - 1]
//#define CCONVINT(s) atoi(s)
//#define CONVLONG(s) atol(s)
#define BADR(x) ((x) - 1)
#define WINHND(hw) warr[(hw)].w
/* @(!) 2.3.01.69 */
@ -113,28 +87,24 @@ typedef unsigned int word;
#define CBITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
#define CBITSET(w,p,v) ((v) ? ((w) |= (0x0001 << (p))) : ((w) &= (~(0x0001 << (p)))))
/* @(!) 2.3.01.temp */
#ifdef M_I386
#ifndef BOOLEAN
#define BOOLEAN short
#else
/* @(:) 2.3.01.temp */
#define BOOLEAN int
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
#define NoErr 0
#define BADSIG (int (*)()) -1
#define MAXMENUITEM 21
#define MAXWIN 20
#define MAXBORDERS 8
#define MAXATTRS 20
#define BackCh '_'
//#define BADSIG (int (*)()) -1
//#define MAXMENUITEM 21
//#define MAXWIN 20
//#define MAXBORDERS 8
//#define MAXATTRS 20
//#define BackCh '_'
#define directory "dir.gen"
#define ntrrec "trc.gen"
#define nditta "dta.gen"
#define printers "prt.gen"
#define prcodes "prc.gen"
#define WWMESS 0
#define WWBAR 1
//#define printers "prt.gen"
//#define prcodes "prc.gen"
//#define WWMESS 0
//#define WWBAR 1
/* gia' definito in gm.h
typedef unsigned int word;
@ -146,39 +116,13 @@ typedef unsigned char uchar;
#ifdef FOXPRO
typedef unsigned char uchar;
#endif
#ifdef XVT_OS
#ifdef XVT
#ifdef DOS
typedef unsigned char uchar;
#endif
typedef long HWND;
#else
#endif
typedef struct {
char nome[52] __PACKED__ ;
char indirizzo[32] __PACKED__ ;
char citta[32] __PACKED__ ;
char cap[6] __PACKED__ ;
char partiva[12] __PACKED__ ;
char codfisc[18] __PACKED__ ;
/* @(!) 2.3.01.temp */
#ifdef M_I386
short numero __PACKED__ ;
short tab0[20] __PACKED__ ;
#else
/* @(:) 2.3.01.temp */
int numero;
int tab0[20];
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
long tab1 __PACKED__ ;
char nome1[52] __PACKED__ ;
char indirizzo1[32] __PACKED__ ;
char citta1[32] __PACKED__ ;
char cap1[6] __PACKED__ ;
char partiva1[12] __PACKED__ ;
char codfisc1[18] __PACKED__ ;
} TDitta;
typedef char Str8[9];
typedef char Str25[26];
typedef char Str30[32];
@ -186,19 +130,14 @@ typedef char Str80[82];
typedef char Str255[256];
typedef uchar StCh[256];
typedef long TrDate;
typedef struct {
char name[26];
char explic[82];
} MenuItem;
typedef MenuItem MenuArray[MAXMENUITEM + 1];
typedef char PathSt[82];
extern Str80 cprefix;
extern TDitta cditta;
extern TrDate dt;
extern Str8 sdt;
extern char months[12][12];
extern BOOLEAN iscolordisp;
//extern TrDate dt;
//extern Str8 sdt;
//extern char months[12][12];
//extern BOOLEAN iscolordisp;
#ifdef __cplusplus
extern "C" {
@ -259,8 +198,8 @@ extern "C" {
#endif
int CIOResult(void );
TDitta *CGetDitta(char *);
void CPutDitta(char *,TDitta *);
// TDitta *CGetDitta(char *);
// void CPutDitta(char *,TDitta *);
void CClearKb(void );
void crtrim(char *);
void cltrim(char *);
@ -268,16 +207,16 @@ extern "C" {
void CSpace(char *, int);
uchar editpref(BOOLEAN, BOOLEAN, BOOLEAN);
char **getlinefd(char *, char, char);
word getkeyid(void);
void addtokeybar(char *, word);
void delfromkeybar(word);
uchar *setofkeybar(word);
// word getkeyid(void);
// void addtokeybar(char *, word);
// void delfromkeybar(word);
// uchar *setofkeybar(word);
/* @(!) 2.3.01.134 */
uchar *strsetofkeybar(char *);
// uchar *strsetofkeybar(char *);
/* @(:) 2.3.01.134 */
/* @(!) 2.3.01.223 */
void suspendkey(char *);
void resumekey(char *);
// void suspendkey(char *);
// void resumekey(char *);
/* @(:) 2.3.01.223 */
/* @(!) 2.3.01.316 */
#ifdef DOS

View File

@ -1,5 +1,7 @@
#include "ccustio.h"
#include "checks.h"
#ifdef DOS
#include <sys/types.h>
#endif
@ -135,7 +137,8 @@ int seeklk(S, pos, lm, LockMode, rec)
{
S->IOR = CIOResult();
if (S->IOR == EACCES) S->IOR = EAGAIN;
// EACCESS = 13, EAGAIN = 11
if (S->IOR == 13) S->IOR = 11;
if (LockMode == UnLock || LockMode == NoLock) S->IOR = NoErr;
if (S->IOR != NoErr) return(-1);
}
@ -762,7 +765,7 @@ void VS(sid)
int excllock(name,excl)
char *name; /* nome del file */
BOOLEAN excl; /* se true deve fare il lock ex. altrimenti no */
int excl; /* se true deve fare il lock ex. altrimenti no */
{
#ifndef DOS
@ -854,7 +857,7 @@ int excllock(name,excl)
int exclunlock(name,excl)
char *name; /* nome file */
BOOLEAN excl; /* se true esegue un unlock sul file */
int excl; /* se true esegue un unlock sul file */
{
#ifndef DOS

View File

@ -3,8 +3,8 @@
#ifndef DOS
#include <unistd.h>
#include <errno.h>
#endif
#include <errno.h>
#ifndef __CCOMMON_H
#include "ccommon.h"
@ -14,7 +14,7 @@
#endif
#define BlockLenIO 512
#define Valid 0
#define Valid 0
#define Deleted 1
typedef char *FileName;
@ -35,19 +35,19 @@ typedef struct {
} SecDef ;
#ifdef DOS
#define TESTLOCK(x) (/*test_share() && */ ((x) == EACCES || (x) == EAGAIN))
#define DEADLOCK(x) (/*test_share() && */ (x) == EDEADLOCK)
#define TESTLOCK(x) ((x) == 13 || (x) == 11)
#define DEADLOCK(x) ((x) == EDEADLOCK)
#else
#define TESTLOCK(x) (((x) == EACCES) || ((x) == EAGAIN) || ((x) == ENOLCK))
#define TESTLOCK(x) (((x) == EACCES) || ((x) == EGAIN) || ((x) == ENOLCK))
#define DEADLOCK(x) (((x) == EDEADLOCK) || ((x) == EDEADLK))
#endif
#define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1)
/* @(!) 2.3.01.325 */
#ifdef DOS
#define ASPETTA(x) (sleep_dos(x))
//#define ASPETTA(x) (sleep_dos(x))
#else
#define ASPETTA(x) (sleep(x))
//#define ASPETTA(x) (sleep(x))
#endif
/* @(:) 2.3.01.325 */
@ -70,8 +70,8 @@ extern "C" {
BOOLEAN ITestLock(int );
/* @(!) 2.3.01.325 modificata int excllock(char *,BOOLEAN);*/
/* @(!) 2.3.01.325 modificata int exclunlock(char *,BOOLEAN);*/
int excllock(char *,BOOLEAN);
int exclunlock(char *,BOOLEAN);
int excllock(char *,int);
int exclunlock(char *,int);
int sleep_dos(int);
/* @(:) 2.3.01.325 */
BOOLEAN test_share(void);

View File

@ -1,27 +1,21 @@
#define __CFILES_C /* fv */
#include "cfiles.h"
#include "fldtypes.h"
#ifdef DOS
#define XVT_INCL_NATIVE
#include <xvt.h>
#include <checks.h>
#include <io.h>
#include <stdlib.h>
#include <direct.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);
#define DRIVE_REMOVABLE 2
#define DRIVE_FIXED 3
#define DRIVE_REMOTE 4
UINT WINAPI GetDriveType(int);
#endif // DOS
#include "cfiles.h"
#include "fldtypes.h"
int hashfun(const char *);
void setdec(char *, int);
const char* prefname();
@ -61,8 +55,7 @@ void COpenDir(lockmode, dirflg)
if (dirfl[dirflg]++) return;
#ifndef DOS
if ((excllock(CInsPref(glockname, dirflg), (lockmode == ExclLock)) == -1)
&& (errno == EACCES))
if ((excllock(CInsPref(glockname, dirflg), (lockmode == ExclLock)) == -1))
fatal_box("Locked Directory. Error number : %d ", errno);
#endif
strcpy(name, CInsPref(directory, dirflg)) ;
@ -443,7 +436,7 @@ HIDDEN BOOLEAN CGetPrawin()
BOOLEAN good = _access(prawin, 0x00) == 0;
if (good)
{
word len = GetPrivateProfileString("Main", "Study", "", __ptprf, sizeof(__ptprf), prawin);
UINT len = GetPrivateProfileString("Main", "Study", "", __ptprf, sizeof(__ptprf), prawin);
good = len > 0;
if (good)
{
@ -472,7 +465,12 @@ BOOLEAN CPutPrawin(const char* pref)
BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
int disk = toupper(*prawin) - 'A';
WritePrivateProfileString("Main", "Study", __ptprf, prawin);
#if XVT_OS == XVT_OS_WIN32
if (GetDriveType("") == DRIVE_FIXED)
#else
if (GetDriveType(_getdrive() -1 ) == DRIVE_FIXED)
#endif
{
// Aggiorna anche il vecchio pathpref.ini, ma solo sui dischi locali:
// nei dischi remoti lo studio va cambiato modificando direttamente il file
@ -600,10 +598,14 @@ 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);
f = fopen(prefname(), "w");
if (f != NULL)
{
fprintf(f, "%s\n", pref);
fclose(f);
}
else
message_box("Impossibile scrivere %s", prefname());
}
}

View File

@ -5,6 +5,16 @@
#include "ccustio.h"
#endif
#ifdef __GNUC__
#define __PACKED__ __attribute__ ((packed))
#define __ALIGNED__ __attribute__ ((aligned(2)))
#define __PACK_1__
#else
#define __PACKED__
#define __ALIGNED__
#pragma pack(2)
#endif
#define MaxFilesDir 70
#define MKFields 10
#define MaxFields 100
@ -16,91 +26,60 @@
#define COMDIR 1
/* @(:) 2.3.01.144 */
typedef char FieldName[12] ;
typedef char FieldName[12] ;
typedef struct
{
char SysName[42] __PACKED__ ;
RecNoType EOD __PACKED__ ;
RecNoType EOX __PACKED__ ;
/* @(!) 2.3.01.temp */
#ifdef M_I386
char SysName[42] __PACKED__ ;
RecNoType EOD __PACKED__ ;
RecNoType EOX __PACKED__ ;
unsigned short LenR __PACKED__ ;
#else
/* @(:) 2.3.01.temp */
unsigned int LenR ;
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
RecNoType Flags __PACKED__ ;
char Des[42] __PACKED__ ;
char FCalc[32] __PACKED__ ;
char GenPrompt[32] __PACKED__ ;
} FileDes;
RecNoType Flags __PACKED__ ;
char Des[42] __PACKED__ ;
char FCalc[32] __PACKED__ ;
char GenPrompt[32] __PACKED__ ;
} FileDes;
typedef struct
{
FieldName Name __PACKED__ ;
byte TypeF __PACKED__ ;
byte Len __PACKED__ ;
byte Dec __PACKED__ ;
FieldName Name __PACKED__ ;
byte TypeF __PACKED__ ;
byte Len __PACKED__ ;
byte Dec __PACKED__ ;
#ifdef __PACK_1__
byte junk __PACKED__ ;
byte junk __PACKED__ ;
#endif
/* @(!) 2.3.01.temp */
#ifdef M_I386
unsigned short RecOff __PACKED__ ;
#else
/* @(:) 2.3.01.temp */
unsigned int RecOff ;
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
unsigned short RecOff __PACKED__ ;
} RecFieldDes ;
#if XVT_OS == XVT_OS_WIN || XVT_OS_WIN32
#pragma pack(2)
#endif
typedef struct
{
BOOLEAN DupKeys __ALIGNED__ ;
byte NkFields __ALIGNED__ ;
byte FieldSeq[MKFields] __PACKED__ ;
byte FromCh[MKFields] __PACKED__ ;
byte ToCh[MKFields] __PACKED__ ;
} KeyDes ;
typedef struct
{
BOOLEAN DupKeys __ALIGNED__ ;
byte NkFields __ALIGNED__ ;
byte FieldSeq[MKFields] __PACKED__ ;
byte FromCh[MKFields] __PACKED__ ;
byte ToCh[MKFields] __PACKED__ ;
} KeyDes ;
typedef struct
{
/* @(!) 2.3.01.temp */
#ifdef M_I386
short NFields __PACKED__ ;
#else
/* @(:) 2.3.01.temp */
int NFields ;
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
RecFieldDes Fd[MaxFields] __PACKED__ ;
byte SortFd[MaxFields] __PACKED__ ;
/* @(!) 2.3.01.temp */
#ifdef M_I386
short NKeys __PACKED__ ;
#else
/* @(:) 2.3.01.temp */
int NKeys ;
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
KeyDes Ky[MaxKeys] __PACKED__ ;
short NFields __PACKED__ ;
RecFieldDes Fd[MaxFields] __PACKED__ ;
byte SortFd[MaxFields] __PACKED__ ;
short NKeys __PACKED__ ;
KeyDes Ky[MaxKeys] __PACKED__ ;
} RecDes;
#ifdef __CFILES_C
SecDef rdir[2], fdir[2];
#else
extern SecDef rdir[2], fdir[2];
#endif
#if XVT_OS == XVT_OS_WIN || XVT_OS_WIN32
#pragma pack()
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -120,7 +99,7 @@ extern "C" {
void CPutRec(int, RecDes *, int);
/* @(:) 2.3.01.144 */
void zerordes(RecDes *);
word setrdes(RecDes *);
// word setrdes(RecDes *);
const char* CGetPref(void);
void CPutPref(const char *);
char *CAddPref(char *);
@ -134,4 +113,5 @@ extern "C" {
#ifdef __cplusplus
};
#endif
#endif /* __CFILES_H */

View File

@ -25,7 +25,7 @@
// @doc EXTERNAL
// @msg fatal_box | Crea una finestra di ERRORE FATALE con il relativo messaggio
int fatal_box(
bool fatal_box(
const char* fmt, ...) // @parm Messaggio da stampare nella finestra
// (il formato e' come nella printf del C)
@ -60,7 +60,7 @@ int fatal_box(
// @doc EXTERNAL
// @msg error_box | Crea una finestra di ERRORE con il relativo messaggio
int error_box(
bool error_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -89,7 +89,7 @@ int error_box(
// @doc EXTERNAL
// @msg warning_box | Crea una finestra di ATTENZIONE con il relativo messaggio
int warning_box(
bool warning_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -112,7 +112,7 @@ int warning_box(
// @doc EXTERNAL
// @msg message_box | Crea una finestra di INFORMAZIONE con relativo il messaggio
int message_box(
bool message_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -133,7 +133,7 @@ int message_box(
// @doc EXTERNAL
// @msg sorry_box | Crea una finestra di SCUSE con il relativo messaggio
int sorry_box(
bool sorry_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -154,7 +154,7 @@ int sorry_box(
// @doc EXTERNAL
// @msg yesno_box | Crea una finestra di RICHIESTA con il relativo messaggio
int yesno_box(
bool yesno_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -182,7 +182,7 @@ int yesno_box(
}
int noyes_box(const char* fmt, ...)
bool noyes_box(const char* fmt, ...)
{
buildmsg();
@ -197,7 +197,7 @@ int noyes_box(const char* fmt, ...)
// @msg yesnofatal_box | Crea una finestra di RICHIESTA con il relativo
// messaggio, ma permette di terminare il programma
int yesnofatal_box(
bool yesnofatal_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -268,7 +268,7 @@ int yesnocancel_box(
// @doc EXTERNAL
// @msg __trace | Permette di mandare dei messaggi nel file trace.log
int __trace(
bool __trace(
const char* fmt, // @parm Messaggio da stampare
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
@ -294,7 +294,7 @@ int __trace(
#include <windows.h>
#include <pro_ext.h>
int error_box(const char* fmt, ...)
bool error_box(const char* fmt, ...)
{
buildmsg();
MessageBeep(MB_ICONEXCLAMATION);
@ -302,7 +302,7 @@ int error_box(const char* fmt, ...)
return 0;
}
int fatal_box(const char* fmt, ...)
bool fatal_box(const char* fmt, ...)
{
buildmsg();
MessageBeep(MB_ICONHAND);
@ -311,7 +311,7 @@ int fatal_box(const char* fmt, ...)
return 0;
}
int message_box(const char* fmt, ...)
bool message_box(const char* fmt, ...)
{
buildmsg();
MessageBeep(MB_ICONINFORMATION);
@ -319,7 +319,7 @@ int message_box(const char* fmt, ...)
return 0;
}
int yesnofatal_box(const char* fmt, ...)
bool yesnofatal_box(const char* fmt, ...)
{
buildmsg();
MessageBeep(MB_ICONHAND);

View File

@ -1,19 +1,23 @@
#ifndef __CHECKS_H
#define __CHECKS_H
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
int message_box(const char* fmt, ...);
int warning_box(const char* fmt, ...);
int sorry_box(const char* fmt, ...);
int error_box(const char* fmt, ...);
int fatal_box(const char* fmt, ...);
int yesno_box(const char* fmt, ...);
int noyes_box(const char* fmt, ...);
bool message_box(const char* fmt, ...);
bool warning_box(const char* fmt, ...);
bool sorry_box(const char* fmt, ...);
bool error_box(const char* fmt, ...);
bool fatal_box(const char* fmt, ...);
bool yesno_box(const char* fmt, ...);
bool noyes_box(const char* fmt, ...);
int yesnocancel_box(const char* fmt, ...);
int yesnofatal_box(const char* fmt, ...);
int __trace(const char* fmt, ...);
bool yesnofatal_box(const char* fmt, ...);
bool __trace(const char* fmt, ...);
#ifdef __cplusplus
}
#endif

View File

@ -15,6 +15,12 @@
Per costruire l'aga.fll e' necessario togliere le funzioni progind* e definire S4DLL.
*/
#define XVT_INCL_NATIVE
#include <xvt.h>
#define S4OFF_REPORT
#ifdef CB6
#if XVT_OS == XVT_OS_WIN
#define S4DLL
@ -366,7 +372,6 @@ int DB_go(int handle,long recno)
--------------------------------------------------------------------------*/
int DB_delete(int handle)
{
if(dbdata[handle]==0) return(-1);
d4delete(dbdata[handle]);
return(0);
@ -975,8 +980,8 @@ int DB_recinfo(const char * filename, FileDes *d, RecDes *r, char* keys)
{
strcpy(r->Fd[i].Name,field_info[i].name);
CUpString(r->Fd[i].Name);
r->Fd[i].Len = field_info[i].len;
r->Fd[i].Dec = field_info[i].dec;
r->Fd[i].Len = (unsigned char)field_info[i].len;
r->Fd[i].Dec = (unsigned char)field_info[i].dec;
switch(field_info[i].type)
{
case r4str:
@ -1202,6 +1207,7 @@ int DB_memowrite( const int handle, const char * fieldname, const char * data )
}
#else // CB6
#if XVT_OS == XVT_OS_WIN
#define S4DLL
#define S4WIN16
@ -1220,19 +1226,21 @@ int DB_memowrite( const int handle, const char * fieldname, const char * data )
#endif
#include <d4all.h>
#include <x4filter.h>
#include <i4chang.h>
#include <codeb.h>
#include <rectypes.h>
#include <progind.h>
#include <checks.h>
#define MAXLEN 137 /* Lunghezza massima chiave */
extern char* CUpString(char *);
static CODE4 code_base;
static DATA4 *dbdata[CB4FILES];
static X4FILTER xdb[CB4FILES];
// #include <x4filter.h>
// static X4FILTER xdb[CB4FILES];
static char * find_slash_backslash(char * str)
@ -1318,11 +1326,11 @@ int DB_open(const char *filename,int mode, int index)
if (index == 0) /* Restore the configuration of opening indexes*/
code_base.auto_open = 1;
if(dbdata[found]==0) return(-1);
x4init(&xdb[found],dbdata[found],notdelete,dbdata[found]);
// d4init(&codebase);
code_base.exclusive=0;
d4tag_select(dbdata[found],d4tag_default(dbdata[found]));
if (d4reccount(dbdata[found]) > 0)
x4top(&xdb[found]);
d4top(dbdata[found]);
return(found);
}
@ -1442,7 +1450,7 @@ int DB_tagget(int handle)
int DB_first(int handle)
{
if(dbdata[handle]==0) return(-1);
return(x4top(&xdb[handle]));
return(d4top(dbdata[handle]));
}
@ -1453,7 +1461,7 @@ int DB_first(int handle)
int DB_last(int handle)
{
if(dbdata[handle]==0) return(-1);
return(x4bottom(&xdb[handle]));
return(d4bottom(dbdata[handle]));
}
@ -1463,7 +1471,7 @@ int DB_last(int handle)
int DB_next(int handle)
{
if(dbdata[handle]==0) return(-1);
return(x4skip(&xdb[handle],1L));
return(d4skip(dbdata[handle],1L));
}
/*-------------------------------------------------------------------------
@ -1472,7 +1480,7 @@ int DB_next(int handle)
int DB_prev(int handle)
{
if(dbdata[handle]==0) return(-1);
return(x4skip(&xdb[handle],-1L));
return(d4skip(dbdata[handle],-1L));
}
@ -1482,7 +1490,7 @@ int DB_prev(int handle)
int DB_skip(int handle,long int recno)
{
if(dbdata[handle]==0) return(-1);
return(x4skip(&xdb[handle],recno));
return(d4skip(dbdata[handle],recno));
}
/*-------------------------------------------------------------------------
@ -1514,7 +1522,7 @@ int DB_seek(int handle,char *key)
char * k;
if(dbdata[handle]==0) return(-1);
rc = x4seek(&xdb[handle],key);
rc = d4seek(dbdata[handle],key);
if (rc)
return rc;
tt = d4tag_selected(dbdata[handle]);
@ -2007,7 +2015,7 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis)
if (!strncmp(s, s0, l))
{
x4go(&xdb[handle],t4recno(t));
d4go(dbdata[handle],t4recno(t));
d4delete(dbdata[handle]);
t4seek(t, s0, lt);
}

View File

@ -1,7 +1,11 @@
#ifndef __COLORS_H
#define __COLORS_H
#ifndef XVT_INCL
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifndef XVT_INCL_XVT
#include <xvt.h>
#endif
@ -21,8 +25,8 @@ extern COLOR DISABLED_COLOR;
extern COLOR DISABLED_BACK_COLOR;
extern COLOR FOCUS_COLOR;
extern COLOR FOCUS_BACK_COLOR;
extern BOOLEAN CAMPI_SCAVATI;
extern BOOLEAN AUTOSELECT;
extern bool CAMPI_SCAVATI;
extern bool AUTOSELECT;
const COLOR COLOR_DKCYAN = MAKE_COLOR(0,128,128);
const COLOR COLOR_DKYELLOW = MAKE_COLOR(128,128, 0);

View File

@ -32,7 +32,7 @@ bool TConfig::_read_paragraph()
for (;;)
{
const TString& l = scan.line();
if (l == "" || l[0] == '[') break; // Fine paragrafo
if (l.empty() || l[0] == '[') break; // Fine paragrafo
if (l[0] == '#' || l[0] == '/') continue; // Riga di commento
const int ind = l.find('=');
@ -549,7 +549,7 @@ void TConfig::init(
_dirty = FALSE;
_write_protected = FALSE;
if (!fexist(_file))
if (!_file.exist())
{
if (warning)
warning_box("Creazione del file di configurazione %s", fn );
@ -559,8 +559,7 @@ void TConfig::init(
if (_paragraph.blank())
{
TFilename name = main_app().argv(0);
_paragraph = name.name();
_paragraph = main_app().name();
_paragraph.cut(2);
_paragraph.lower();
}

View File

@ -23,8 +23,8 @@ COLOR DISABLED_COLOR = COLOR_GRAY;
COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
COLOR FOCUS_COLOR = NORMAL_COLOR;
COLOR FOCUS_BACK_COLOR = COLOR_CYAN;
BOOLEAN CAMPI_SCAVATI = FALSE;
BOOLEAN AUTOSELECT = FALSE;
bool CAMPI_SCAVATI = FALSE;
bool AUTOSELECT = FALSE;
#ifndef STX_DATA
// Very deep hacking
@ -200,8 +200,8 @@ XVT_FNTID xvt_load_default_font()
}
X_FU_MULTIPLE = Y_FU_MULTIPLE = 0;
XVT_FNTID font = xvt_default_font(FALSE);
statbar_set_fontid(TASK_WIN, font);
return font;
@ -508,7 +508,8 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
switch (event_map[xiev->type])
{
case a_obj:
ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj);
if (xiev->v.xi_obj)
ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj);
break;
case a_child:
ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj->parent);
@ -1064,8 +1065,12 @@ void TText_control::set_caption(const char* text)
if (bold && f == NULL)
XinFontCopy(&f, xi_get_system_font());
if (f != NULL && XinFontBoldGet(f) != bold)
XinFontBoldSet(f, bold);
if (f != NULL)
{
bool is_bold_font = XinFontBoldGet(f) != 0;
if (is_bold_font != bold)
XinFontBoldSet(f, bold);
}
#else
FONT_OBJ* &font = _obj->v.text->font;
@ -1212,7 +1217,8 @@ void TField_control::create(WINDOW win, short cid,
void TField_control::show_button(bool on)
{
XI_FIELD_DATA* f = _obj->v.field;
if (f->button != on)
bool has_button = f->button != 0;
if (has_button != on)
{
f->button = on;
xi_invalidate_rect(parent(), &f->btn_rct);
@ -1307,7 +1313,16 @@ void TButton_control::create(WINDOW win, short cid,
{
bool bold;
COLOR color;
TString txt(text); txt.strip("&~");
TString txt(text);
char mnemonic = '\0';
int underscore = txt.find('~');
if (underscore < 0)
underscore = txt.find('&');
if (underscore >= 0)
mnemonic = txt[underscore+1];
txt.strip("&~");
const char* t = parse_caption(txt, bold, color);
if (width <= 0) width = strlen(t)+3;
@ -1324,8 +1339,18 @@ void TButton_control::create(WINDOW win, short cid,
case WC_CHECKBOX : def->v.btn->type = XIBT_CHECKBOX; break;
case WC_RADIOBUTTON: def->v.btn->type = XIBT_RADIOBTN; break;
default : def->v.btn->type = XIBT_TABBTN; break;
}
}
if (mnemonic)
{
int mnemonic_instance = 1;
for (int c = underscore-1; c >= 0; c--)
if (t[c] == mnemonic)
mnemonic_instance++;
def->v.btn->mnemonic = mnemonic;
def->v.btn->mnemonic_instance = mnemonic_instance;
}
if (container == NULL)
container = get_interface(win);
_obj = xi_create(container, def);
@ -1426,21 +1451,7 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
: _bmp_up(bmp_up), _bmp_dn(bmp_dn), _native_hicon(0)
{
bool bold;
COLOR color;
_caption = parse_caption(text, bold, color);
_underscore = _caption.find('~');
if (_underscore < 0)
_underscore = _caption.find('&');
if (_underscore >= 0)
_caption.strip("~&");
create(win, cid, left, top, width, height, flags, text, WC_PUSHBUTTON, NULL);
_obj->v.btn->drawable = TRUE;
*_obj->v.btn->text = '\0';
set_bmp(bmp_up, bmp_dn);
}
@ -1450,20 +1461,23 @@ TPushbutton_control::~TPushbutton_control()
os_destroy_native_icon(_native_hicon);
}
const char* TPushbutton_control::caption() const
char TPushbutton_control::mnemonic() const
{
return _caption;
return _obj->v.btn->mnemonic;
}
void TPushbutton_control::set_caption(const char* c)
{
bool bold;
COLOR color;
_caption = parse_caption(c, bold, color);
if (_caption.not_empty())
{
const char* cap = parse_caption(c, bold, color);
if (*cap)
{
TControl::set_caption(cap);
set_native_icon(0);
set_bmp(0, 0);
_obj->v.btn->drawable = FALSE;
_obj->v.btn->fore_color = color;
}
}
@ -1478,6 +1492,7 @@ void TPushbutton_control::set_native_icon(unsigned hicon)
{
_native_hicon = hicon;
set_bmp(0, 0);
_obj->v.btn->drawable = TRUE;
}
}
@ -1491,6 +1506,7 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
else
_bmp_dn = _bmp_up;
set_native_icon(0);
_obj->v.btn->drawable = TRUE;
}
else
{
@ -1558,40 +1574,6 @@ void TPushbutton_control::update()
}
}
}
else
{
RCT& r = (RCT &) _obj->v.btn->rct;
xvt_dwin_set_font(win, xvt_default_font());
int ascent, descent;
xvt_dwin_get_font_metrics(win, NULL, &ascent, &descent);
const int w = xvt_dwin_get_text_width(win, (char*)(const char*)_caption, -1);
int x = r.left + (r.right - r.left - w) / 2;
int y = r.top + (r.bottom - r.top + ascent - (descent+1)) / 2;
if (_obj->v.btn->down)
{
x += 2;
y += 2;
}
DRAW_CTOOLS ct;
xvt_dwin_get_draw_ctools(win, &ct);
ct.opaque_text = FALSE;
ct.fore_color = (attrib & XI_ATR_ENABLED) ? _obj->v.btn->fore_color : DISABLED_COLOR;
xvt_dwin_set_draw_ctools(win, &ct);
xvt_dwin_draw_text(win, x, y, (char*)(const char*)_caption, -1);
if (_underscore >= 0)
{
const char old = _caption[_underscore];
_caption[_underscore] = '_';
xvt_dwin_draw_text(win, x, y, (char*)(const char*)_caption, _underscore+1);
_caption[_underscore] = old;
}
}
}
}
@ -1951,7 +1933,7 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
else
{
if (k >= ' ' && k <= 'z')
ddl->select_by_initial(k);
ddl->select_by_initial(char(k));
}
}
break;
@ -2195,7 +2177,7 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
{
const KEY k = xiev_to_key(xiev);
if (k >= ' ' && k <= 'z')
_ddl->select_by_initial(k);
_ddl->select_by_initial(char(k));
else if (k == K_F9)
_ddl->open();
else if (k == K_RIGHT) // poor man's substitute for down arrow

View File

@ -208,8 +208,6 @@ public:
class TPushbutton_control : public TButton_control
{
TString _caption;
int _underscore;
short _bmp_up, _bmp_dn;
unsigned _native_hicon;
@ -219,13 +217,12 @@ protected:
public:
virtual void update();
// @cmember Ritorna il prompt del bottone
virtual const char* caption() const;
// @cmember Setta il prompt del bottone
virtual void set_caption(const char* c);
void set_bmp(short up, short dn);
void set_native_icon(unsigned hicon);
char mnemonic() const;
TPushbutton_control(WINDOW win, short cid,
short left, short top, short width, short height,

View File

@ -1,10 +1,5 @@
#include "csort.h"
#ifdef __WATCOMC__
#include <malloc.h>
#include <io.h>
#else
#include <memory.h>
#endif
#include <checks.h>
#include <csort.h>
/*----------------------- STATIC PER PRIMA PARTE ----------------------------*/
@ -386,21 +381,14 @@ static FILE *wopen(name)
sprintf(s, "srt%02d", ++n);
/* @(:) 2.3.00.316 */
TMPFNAME(name,s);
#ifdef DOS
if ((fp = fopen(name, "wb+")) == NULL) {
#else
if ((fp = fopen(name, "w+")) == NULL) {
#endif
#ifndef XVT_OS
printf("\nFile error");
exit(1);
#else
fatal_box("Can't open SORT file");
#endif
}
return fp;
fp = fopen(name, "wb+");
if (fp == NULL)
{
fatal_box("Can't open SORT file");
}
return fp;
}
/*
@(#) sort_op SORT
@ -542,18 +530,6 @@ static FILE *wopen(name)
void sort_stats()
{
#ifndef XVT_OS
printf("\n\r\n\r\n\rRecord Length = %d",sp->rc_len);
/* @(!) 2.3.00.112 */
printf("\n\r%u records sorted",totrcd);
printf("\n\r%u sequence",no_seq);
/* @(:) 2.3.00.112 */
if (no_seq1 != 1) putchar('s');
printf("\n\r%u characters of sort buffer", bspace);
/* @(!) 2.3.00.112 */
printf("\n\r%u records per buffer\n\n",nrcds);
/* @(:) 2.3.00.112 */
#else
message_box(
"Record length = %d\n"
"%u records sorted\n"
@ -562,7 +538,6 @@ static FILE *wopen(name)
"%u records per buffer",
sp->rc_len, totrcd, no_seq, bspace, nrcds
);
#endif
}
/*

View File

@ -2,7 +2,7 @@
#define __CSORT_H
#ifndef __CFILES_H
#include "cfiles.h"
#include "cfiles.h"
#endif
#define NOFLDS 10

View File

@ -10,7 +10,7 @@
// @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
bool utente, // @parm Permette di inserire il nome dell'utente nella riga di comando
byte 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

View File

@ -34,7 +34,7 @@ class TExternal_app : public TObject
// @access Public Member
public:
// @cmember Esegue il processo
word run(bool async = FALSE, bool user = TRUE, bool iconize = TRUE, bool show = TRUE);
word run(bool async = FALSE, byte user = TRUE, bool iconize = TRUE, bool show = TRUE);
// @cmember Ritorna il codice dell'ultimo errore
int error()
{ return _error; }

View File

@ -16,18 +16,6 @@
#define MAXDISPCOLS 4
#define CONFFILE "conf.gen"
/*
#if XVT_OS == XVT_OS_SCOUNIX
#include "keye.h"
#define HLBLOCK 2
#else
#include "hlapi_c.h"
#define HLBLOCK 1
#define REFKEY "CAMPOKEY"
#define VERKEY "ìpÙˆ¬cê<"
#endif
*/
/* @DES Funzioni C esterne. Sorgenti in /disk1/p.uno */
extern "C" {
@ -39,32 +27,20 @@ extern "C" {
extern int SerNo;
extern word ModAd;
extern word _int_tab0[4];
extern char __ptprf[80];
extern PathSt __ptprf;
// Guy moved these outside extern
extern isfdptr* openf;
extern Str80 cprefix;
#ifdef __STDTYPES_CPP
#define extern
#endif
extern short isjournal;
#ifdef __STDTYPES_CPP
#undef extern
#endif
/* @END */
/* @FPUB */
// definite in isam.cpp
int hashfun(const char *);
int findfld(const RecDes *, const char *);
#if XVT_OS == XVT_OS_SCOUNIX
Word Hl_Port(Word);
#endif
TDitta *CGetDitta(char *);
// TDitta *CGetDitta(char *);
short CGetAut(int );
char *CGetConf(int );
word getser(void);

View File

@ -18,7 +18,7 @@
#else
#define __PACKED__
#define __ALIGNED__
#pragma pack(2)
#endif
/* @DES Tipi e macro da programmi C */
@ -51,6 +51,8 @@ typedef char FieldName[12] ;
typedef char TKey[MaxArray + 2];
typedef char AreaKey[AreaLen];
typedef char DataArea[BPageLen];
/*
typedef struct {
char nome[52] __PACKED__ ;
char indirizzo[32] __PACKED__ ;
@ -68,6 +70,7 @@ typedef struct {
char partiva1[12] __PACKED__ ;
char codfisc1[18] __PACKED__ ;
} TDitta;
*/
typedef struct {
int F;
@ -183,6 +186,8 @@ typedef union
DataArea BuffIO __PACKED__ ;
} Page;
#pragma pack()
typedef struct
{
SecDef Fil;

View File

@ -329,7 +329,7 @@ void TDir::read_from (istream & in)
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
_num = atoi(_files_tmp_string);
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
_com = (bool) atoi(_files_tmp_string);
_com = atoi(_files_tmp_string) != 0;
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
TToken_string line(_files_tmp_string,'|');
line.restart();

View File

@ -5364,7 +5364,7 @@ void TForm::match_result(int file,int val)
info.match_number=((TForm_skip_info &)_skip_info[file]).match_number;
if (val)
info.match_number++;
info.match_result=val;
info.match_result= val != 0;
_skip_info.add(info,file);
}
}

View File

@ -292,7 +292,7 @@ public:
virtual const char* section_mask()
{ return "ba2100s"; }
// @cmember Ritorna i permessi di Edit (<md TForm::_editlevel> assume solo i valori 0 e non 0)
bool edit_level() const
int edit_level() const
{ return _editlevel; }
// @cmember Setta i permessi di edit
void set_edit_level(int n)

View File

@ -665,6 +665,7 @@ TGolem_field::~TGolem_field()
#ifdef _WIN32
const char* const szMAPIDLL = "MAPI32.DLL";
const int MAPI_USE_DEFAULT = 0;
#else
const char* const szMAPIDLL = "MAPI.DLL";
#endif
@ -988,7 +989,7 @@ bool TDDE::execute(const char* cmd) const
char* c = (char*)GlobalLock(hg);
strcpy(c, cmd);
GlobalUnlock(hg);
return PostMessage((HWND)_server, WM_DDE_EXECUTE, (WPARAM)_hwnd, MAKELPARAM(0, hg));
return PostMessage((HWND)_server, WM_DDE_EXECUTE, (WPARAM)_hwnd, MAKELPARAM(0, hg)) != 0;
}
bool TDDE::execute(const char* app, const char* topic, const char* cmd, const char* filename)

View File

@ -1515,7 +1515,7 @@ int TBaseisamfile::is_valid()
// @rdesc Ritorna l'oggetto <c TLocalisamfile>
TLocalisamfile::TLocalisamfile(
int logicnum, // @parm Numero del logico del file
bool linkrecinst) // @parm Puo assumere i valori:
byte linkrecinst) // @parm Puo assumere i valori:
//
// @flag 0 | Istanzio un nuovo file fisico (default)
// @flag 1 | Utilizza, se possibile, un file gia' esistente
@ -1719,19 +1719,17 @@ TIsamtempfile::TIsamtempfile(int logicnum, const char* radix, bool create, bool
TDir dir; dir.get(logicnum);
const word& len = dir.len();
FILE* f = fopen(n, "r");
TString err;
err.format("Can't open temporary file %s: %s",(const char*) n,(const char*)_strerror(NULL));
CHECK(f, (const char *) err );
FILE* f = fopen(n, "rb");
if (f == NULL)
fatal_box("Impossibile aprire il file temporaneo %s: %s",(const char*) n,(const char*)_strerror(NULL));
fseek(f, 0, SEEK_END);
eod = eox = ftell(f) / len;
fclose(f);
}
CHECK(create <=TRUE,"Il flag di autodel ora si setta con il terzo parametro del costruttore");
_autodel = autodel || create > TRUE;
CHECK(create == FALSE || create == TRUE, "Il flag di autodel ora si setta con il terzo parametro del costruttore");
_autodel = autodel || (create != FALSE && create != TRUE);
n.insert("%", 0);

View File

@ -673,7 +673,7 @@ public:
// @cmember Costruttore. <p Linkrecinst> dice se il file deve utilizzare un area record
// separata oppure la stessa.
TLocalisamfile(int logicnum, bool linkrecinst = FALSE);
TLocalisamfile(int logicnum, byte linkrecinst = FALSE);
// @cmember Distruttore
virtual ~TLocalisamfile();
};

View File

@ -43,7 +43,7 @@ bool rpc_Stop()
bool rpc_Call(const char* cmd)
{
CHECK(_connection, "Server not connected");
bool ok = _client->Execute(_connection, cmd);
bool ok = _client->Execute(_connection, cmd) != 0;
return ok;
}
@ -57,14 +57,14 @@ char* rpc_Request(const char* cmd, DWORD& size, real& total)
return buff;
}
static TString256 _rpc_call;
static TString _rpc_call(256);
static TString _rpc_string;
inline bool BoolCall()
{
CHECK(_connection, "Server not connected");
BOOL yes;
bool ok = _client->RequestBool(_connection, _rpc_call, yes);
bool ok = _client->RequestBool(_connection, _rpc_call, yes) != 0;
if (!ok)
{
#ifndef DBG
@ -79,7 +79,7 @@ inline long IntCall()
{
CHECK(_connection, "Server not connected");
long n;
bool ok = _client->RequestInteger(_connection, _rpc_call, n);
bool ok = _client->RequestInteger(_connection, _rpc_call, n) != 0;
if (!ok)
{
#ifndef DBG
@ -93,7 +93,7 @@ inline long IntCall()
inline TString& StrCall()
{
CHECK(_connection, "Server not connected");
bool ok = _client->RequestString(_connection, _rpc_call, _rpc_string);
bool ok = _client->RequestString(_connection, _rpc_call, _rpc_string) != 0;
if (!ok)
{
#ifndef DBG
@ -244,7 +244,7 @@ bool rpc_UserLogin(const char* server, const char* user,
_rpc_call.format("UserLogin(%s,%s,%s)", user, password, application);
BOOL logged = FALSE;
bool connected = _client->RequestBool(_connection, _rpc_call, logged);
bool connected = _client->RequestBool(_connection, _rpc_call, logged) != 0;
if (connected)
{
if (!logged)

View File

@ -14,8 +14,8 @@ char* rpc_Request(const char* cmd, unsigned long& size, real& time);
bool rpc_DongleHasModule(word af);
bool rpc_DongleModules(TBit_array& ba);
word rpc_DongleNumber();
word rpc_DongleYear();
unsigned rpc_DongleNumber();
unsigned rpc_DongleYear();
bool rpc_UserLogin(const char* server, const char* user,
const char* password, const char* application);

View File

@ -1,117 +0,0 @@
/* @(!) 2.3.01.178 */
/*
#ifdef DOS
#include "hlapi_c.h"
#define HLBLOCK 1
/* @(!) 2.3.01.178 */
#define REFKEY "CAMPOKEY"
#define VERKEY "ìpÙˆ¬cê<"
/* @(:) 2.3.01.178 */
#else
#include "keye.h"
#define HLBLOCK 2
#endif
*/
/* @(:) 2.3.01.178 */
#define MAXCKEY 5
#define MAXCLEN 10
#define MAXENTRYNAME 16
#define MAXTENTRY 48
/* @(!) 2.3.01.temp */
#define MAXENTRYSIZE 4096
/* @(:) 2.3.01.temp */
#define MAXDISPCOLS 4
#define CONFFILE "conf.gen"
/*
@(H) 2.3.00.10 24/09/91 Bonazzi Dichiarato numero di versione globale
@(H) 2.3.01.69 15/05/92 Bonazzi Modificato algoritmo di refresh delle finestre
@(H) 2.3.01.130 08/10/92 Bonazzi Corretto algoritmo lettura caratteri per >128
*/
#ifndef DOS
struct capentry {
/* @(!) 2.3.01.130 */
uchar key[MAXCKEY];
uchar str[MAXCLEN];
/* @(:) 2.3.01.130 */
char charcode;
};
#endif
struct keybar {
word id;
uchar key;
char *explic;
struct keybar *next;
struct keybar *prev;
/* @(!) 2.3.01.223 */
BOOLEAN nosusp;
/* @(:) 2.3.01.223 */
};
extern char _int_res[513];
extern uchar _int_s1[256];
/* @(!) 2.3.01.temp */
#ifdef M_I386
extern short _int_cnt[8];
#else
/* @(:) 2.3.01.temp */
extern int _int_cnt[8];
/* @(!) 2.3.01.temp */
#endif
/* @(:) 2.3.01.temp */
#ifndef XVT_OS
#ifndef FOXPRO
extern chtype boxstr[MAXBORDERS][6];
extern int termlines;
extern int nwin;
extern int worder[MAXWIN];
#endif
#endif
extern BOOLEAN insstate;
extern BOOLEAN retins;
extern Word ModAd;
extern Word Port;
extern Word SerNo;
extern char *modname[];
#ifndef XVT_OS
extern int dispcol[MAXDISPCOLS][2];
#endif
extern char *keybarstr;
/* @(!) 2.3.00.10 */
extern char vers[];
/* @(H) 2.3.00.10 */
/* @(!) 2.3.01.69 */
#ifndef XVT_OS
extern BOOLEAN border;
#endif
/* @(:) 2.3.01.69 */
/* @(!) 2.3.01.150 */
extern BOOLEAN flprassi;
/* @(:) 2.3.01.150 */
/* @(!) 2.3.01.158 */
extern BOOLEAN flaltmodins;
/* @(:) 2.3.01.158 */
/* @(!) 2.3.01.176 */
extern BOOLEAN demoflag;
extern BOOLEAN formflag;
/* @(:) 2.3.01.176 */
/* @(!) 2.3.01.325 aggiunto pre-prefisso */
extern Str80 __ptprf;
/* @(:) 2.3.01.325 */
int setblock(int, BOOLEAN);
/* @(!) 2.3.01.130 */
char *custgetcap(uchar *, uchar *, int);
void readkeysdef (uchar *, struct capentry *);
int gettdef ( char *, uchar *);
/* @(:) 2.3.01.130 */
void initctab(struct capentry *);
void createaut (struct capentry *);
// Word Hl_Port(Word);
// Word getser(void);

View File

@ -781,7 +781,7 @@ bool TMask::on_key(
const int page = key - K_F1;
if (page < _pages && fld(_focus).on_key(K_TAB))
show_page(page);
}
}
else
{
for (int i = fields()-1; i >= 0; i--)
@ -1148,15 +1148,15 @@ void TMask::enable_default(short fld_id)
}
byte TMask::num_keys() const
word TMask::num_keys() const
{
word max = 0;
for (int i = fields()-1; i >= 0; i--)
{
TMask_field& f = fld(i);
const TMask_field& f = fld(i);
if (f.is_editable())
{
word k = ((TEditable_field&)f).last_key();
word k = ((const TEditable_field&)f).last_key();
if (k > max) max = k;
}
}
@ -1167,7 +1167,7 @@ byte TMask::num_keys() const
// @mfunc Abilita/disabilita i campi di una chiave sulla maschera
void TMask::enable_key(
byte key, // @parm Chiave di cui abilitare il campo
word key, // @parm Chiave di cui abilitare il campo
bool on) // @parm Indica l'operazione da svolgere sul tasto:
//
// @flag TRUE | Abilita il campo (default)
@ -1197,7 +1197,7 @@ void TMask::enable_key(
//
// @rdesc Ritorna l'identificatore del campo cercato
TEditable_field* TMask::get_key_field(
byte key, // @parm Chiave di cui controllare l'esistenza
word key, // @parm Chiave di cui controllare l'esistenza
bool first) const // @parm Indica se la ricerca dev partire dell'inizio. Assume i valori:
//
// @flag TRUE | Comincia la ricerca dal primo campo della maschera
@ -1221,7 +1221,7 @@ TEditable_field* TMask::get_key_field(
return NULL;
}
bool TMask::key_valid(int key) const
bool TMask::key_valid(word key) const
{
const int max = fields();
for (short f = 0; f < max; f++)

View File

@ -321,17 +321,17 @@ public:
bool page_enabled(byte p) const;
// @cmember Ritorna il numero di chiavi utilizzate nei campi della maschera
byte num_keys() const;
word num_keys() const;
// @cmember Abilita/disabilita i campi di una chiave sulla maschera
void enable_key(byte key, bool on = TRUE);
void enable_key(word key, bool on = TRUE);
// @cmember Disabilita i campi di una chiave sulla maschera (chiama <mf TMask::enable_key>)
void disable_key(byte key)
void disable_key(word key)
{ enable_key(key, FALSE); }
// @cmember Ritorna il l'identificatore di un campo della chiave <p key>
TEditable_field* get_key_field(byte key, bool first) const;
TEditable_field* get_key_field(word key, bool first) const;
// @cmember Controlla se la chiave <p key> ha un valore significativo
// (TRUE se il valore e' valido)
bool key_valid(int key) const;
bool key_valid(word key) const;
// @cmember Permette di mostrare/nascondere un campo (chiama <mf TMask_field::show>)
virtual void show(short fld_id = -1, bool on = TRUE);

View File

@ -403,7 +403,7 @@ bool TMask_field::active() const
}
void TMask_field::set_dirty(bool d)
void TMask_field::set_dirty(byte d)
{
if (_flags.dirty == 3)
{
@ -415,7 +415,7 @@ void TMask_field::set_dirty(bool d)
_flags.dirty = d; // Riga per breakpoint
#endif
_flags.dirty = d;
set_focusdirty(d);
set_focusdirty(d != 0);
}
// Certified 100%
@ -1007,7 +1007,6 @@ void TButton_field::create(WINDOW parent)
case DLG_OK:
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Conferma")
_ctl_data._prompt = "~Conferma";
_virtual_key = 'C';
_exit_key = K_ENTER;
if (_ctl_data._bmp_up == 0 && _ctl_data._prompt == "~Conferma")
_ctl_data._bmp_up = BMP_OK;
@ -1022,7 +1021,6 @@ void TButton_field::create(WINDOW parent)
case DLG_DELREC:
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Elimina")
_ctl_data._prompt = "~Elimina";
_virtual_key = 'E';
_exit_key = K_DEL;
if (_ctl_data._bmp_up == 0 && _ctl_data._prompt == "~Elimina")
{
@ -1033,7 +1031,6 @@ void TButton_field::create(WINDOW parent)
case DLG_PRINT:
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Stampa")
_ctl_data._prompt = "~Stampa";
_virtual_key = 'S';
_exit_key = K_ENTER;
if (_ctl_data._bmp_up <= 0 && _ctl_data._prompt == "~Stampa")
_ctl_data._bmp_up = BMP_PRINT;
@ -1068,17 +1065,17 @@ void TButton_field::create(WINDOW parent)
else
if (msg.get_int() == 0) _exit_key = atoi(m);
}
if (_virtual_key == 0)
{
const int n = _ctl_data._prompt.find('~');
_virtual_key = (n >= 0) ? toupper(_ctl_data._prompt[n+1]) : _exit_key;
}
_ctl = new TPushbutton_control(parent, _ctl_data._dlg,
_ctl_data._x, _ctl_data._y,
_ctl_data._width+2, _ctl_data._height,
_ctl_data._flags, _ctl_data._prompt,
_ctl_data._bmp_up, _ctl_data._bmp_dn);
if (_virtual_key == 0)
{
char acc = ((TPushbutton_control*)_ctl)->mnemonic();
_virtual_key = (acc > ' ') ? toupper(acc) : _exit_key;
}
}
bool TButton_field::on_key(KEY key)
@ -1450,6 +1447,8 @@ TBoolean_field::TBoolean_field(TMask* m)
word TBoolean_field::class_id() const
{ return CLASS_BOOLEAN_FIELD; }
bool TBoolean_field::is_kind_of(word cid) const
{ return cid == CLASS_BOOLEAN_FIELD || TEditable_field::is_kind_of(cid); }
void TBoolean_field::create(WINDOW parent)
{

View File

@ -98,7 +98,7 @@ protected:
{
bool automagic : 1;
bool button : 1;
bool dirty : 2; // Modified during run ?
byte dirty : 2; // Modified during run ?
bool enabled : 1; // Is editable
bool enable_default : 1;
bool firm : 1; // Is the current firm ?
@ -160,7 +160,7 @@ public:
virtual bool ok() const;
// @cmember Ritorna TRUE se il campo e' stato modificato
bool dirty() const
byte dirty() const
{ return _flags.dirty; }
// @cmember Ritorna TRUE se il campo e' stato modificato dall'ultima volta che ha ricevuto il focus
bool focusdirty() const
@ -169,7 +169,7 @@ public:
void set_focusdirty(bool d = TRUE)
{ _flags.focusdirty = d; }
// @cmember Setta lo stato di dirty del campo
void set_dirty(bool d = TRUE);
void set_dirty(byte d = TRUE);
// @cmember Abilita il trim degli spazi
void set_trim(bool t)
@ -221,7 +221,7 @@ public:
{ return _flags.exchange; }
// @cmember Controlla se il campo appartiene ad una chiave di ricerca
virtual bool in_key(byte) const
virtual bool in_key(word) const
{ return FALSE; }
// @cmember Controlla se il campo ha un check
virtual bool has_check() const
@ -604,7 +604,7 @@ public: // TMask_field
public:
bool test_key_complete(bool normal = TRUE) const;
// @cmember Controlla se il campo appartiene alla chiave <p key> (TRUE se appartiene)
bool in_key(byte key) const
bool in_key(word key) const
{ return _keys ? (*_keys)[key] : FALSE; }
// @cmember Setta il campo alla chiave <p key>
void set_key(byte key);
@ -672,6 +672,7 @@ class TBoolean_field : public TEditable_field
protected: // TMask_field
// @cmember Ritorna l'identificatore della classe
virtual word class_id() const;
virtual bool is_kind_of(word cid) const;
// @cmember Crea il controllo
virtual void create(WINDOW parent);

View File

@ -1,6 +1,8 @@
#ifndef __MSHELL_H
#define __MSHELL_H
#error Obsolete include
#ifdef XVT_OS
#ifdef __cplusplus

View File

@ -13,7 +13,6 @@ extern "C"
#include <recarray.h>
#include <relation.h>
#include <urldefid.h>
#include <utility.h>
///////////////////////////////////////////////////////////
// TSpreadsheet
@ -86,7 +85,7 @@ class TSpreadsheet : public TControl
// @cmember:(INTERNAL) Dimensioni delle colonne
int _default_width[MAX_COL];
// @cmember:(INTERNAL) Bisogna salvare l'ordien delle colonne
bool _save_columns_order;
byte _save_columns_order;
// @cmember:(INTERNAL) Inizializza lo spreadsheet
void init();
@ -251,10 +250,10 @@ public:
void post_select(int r);
// @cmember Controlla se e' stato modificato una cella dello spreadsheet
bool dirty() const
byte dirty() const
{ return owner().dirty(); }
// @cmember Permette di indicare se e' stata modificata una cella dello spreadsheet
void set_dirty(bool spork = TRUE)
void set_dirty(byte spork = TRUE)
{ owner().set_dirty(spork); }
// @cmember Ritorna il valore della variabile active
@ -407,7 +406,7 @@ TSpreadsheet::TSpreadsheet(
// Definizione della prima colonna (numero di riga)
word attr = XI_ATR_RJUST;
if (sheet_mask().id2pos(FIRST_FIELD -1) != -1)
if (sheet_mask().id2pos(FIRST_FIELD-1) >= 0)
attr |= XI_ATR_SELECTABLE;
XI_OBJ_DEF* coldef = xi_add_column_def(listdef, 0, attr, 0,
@ -450,11 +449,16 @@ TSpreadsheet::TSpreadsheet(
case CLASS_REAL_FIELD:
flags |= XI_ATR_RJUST;
break;
case CLASS_BOOLEAN_FIELD:
flags |= XI_ATR_SELECTABLE;
break;
default:
break;
}
if (f.active()) flags |= XI_ATR_ENABLED;
else _column_disabled.set(i);
if (f.active())
flags |= XI_ATR_ENABLED;
else
_column_disabled.set(i);
coldef = xi_add_column_def(listdef, cid, flags, cid,
v_width[i] * XI_FU_MULTIPLE, m_width[i],
@ -463,6 +467,8 @@ TSpreadsheet::TSpreadsheet(
coldef->app_data = (long)this;
coldef->v.column->heading_platform = TRUE;
coldef->v.column->center_heading = TRUE;
if (flags & XI_ATR_SELECTABLE)
coldef->v.column->icon_mode = XIM_ICON_HAS_PRIORITY;
}
// Create the whole thing!
@ -886,8 +892,6 @@ bool TSpreadsheet::test_focus_change()
// Certified 75%
bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{
// static KEY _lastab = K_TAB;
BOOLEAN& refused = xiev->refused;
switch (xiev->type)
@ -946,6 +950,12 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
else
src = e->raw2win(src); // Get formatted string
}
if ((*src == '\0' || (*src == 'X' && src[1] == '\0')) &&
e->is_kind_of(CLASS_BOOLEAN_FIELD))
{
xiev->v.cell_request.icon_rid = *src > 0 ? ICO_CHECK_ON : ICO_CHECK_OFF;
}
if (cell_disabled(rec, col))
{
@ -1050,24 +1060,43 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
on_idle(); // Forces update delayed by str2mask
}
const int button_pos = sheet_mask().id2pos(FIRST_FIELD-1);
if (button_pos >= 0)
{
TMask & sm = owner().sheet_mask();
TMask_field& button = sm.fld(button_pos);
if (button.active())
if (xiev->v.select.column > 0)
{
str2mask(_cur_rec);
TOperable_field* f = col2field(xiev->v.select.column);
if (f && f->active())
{
str2mask(_cur_rec);
button.on_hit();
if (sm.dirty())
{
notify_change();
mask2str(_cur_rec);
}
notify_change();
if (f->get().empty())
f->set("X");
else
f->set("");
f->on_key(K_SPACE);
mask2str(_cur_rec);
on_idle();
}
}
_check_enabled = TRUE;
owner().highlight();
else
{
const int button_pos = sheet_mask().id2pos(FIRST_FIELD-1);
if (button_pos >= 0)
{
TMask & sm = owner().sheet_mask();
TMask_field& button = sm.fld(button_pos);
if (button.active())
{
str2mask(_cur_rec);
button.on_hit();
if (sm.dirty())
{
notify_change();
mask2str(_cur_rec);
}
}
}
_check_enabled = TRUE;
owner().highlight();
}
}
refused = TRUE;
break;
@ -1193,13 +1222,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
}
if (disabled)
{
// const int dir = _lastab == K_TAB ? +1 : -1;
const int dir = physical_column >= _cur_col ? +1 : -1;
const int nex = find_enabled_column(_cur_rec, physical_column, dir);
if (nex > 0) // If at least one enabled cell exists
set_focus_cell(_cur_row, nex);
// else
refused = TRUE;
refused = TRUE;
}
else
{
@ -1448,7 +1475,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
break;
default:
if (k >= ' ' && k <= 'z')
changed = lst.select_by_initial(k);
changed = lst.select_by_initial(char(k));
break;
}
if (changed)
@ -1474,16 +1501,6 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
xiev->v.xi_obj = NULL;
event_handler(itf, xiev);
break;
/*
case K_TAB:
case K_BTAB:
_lastab = k;
break;
case K_UP:
case K_DOWN:
_lastab = (_cur_col == 2) ? K_BTAB : K_TAB;
break;
*/
case K_ENTER:
case K_SHIFT+K_ENTER:
{
@ -1985,7 +2002,7 @@ void TSpreadsheet::set_columns_order(TToken_string* order)
xi_column_set_pixel_width(col, _default_width[index]-offset);
}
}
_save_columns_order = 0x3;
_save_columns_order = byte(0x3);
}
else
{
@ -2194,7 +2211,8 @@ bool TSheet_field::parse_item(TScanner& scanner)
if (logicnum > 0)
{
TDir d; d.get(logicnum);
if (fexist(d.filename())) // Controlla l'esistenza del file
const TFilename fn(d.filename());
if (fn.exist()) // Controlla l'esistenza del file
{
_sheetfile = new TLocalisamfile(logicnum);
TString s = scanner.pop();

View File

@ -1,3 +1,4 @@
#define XVT_INCL_NATIVE
#include <strings.h>
// skstream.h
@ -132,14 +133,6 @@ protected:
#define debug(x)
#endif //def _DEBUG
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE !FALSE
#endif
//
// skstream
//

View File

@ -9,7 +9,7 @@
#include <strings.h>
#endif
enum os_type { os_Windows, os_Win32s, os_Windows95, os_WindowsNT };
enum os_type { os_Unknown, os_Windows, os_Win32s, os_Windows95, os_WindowsNT };
os_type os_get_type();
void os_post_menu_event(WINDOW win, MENU_TAG tag);
@ -22,7 +22,7 @@ bool os_is_local_drive(const char* path);
bool os_test_disk_free_space(const char* path, unsigned long filesize);
COLOR os_choose_color(COLOR col, WINDOW win);
void os_exec_help_command(MENU_TAG tag, const char* key = NULL);
void os_exec_help_command(MENU_TAG tag, const char* key);
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild);
bool os_file_exist(const char* path);

View File

@ -1,4 +1,6 @@
#define XVT_INCL_NATIVE
#define XI_INTERNAL
#include <xinclude.h>
#include <os_dep.h>
#include <commdlg.h>
@ -14,7 +16,7 @@
#include <applicat.h>
#include <colors.h>
#include <window.h>
#include <mask.h>
extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
@ -160,10 +162,10 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
{
const KEY key = toupper(wparam)+K_CTRL;
dispatch_e_char(win, key);
*ret = 2 << 8;
*ret = 2 << 16;
}
}
break;
@ -372,7 +374,7 @@ bool os_test_disk_free_space(const char* path, unsigned long filesize)
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(main_app().name());
TString mod(key);
mod.cut(2); mod.lower();
if (mod != "ba") hlp.insert(mod, 0);
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
@ -396,11 +398,6 @@ void os_exec_help_command(MENU_TAG tag, const char* key)
mk.mkKeylist = 'M';
strcpy(mk.mkKeyphrase, key);
TFilename hlp("prassi.hlp");
TString16 mod(key);
mod.cut(2); mod.lower();
if (mod != "ba") hlp.insert(mod, 0);
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
}
break;
@ -408,11 +405,6 @@ void os_exec_help_command(MENU_TAG tag, const char* key)
}
}
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#endif
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
const int exitcode = WinExec(path, showchild ? SW_SHOWNORMAL : SW_HIDE);

423
include/os_win32.cpp Executable file
View File

@ -0,0 +1,423 @@
#define XVT_INCL_NATIVE
#define WIN32_EXTRA_LEAN
#include <os_dep.h>
#include <commdlg.h>
#include <ctype.h>
#include <applicat.h>
#include <colors.h>
#include <utility.h>
#include <window.h>
///////////////////////////////////////////////////////////
// Win32 event hook
///////////////////////////////////////////////////////////
HIDDEN BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
const KEY key = toupper(wparam)+K_CTRL;
dispatch_e_char(win, key);
*ret = 2 << 16;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 0x8000) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 0x8000) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
default:
break;
}
return TRUE; // Continua col processo normale
}
///////////////////////////////////////////////////////////
// Operating system dependent functions
///////////////////////////////////////////////////////////
bool os_allow_another_instance()
{
return TRUE;
}
COLOR os_choose_color(COLOR col, WINDOW win)
{
CHOOSECOLOR cc;
memset(&cc, 0, sizeof(cc)); // Azzera struttura
if (win == NULL_WIN) win = TASK_WIN; // Sceglie una finestra valida
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
HDC hdc = GetDC(hwnd);
// Legge la palette di sistema
PALETTEENTRY* pe = NULL;
int max_entries = 0;
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
{
max_entries = GetDeviceCaps(hdc, SIZEPALETTE);
pe = new PALETTEENTRY[max_entries];
GetSystemPaletteEntries(hdc, 0, max_entries, pe);
}
ReleaseDC(hwnd, hdc);
// Definisce i 16 colori customizzabili
unsigned long custom_colors[16];
for (int c = 0; c < 16; c++)
{
if (pe)
{
const PALETTEENTRY& e = pe[c < 8 ? c : max_entries - 16 + c];
custom_colors[c] = RGB(e.peRed, e.peGreen, e.peBlue);
}
else
{
const unsigned char val = (c & 0x8) ? 255 : 127;
const unsigned char red = (c & 0x1) ? val : 0;
const unsigned char green = (c & 0x2) ? val : 0;
const unsigned char blue = (c & 0x4) ? val : 0;
custom_colors[c] = RGB(red, green, blue);
}
}
if (pe)
{
delete pe;
pe = NULL;
}
cc.lStructSize = sizeof(cc); // Setta dimensioni
cc.hwndOwner = hwnd; // Setta finestra padre
cc.rgbResult = RGB(XVT_COLOR_GET_RED(c), XVT_COLOR_GET_GREEN(c), XVT_COLOR_GET_BLUE(c));
cc.lpCustColors = custom_colors; // Fissa colori custom
cc.Flags = CC_RGBINIT; // Usa col come primo colore
if (ChooseColor(&cc) != 0)
col = RGB2COLOR(GetRValue(cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult));
else
col = COLOR_INVALID;
return col;
}
bool os_deny_another_instance()
{
return FALSE;
}
bool os_destroy_native_icon(unsigned icon)
{
return DestroyIcon((HICON)icon) != 0;
}
void os_draw_native_icon(WINDOW win, const RCT& rct, unsigned icon)
{
HDC hdc = (HDC)xvt_vobj_get_attr(win, ATTR_NATIVE_GRAPHIC_CONTEXT);
int x = rct.left + (rct.right - rct.left - 32) / 2;
int y = rct.top + (rct.bottom - rct.top - 32) / 2;
DrawIcon(hdc, x, y, (HICON)icon);
}
unsigned long os_get_free_memory()
{
MEMORYSTATUS ms;
GlobalMemoryStatus(&ms);
return ms.dwAvailPhys;
}
bool os_is_removable_drive(const char* path)
{
return GetDriveType(path) == DRIVE_REMOVABLE;
}
bool os_is_network_drive(const char* path)
{
return GetDriveType(path) == DRIVE_REMOTE;
}
bool os_is_fixed_drive(const char* path)
{
UINT dt = GetDriveType(path);
return dt == DRIVE_FIXED || dt == DRIVE_CDROM;
}
bool os_test_disk_free_space(const char* path, unsigned long filesize)
{
/* Works on WinNT and Win95 OSR2 Only!
ULARGE_INTEGER nRequired;
ULARGE_INTEGER nAvailable;
nRequired.QuadPart = filesize;
GetDiskFreeSpaceEx(path, &nAvailable, NULL, NULL);
return nRequired.QuadPart <= nAvailable.QuadPart;
*/
// May fail for disk > 2GB
DWORD nSecPerClust, nBytePerSec, nFreeClust;
GetDiskFreeSpace(path, &nSecPerClust, &nBytePerSec, &nFreeClust, NULL);
__int64 nFree = nFreeClust;
nFree *= nSecPerClust;
nFree *= nBytePerSec;
return nFree > filesize;
}
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
mod.cut(2); mod.lower();
if (mod != "ba") hlp.insert(mod, 0);
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
switch(tag)
{
case M_HELP_CONTENTS:
WinHelp(hwnd, hlp, HELP_CONTENTS, 0);
break;
case M_HELP_SEARCH:
WinHelp(hwnd, hlp, HELP_PARTIALKEY, (DWORD)"");
break;
case M_HELP_HELPONHELP:
WinHelp(hwnd, hlp, HELP_HELPONHELP, 0);
break;
case M_HELP_ONCONTEXT:
if (hlp.exist())
{
struct MULTIGUY
{
DWORD mkSize;
TCHAR mkKeylist;
TCHAR mkKeyphrase[16];
} mk;
mk.mkSize = sizeof(MULTIGUY);
mk.mkKeylist = 'M';
strncpy(mk.mkKeyphrase, key, sizeof(mk.mkKeyphrase));
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
}
break;
default: break;
}
}
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
int exitcode = -1;
STARTUPINFO start;
PROCESS_INFORMATION pi;
memset(&start, 0, sizeof(start));
start.cb = sizeof(start);
start.dwX = start.dwY = start.dwXSize = start.dwYSize = CW_USEDEFAULT;
start.dwFlags = STARTF_USESHOWWINDOW;
start.wShowWindow = showchild ? SW_SHOW : SW_HIDE;
BOOL started = CreateProcess(NULL,(char*)(const char*)path, NULL, NULL, FALSE, 0,
NULL, NULL, &start, &pi);
if (started)
{
HANDLE hProcess = pi.hProcess;
if (sync)
{
TTemp_window tw(TASK_WIN);
if (iconizetask)
{
tw.iconize();
tw.deactivate();
}
ATOM aBa0Atom = NULL;
if (iconizetask && showchild && main_app().name() == "ba0100")
{
TString str;
str << "ba0100->" << cmd2name(path);
aBa0Atom = GlobalAddAtom(str);
}
WaitForInputIdle(hProcess, INFINITE);
if (WaitForSingleObject(hProcess, INFINITE) != 0xFFFFFFFF)
{
unsigned long exit_code;
if (GetExitCodeProcess(hProcess, &exit_code))
exitcode = int(exit_code);
else
exitcode = -2;
}
if (aBa0Atom)
GlobalDeleteAtom(aBa0Atom);
if (iconizetask)
{
tw.maximize();
tw.activate();
}
}
else
exitcode = 0;
CloseHandle(pi.hThread);
CloseHandle(hProcess);
}
return exitcode;
}
int os_get_printer_names(TToken_string& t)
{
char* buf = t.get_buffer(2048); // ammazzao'
GetProfileString ("devices", NULL, "", buf, t.size());
for (int i = 0; i < t.size(); i++)
{
if (buf[i] == '\0')
{
if (buf[i+1] != '\0') buf[i] = t.separator();
else break;
}
}
return t.items();
}
bool os_set_default_printer(const char* name)
{
CHECK(name && *name > ' ', "Null printer name");
TString pdev(name);
if (pdev.find(',') < 0)
{
TString szDevice(256);
GetProfileString ("devices", pdev, "", szDevice.get_buffer(), szDevice.size());
pdev << ',' << szDevice;
}
bool ok = WriteProfileString("windows", "device", pdev) != 0;
return ok;
}
bool os_get_default_printer(TString& name)
{
char* buf = name.get_buffer(256);
bool ok = GetProfileString ("windows", "device", ",,,", buf, name.size()) != 0;
return ok;
}
bool os_spawn_by_menu()
{
TString str = main_app().name();
bool ok = str == "ba0100";
if (!ok)
{
str.insert("ba0100->", 0);
ok = GlobalFindAtom(str) != NULL;
}
return ok;
}
os_type os_get_type()
{
OSVERSIONINFO ovi;
GetVersionEx(&ovi);
os_type t;
switch (ovi.dwPlatformId)
{
case VER_PLATFORM_WIN32s : t = os_Win32s; break;
case VER_PLATFORM_WIN32_NT : t = os_WindowsNT; break;
case VER_PLATFORM_WIN32_WINDOWS: t = os_Windows95; break;
default : t = os_Unknown; break;
}
return t;
}
void os_post_menu_event(WINDOW win, MENU_TAG tag)
{
HWND w = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
PostMessage(w, WM_COMMAND, tag, 0L);
}
void os_set_event_hook()
{
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)event_hook);
long twin_style = WSF_ICONIZABLE | WSF_CLOSE | WSF_SIZE;
const int scx = GetSystemMetrics(SM_CXSCREEN);
if (scx == 640)
{
const int scy = GetSystemMetrics(SM_CYSCREEN);
const int bcx = GetSystemMetrics(SM_CXFRAME);
const int bcy = GetSystemMetrics(SM_CYFRAME);
static RCT rct;
rct.left = -bcx;
rct.top = GetSystemMetrics(SM_CYCAPTION)-bcy-1;
rct.right = scx+bcx;
rct.bottom = scy+bcy;
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_PM_TWIN_STARTUP_RCT, long(&rct));
}
else
twin_style |= WSF_MAXIMIZED;
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
}
void os_wake_up_caller()
{
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
}
bool os_file_exist(const char* file)
{
return FALSE;
}
bool os_open_spool_row(const char* device)
{
return TRUE;
}
bool os_spool_row(const char* str)
{
return FALSE;
}
bool os_close_spool_row()
{
return TRUE;
}
void os_iconize_window(WINDOW win)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_MINIMIZE);
}
void os_maximize_window(WINDOW win)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}

View File

@ -1,5 +1,3 @@
#include <errno.h>
#define __PREFIX_CPP
#include <prefix.h>
@ -30,7 +28,7 @@ TString& user()
{
return _user;
}
// @doc EXTERNAL
// @func Inizializza (crea) un nuovo file "prefix.txt"
@ -160,7 +158,7 @@ HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array&
TTrec r;
r.get(i + 1, (TDirtype) isfd->ft);
*isfd->r = *r.rec();
if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES)
if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1)
fatal_box("Can't reopen file n. %d : file in use", i + 1);
isfd->fhnd = DB_open(isfd->d->SysName, excl[i],TRUE);
if (isfd->fhnd < 0 ) err=get_error(isfd->fhnd);

View File

@ -78,7 +78,7 @@ public:
const char* description(int cod) const;
// @cmember Controlla che la ditta attiva sia una ditta (e non es. dati comuni)
bool is_firm() const
{ return _prefix.len() == 6 && (toupper(_prefix[5]) == 'A');}
{ return _prefix.len() == 6 && (_prefix[5] == 'A' || _prefix[5] == 'a'); }
// @cmember Controlla che siano attivi i dati comuni (e non una ditta)
bool is_com() const
{ return !is_firm();}

View File

@ -279,7 +279,7 @@ bool TPrintwin::do_print()
_blank_lines_to_print = 0;
while (ok && !_aborted)
{
_aborted = !(bool)xvt_print_open_page(_printrcd);
_aborted = xvt_print_open_page(_printrcd) == 0;
while (!_aborted && ok
&& (rct = xvt_print_get_next_band()) != NULL)
{
@ -291,7 +291,7 @@ bool TPrintwin::do_print()
#endif
ok = print_band(page, *rct);
}
_aborted |= !(bool)xvt_print_close_page(_printrcd);
_aborted |= xvt_print_close_page(_printrcd) == 0;
page++;
}
return !_aborted;

View File

@ -68,10 +68,10 @@ protected:
public:
// @cmember Controlla se e' stato premuto il tasto "Annulla"
bool iscancelled() const
{ do_events(); return _flags & IND_CANCELLED; }
{ do_events(); return (_flags & IND_CANCELLED) != 0; }
// @cmember Controlla se e' finito l'operazione
bool isfinished() const
{ do_events(); return _flags & IND_FINISHED; }
{ do_events(); return (_flags & IND_FINISHED) != 0; }
// @cmember Ritorna lo stato dell'operazione (quantita' dell'applicazione gia' fatta)
long status() const
{ do_events(); return _status; }

View File

@ -11,6 +11,17 @@ const real ZERO (0.0);
#include <math.h>
#include <stdio.h>
#ifndef _atold
inline long double _atold(const char* str)
{
long double num = 0.0;
sscanf(str, "%Lf", &num);
return num;
}
#endif
real::real () : _dec(0.0)
{ }

View File

@ -506,7 +506,7 @@ int TRelation_application::delete_mode()
//
// @rdesc Ritorna se la chave esiste sul file
bool TRelation_application::test_key(
byte k, // @parm Chiave da ricercare
word k, // @parm Chiave da ricercare
bool err) // @parm Indica se visualizzare eventuali errori occorsi
{
bool onereq = FALSE, onefill = FALSE;
@ -554,7 +554,7 @@ bool TRelation_application::test_key(
return onefill || onereq;
}
bool TRelation_application::find(byte k)
bool TRelation_application::find(word k)
{
if (k == 0)
{
@ -1227,7 +1227,7 @@ bool TRelation_application::parse_command_line()
_lnflag = 1; // Attiva automagia
}
return _lnflag;
return _lnflag != 0;
}
void TRelation_application::ini2query_mask()

View File

@ -44,7 +44,7 @@ class TRelation_application : public TSkeleton_application
long _recins;
// @cmember:(INTERNAL) Indica se e' stato chiamato col messaggio di link
bool _lnflag;
byte _lnflag;
// @cmember:(INTERNAL) Contiene il codice del campo e il valore fisso
TToken_string _fixed;
// @cmember:(INTERNAL) Messaggio da passare all'utente per indicare che e' stata fatta la rinumerazione
@ -55,12 +55,12 @@ class TRelation_application : public TSkeleton_application
// @cmember:(INTERNAL) Azione della transazione corrente
TString _transaction;
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
bool _autodelete;
byte _autodelete;
// @cmember:(INTERNAL) Setta i campi fissati da <md TRelation_application::_fixed>
bool filter();
// @cmember:(INTERNAL) Controlla se una chiave e' completa ed esiste su file
bool test_key(byte k, bool err);
bool test_key(word k, bool err);
// @cmember:(INTERNAL) Abilita la ricerca sulla maschera
void enable_query();
// @cmember:(INTERNAL) UNUSED
@ -195,7 +195,7 @@ protected:
// @cmember Impone il campo da utilizzare col bottone Ricerca
void set_search_field(short id)
{ _search_id = id;}
bool autodeleting() const { return _autodelete; }
byte autodeleting() const { return _autodelete; }
bool parse_command_line();
void ini2query_mask();
void ini2insert_mask();
@ -213,11 +213,11 @@ public:
bool filtered() const
{ return _fixed.not_empty(); }
// @cmember Cerca un record corrispondente alla chiave <p key> (0 prima chiave completa)
bool find(byte key = 0);
bool find(word key = 0);
// @cmember Costruisce il membro <md TRelation_application::_fixed>
void set_link(TMask & m, const char * keyexpr);
// @cmember Ritorna se e' stato chiamato col messaggio di link
bool lnflag() const
byte lnflag() const
{ return _lnflag;}
// @cmember Costruttore

View File

@ -495,7 +495,7 @@ bool TRelation::add(
relexprs, alias, allow_lock);
_reldefs.add(r);
return _errors;
return TRUE;
}
@ -805,7 +805,10 @@ bool TRelation::isconsistent(
// if the above hold, check consistency
if (bad)
return _errors = bad;
{
_errors = bad;
return FALSE;
}
position_rels(_isequal, _nolock);
for (i = 0; i < _files.items(); i++)
@ -820,7 +823,7 @@ bool TRelation::isconsistent(
for(i = 0; i < _files.items(); i++)
file(i).readat(recnos[i]);
return _errors = bad;
return TRUE;
}
#endif
@ -919,24 +922,47 @@ HIDDEN bool __evalcondition(const TRelation& r,TExpression* cond, const TArray &
// @doc EXTERNAL
static TFilename _last_name;
static FILE* _last_ndx = NULL;
static bool _last_created = FALSE;
// @mfunc Apre il file di indice
//
// @rdesc Ritorna l'handle del file aperto
FILE* TCursor::open_index(
bool create) // @parm Indica se creare l'indice nel caso manchi (default FALSE)
{
if (create && _indexname.empty())
_last_created = create;
if (create || _indexname.empty())
_indexname.temp("ci");
FILE* f = fopen(_indexname, create ? "wb" : "rb");
if (f == NULL)
fatal_box("Can't use cursor index for file %d: '%s'\n",
file().filehnd()->ln, (const char*)_indexname);
return f;
if (_indexname != _last_name)
{
if (_last_ndx != NULL)
fclose(_last_ndx);
_last_ndx = fopen(_indexname, create ? "wb" : "rb");
if (_last_ndx == NULL)
fatal_box("Can't use cursor index for file %d: '%s'\n",
file().num(), (const char*)_indexname);
_last_name = _indexname;
}
return _last_ndx;
}
void TCursor::close_index(FILE* f)
{
CHECK(f == _last_ndx, "Bad open/close index sequence");
if (_last_created)
{
fclose(_last_ndx);
_last_ndx = NULL;
_last_name.cut(0);
_last_created = FALSE;
}
}
TRecnotype TCursor::buildcursor(TRecnotype rp)
{
TRecnotype oldrecno=0,pos,ap = 0;
int junk, l, pagecnt = 0;
const bool filtered = has_filter();
@ -945,11 +971,11 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
if (DB_reccount(file().filehnd()->fhnd) == 0)
{
fclose(_f);
close_index(_f);
return 0;
}
fseek(_f, 0L, SEEK_SET);
rewind(_f);
l = strlen(to());
junk=DB_index_seek(file().filehnd()->fhnd, (char*)(const char*) from());
@ -1001,7 +1027,7 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
}
if (_pos == -1) pos=0;
delete page;
fclose (_f);
close_index(_f);
return ap;
}
@ -1287,7 +1313,7 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop)
}
}
delete page;
fclose(_f);
close_index(_f);
if (_pos < 0L)
_pos = 0L;
@ -1342,7 +1368,7 @@ TRecnotype TCursor::readrec()
if (fread(&nrec, sizeof(TRecnotype), 1, _f) != 1)
fatal_box("Can't read position %ld in cursor n. %d\n", _pos, file().filehnd()->ln);
fclose(_f);
close_index(_f);
curr().setdirty();
file().readat(nrec);
@ -1451,7 +1477,7 @@ bool TSorted_cursor::check_expr(
{
int p=s.find('(');
int p1=s.find(')');
int rt=TRUE;
bool rt=TRUE;
if (p>-1 && p1>-1)
if (s.find("UPPER") < 0)
@ -1525,7 +1551,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
if (DB_reccount(file().filehnd()->fhnd) == 0)
{
fclose(_f);
close_index(_f);
return 0;
}
@ -1596,7 +1622,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
if (TCursor::pos() == -1) pos=0;
delete page;
if (_sort) delete _sort;
fclose (_f);
close_index(_f);
return ap;
}

View File

@ -141,7 +141,7 @@ public:
{ return lfile(logicnum).bof(); }
// @cmember Ritorna lo stato del file indicato (se <p logicnum> = 0 dell'intera relazione,
// altrimenti del file indicato )
bool status(int logicnum = 0) const
int status(int logicnum = 0) const
{ return lfile(logicnum).status(); }
// @cmember Controlla se l'ultima operazione sul file e' stata effettuata correttamente
// (se <p logicnum> = 0 dell'intera relazione, altrimenti del file indicato )
@ -265,6 +265,8 @@ class TCursor : public TContainer
protected:
// @cmember Apre il file di indice
FILE* open_index(bool create = FALSE);
// @cmember Chiude il file di indice
void close_index(FILE* f);
// @cmember Ritorna se e' stato modificato il cursore (cioe' quando occorre fare l'update)
virtual bool changed();
// @cmember Costruisce il cursore a partire dal record

View File

@ -12,12 +12,18 @@ TScanner::TScanner(const char* filename)
: _pushed(FALSE), _line(0),
_token(128), _key(2), _buffer(1024*16), _tmp(1024*8)
{
setbuf((char*)(const char*)_buffer, _buffer.size());
setbuf(_buffer.get_buffer(), _buffer.size());
open(filename, ios::in | ios::nocreate, filebuf::sh_read);
if (bad())
fatal_box("Impossibile aprire %s", filename);
}
TScanner::~TScanner()
{
close(); // Altrimenti si incasina col buffer!
}
const TString& TScanner::pop()
{
if (!_pushed) do

View File

@ -37,8 +37,7 @@ public:
// @cmember Costruttore
TScanner(const char* filename);
// @cmember Distruttore
~TScanner()
{}
virtual ~TScanner();
// @cmember Legge il token dal file e lo ritorna
const TString& pop();
// @cmember Ritorna la chiave del token attivo
@ -66,8 +65,8 @@ public:
bool paragraph(const char* name);
// @cmember Ritorno TRUE se il file non e' in nessun stato di errore
bool ok()
{ return good(); }
virtual bool ok() const
{ return good() != 0; }
// @cmember Mette nel file l'ultima stringa letta o quella specificata
void push(const char* tok = NULL);

View File

@ -35,7 +35,7 @@ class TSheet_control : public TControl
// @cmember:(INTERNAL) Array delle largezze standard
int _default_width[MAX_COL];
bool _save_columns_order;
byte _save_columns_order;
protected: // TControl
//@cmember Gestisce gli eventi delle celle
@ -245,6 +245,7 @@ TSheet_control::TSheet_control(
if (i == 0 && _type[i] == 'C')
{
coldef->v.column->icon_rid = ICO_CHECK_ON;
coldef->v.column->icon_mode = XIM_ICON_HAS_PRIORITY;
if (l->min_heading_height < 20)
l->min_heading_height = 20;
}
@ -960,7 +961,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
TSheet::~TSheet()
{
delete _sheet;
// delete _sheet; // Guy bestia: Already deleted by TMask!
}
TSheet_control& TSheet::sheet()

View File

@ -75,8 +75,8 @@ void init_global_vars()
CGetFile(LF_DIR, &d, _nolock, NORDIR);
if (d.EOD > maxfdir) maxfdir = d.EOD;
isjournal = FALSE;
maxfdir += 32; // Guy: Sicurezza buona, sicurezza vera
openf = new isfdptr[maxfdir];
openrec = new TRectype*[maxfdir];
ext_files = new isfdptr[maxfdir];
@ -107,7 +107,7 @@ void free_global_vars()
// DB_exit();
}
#ifndef FOXPRO
#if !defined(FOXPRO) && (XVT_OS != XVT_OS_WIN32)
// @doc EXTERNAL

View File

@ -7,10 +7,13 @@
#endif
#endif
#define pure =0
#ifndef DBG
#ifndef NDEBUG
#define DBG
#endif
#endif
#define FALSE 0
#define TRUE 1
#define pure =0
#define HIDDEN static
@ -21,15 +24,10 @@
// @type UINT8 | Altro nome di assegnazione per gli unsigned char
typedef unsigned char UINT8;
#ifdef M_I386
// @doc EXTERNAL
// @type UINT16 | Altro nome di assegnazione per gli unsigned short (se compilato a 32bit)
// oppure unsigned int (se non definito M_I386)
// @type UINT16 | Altro nome di assegnazione per gli unsigned short
typedef unsigned short UINT16;
#else
typedef unsigned int UINT16;
#endif
// @doc EXTERNAL
// @type UINT32 | Altro nome di assegnazione per gli unsigned long
@ -38,13 +36,9 @@ typedef unsigned long UINT32;
// @type INT8 | Altro nome di assegnazione per i char
typedef char INT8;
#ifdef M_I386
// @type INT16 | Altro nome di assegnazione per gli short (se compilato a 32bit)
// oppure int (se non definito M_I386)
// @type INT16 | Altro nome di assegnazione per gli short
typedef short INT16;
#else
typedef int INT16;
#endif
// @doc EXTERNAL
// @type INT32 | Altro nome di assegnazione per i long
@ -53,7 +47,23 @@ typedef long INT32;
// @type bool | Tipo booleano che puo' assumere i valori TRUE (definito come 1)
// e FALSE (definito come 0).
typedef UINT8 bool;
#ifdef WIN32
#ifndef __cplusplus
typedef unsigned short bool;
#endif
#else
typedef unsigned char bool;
#endif
#define FALSE 0
#define TRUE 1
// @doc EXTERNAL
// @type word | Tipo per la definizione di tipi di lunghezza pari a due byte
@ -84,10 +94,12 @@ void set_std_level(const long l);
void init_global_vars();
void free_global_vars();
/*
#ifdef __cplusplus
extern void* operator new(unsigned);
extern void operator delete(void*);
#endif
*/
#endif // __STDTYPES_H

View File

@ -2,7 +2,7 @@
#include <direct.h>
#include <stdio.h>
#include <stdarg.h>
#include <strstream.h>
#include <strstrea.h>
#include <prefix.h>
#include <regexp.h>
@ -1098,15 +1098,11 @@ const TFilename& TFilename::tempdir()
if (create)
{
const char* dirpref = getenv("TEMP");
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
if (dirpref == NULL || *dirpref == '\0')
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
dirpref = "\\tmp";
#else
dirpref = "/tmp";
#endif
_tempdir = dirpref;
_tempdir = getenv("TEMP");
if (_tempdir.empty())
_tempdir = getenv("TMP");
if (_tempdir.empty())
_tempdir << SLASH << "tmp";
const int last = len()-1;
if (!is_not_slash(_str[last]))

View File

@ -1338,8 +1338,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
stop_run(CTRL_S);
break;
case M_SHOW_RULERS: // mostra righelli
show_rulers(!_rulers);
check_menu_item(M_SHOW_RULERS, _rulers);
show_rulers(_rulers == 0);
check_menu_item(M_SHOW_RULERS, _rulers != 0);
break;
case M_SHOW_BUTTONS: // mostra bottoni
show_buttons(!_showbuts);
@ -1426,8 +1426,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
{
p = ep->v.mouse.where;
if (_isopen && _toplevel && (p.x >= 4 && p.x) <= X_OFFSET &&
(p.y >= (int)rows () - BUTTONROW_SIZE && p.y <= (int)rows() - Y_OFFSET))
if (_isopen && _toplevel && (p.x >= 4 && p.x <= X_OFFSET) &&
(p.y >= (int)rows() - BUTTONROW_SIZE && p.y <= (int)rows() - Y_OFFSET))
{
abort_print ();
ignore = TRUE;
@ -2458,7 +2458,7 @@ TViswin::TViswin(const char *fname,
bool linkbutton,
int x, int y,
int height, int width,
bool rulers, // overridden by config parms
byte rulers, // overridden by config parms
WINDOW parent,
TBrowsefile_field* brwfld):
TField_window(x, y, width, height, parent, brwfld),
@ -2533,7 +2533,7 @@ TViswin::TViswin(const char *fname,
enable_menu_item(M_EDIT_COPY, FALSE);
enable_menu_item(M_SHOW_RULERS, TRUE);
enable_menu_item(M_SHOW_BUTTONS, TRUE);
check_menu_item(M_SHOW_RULERS, _rulers);
check_menu_item(M_SHOW_RULERS, _rulers != 0);
check_menu_item(M_SHOW_BUTTONS, _showbuts);
enable_menu_item(M_EDIT_SEL_ALL, FALSE);
}

View File

@ -160,7 +160,7 @@ class TViswin : public TField_window
// @cmember:(INTERNAL) Finestra in primo piano (se FALSE e un campo di una maschera)
bool _toplevel;
// @cmember:(INTERNAL) Indica se mostrare il righello
bool _rulers;
byte _rulers;
// @cmember:(INTERNAL) Indica se visualizzare i bottoni
bool _showbuts;
// @cmember:(INTERNAL) Indica se si sta attivando un link
@ -337,7 +337,7 @@ public:
// WINDOW parent=NULL_WIN, TBrowsefile_field*=NULL | Costruttore
TViswin(const char* fname=NULL, const char* title=NULL, bool editbutton=TRUE,
bool printbutton=TRUE, bool linkbutton=TRUE, int x=-1, int y=-1, int height=0,
int width=0, bool rulers=3, WINDOW parent=NULL_WIN, TBrowsefile_field* =NULL);
int width=0, byte rulers=3, WINDOW parent=NULL_WIN, TBrowsefile_field* =NULL);
// @cmember Distruttore
virtual ~TViswin ();
};

View File

@ -147,16 +147,20 @@ void TWindow_manager::destroy()
void TWindow_manager::lock_handle()
{
#if XVT_OS == XVT_OS_WIN
CHECK(_lowhandle == NULL, "Can't relock low handle");
_lowhandle = fopen("con", "r");
CHECK(_lowhandle != NULL, "Can't lock low handle");
#endif
}
void TWindow_manager::free_handle()
{
#if XVT_OS == XVT_OS_WIN
CHECK(_lowhandle, "Can't unlock low handle");
fclose(_lowhandle);
_lowhandle = NULL;
#endif
}

View File

@ -534,6 +534,7 @@ WINDOW xvt_create_statbar()
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
TASK_WIN, 0, 0, "");
CHECK(_statbar, "Can't create the status bar");
statbar_set_fontid(_statbar, xvt_default_font());
@ -557,6 +558,7 @@ void xvt_statbar_set(
const TDate oggi(TODAY);
TString t(31);
t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def)
statbar_set_default_title(_statbar, (char*)(const char*)t);
statbar_set_title(_statbar, (char*)(const char*)t);