1994-08-12 10:52:49 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define __STDTYPES_CPP
|
|
|
|
|
|
|
|
#include <extcdecl.h>
|
|
|
|
#include <conf.h>
|
|
|
|
#include <modaut.h>
|
|
|
|
|
1996-05-14 10:16:31 +00:00
|
|
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
|
1994-08-12 10:52:49 +00:00
|
|
|
#include <dos.h>
|
|
|
|
#include <hlapi_c.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <checks.h>
|
|
|
|
#include <isam.h>
|
1994-12-07 11:10:57 +00:00
|
|
|
#include <prefix.h>
|
1995-07-03 07:49:30 +00:00
|
|
|
#include <codeb.h>
|
1994-08-12 10:52:49 +00:00
|
|
|
|
1995-07-03 07:49:30 +00:00
|
|
|
extern isfdptr *openf;
|
1995-03-22 09:07:04 +00:00
|
|
|
HIDDEN long _stdlevel = 0;
|
|
|
|
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc INTERNAL
|
1996-01-31 17:19:02 +00:00
|
|
|
|
|
|
|
// @func Ritorna il livello degli archivi
|
1995-03-22 09:07:04 +00:00
|
|
|
long get_std_level()
|
|
|
|
{ return _stdlevel; }
|
1994-08-12 10:52:49 +00:00
|
|
|
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc INTERNAL
|
|
|
|
|
1996-01-31 17:19:02 +00:00
|
|
|
// @func Ritorna il numero di serie della chiave
|
|
|
|
//
|
|
|
|
// @rdesc Numero di serie della chiave
|
1994-12-07 11:10:57 +00:00
|
|
|
int get_serial_number()
|
|
|
|
{
|
1996-05-14 10:16:31 +00:00
|
|
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
|
1994-12-07 11:10:57 +00:00
|
|
|
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
|
|
|
|
if (status != STATUS_OK)
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
return getser();
|
|
|
|
}
|
|
|
|
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc INTERNAL
|
|
|
|
|
1996-01-31 17:19:02 +00:00
|
|
|
// @func Inizilizza le variabili globali
|
1994-08-12 10:52:49 +00:00
|
|
|
void init_global_vars()
|
|
|
|
{
|
1995-03-22 09:07:04 +00:00
|
|
|
TPrefix& pref = prefix_init();
|
1994-11-15 11:23:24 +00:00
|
|
|
|
1995-03-22 09:07:04 +00:00
|
|
|
pref.set("");
|
|
|
|
_stdlevel = pref.filelevel();
|
1994-09-27 10:12:15 +00:00
|
|
|
|
|
|
|
FileDes d;
|
|
|
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
|
|
|
|
|
|
|
long maxfdir = d.EOX;
|
1995-03-22 09:07:04 +00:00
|
|
|
pref.set("DEF");
|
1994-09-27 10:12:15 +00:00
|
|
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
|
|
|
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
1994-08-12 10:52:49 +00:00
|
|
|
|
|
|
|
isjournal = FALSE;
|
|
|
|
|
1994-09-27 10:12:15 +00:00
|
|
|
openf = new isfdptr[maxfdir];
|
|
|
|
openrec = new TRectype*[maxfdir];
|
|
|
|
|
|
|
|
for (long i = 0; i < maxfdir; i++)
|
|
|
|
{
|
|
|
|
openf[i] = NULL;
|
|
|
|
openrec[i] = NULL;
|
|
|
|
}
|
|
|
|
|
1994-08-12 10:52:49 +00:00
|
|
|
#if XVT_OS == XVT_OS_SCOUNIX
|
1994-11-07 16:32:57 +00:00
|
|
|
const bool muflag = CGetAut(MUAUT);
|
1995-03-22 09:07:04 +00:00
|
|
|
if (SerNo && !muflag)
|
1994-09-27 10:12:15 +00:00
|
|
|
fatal_box("Abnormal termination: check protection or serial number\n");
|
1994-08-12 10:52:49 +00:00
|
|
|
#endif
|
1995-07-03 07:49:30 +00:00
|
|
|
DB_init();
|
1994-08-12 10:52:49 +00:00
|
|
|
}
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc INTERNAL
|
1994-08-12 10:52:49 +00:00
|
|
|
|
1996-01-31 17:19:02 +00:00
|
|
|
// @func Dealloca le variabili globali
|
1994-08-12 10:52:49 +00:00
|
|
|
void free_global_vars()
|
1994-12-07 11:10:57 +00:00
|
|
|
{
|
1996-05-14 10:16:31 +00:00
|
|
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
|
1994-09-27 10:12:15 +00:00
|
|
|
HL_LOGOUT();
|
1994-08-12 10:52:49 +00:00
|
|
|
#endif
|
1995-03-22 09:07:04 +00:00
|
|
|
if (openf != NULL)
|
1994-12-07 11:10:57 +00:00
|
|
|
{
|
|
|
|
delete openf;
|
|
|
|
delete openrec;
|
1995-03-22 09:07:04 +00:00
|
|
|
prefix_destroy();
|
1994-12-07 11:10:57 +00:00
|
|
|
}
|
1995-07-03 07:49:30 +00:00
|
|
|
DB_exit();
|
1994-08-12 10:52:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef FOXPRO
|
|
|
|
#include <xvt.h>
|
|
|
|
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc EXTERNAL
|
|
|
|
|
1996-01-31 17:19:02 +00:00
|
|
|
// @func Operatore per la creazione di un oggetto (sostituisce operatore C++)
|
|
|
|
//
|
|
|
|
// @rdesc Ritorna il puntatore all'oggetto creato
|
1994-08-12 10:52:49 +00:00
|
|
|
void* operator new(size_t size)
|
1996-01-31 17:19:02 +00:00
|
|
|
|
|
|
|
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
|
1996-05-08 11:09:13 +00:00
|
|
|
// in linea del C++.
|
1996-01-31 17:19:02 +00:00
|
|
|
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
|
|
|
|
|
1995-01-19 14:00:04 +00:00
|
|
|
{
|
1996-06-27 07:15:21 +00:00
|
|
|
void* mem = (void*)malloc(size);
|
1994-08-12 10:52:49 +00:00
|
|
|
if (mem == NULL)
|
|
|
|
fatal_box("Out of memory: can't allocate %u bytes", size);
|
1995-11-17 10:29:45 +00:00
|
|
|
|
1994-09-27 10:12:15 +00:00
|
|
|
return mem;
|
1994-08-12 10:52:49 +00:00
|
|
|
}
|
1996-02-05 19:00:53 +00:00
|
|
|
// @doc EXTERNAL
|
1994-08-12 10:52:49 +00:00
|
|
|
|
1996-01-31 17:19:02 +00:00
|
|
|
// @func Operatore per la distruzione di un oggetto (sostituisce operatore C++)
|
|
|
|
void operator delete(
|
|
|
|
void* ptr) // @parm Puntatore all'oggetto da distruggere
|
|
|
|
|
|
|
|
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
|
1996-05-08 11:09:13 +00:00
|
|
|
// in linea del C++.
|
1996-01-31 17:19:02 +00:00
|
|
|
// <nl>Nel caso venga passato un puntatore NULL viene emesso un <f CKECK>.
|
|
|
|
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
|
|
|
|
|
1994-08-12 10:52:49 +00:00
|
|
|
{
|
1995-01-19 14:00:04 +00:00
|
|
|
CHECK(ptr, "Can't delete a NULL pointer");
|
|
|
|
free(ptr);
|
1994-08-12 10:52:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // FOXPRO
|
1995-01-24 08:52:49 +00:00
|
|
|
|
|
|
|
|