4200d83619
Corretta picture per numeri negativi Tolta xvt_fmalloc dal metodo new Controllati errori di scrittura in fcopy git-svn-id: svn://10.65.10.50/trunk@888 c028cbd2-c16b-5b4b-a496-9718f37d4682
104 lines
2.0 KiB
C++
Executable File
104 lines
2.0 KiB
C++
Executable File
#include <stdlib.h>
|
||
#include <stdio.h>
|
||
|
||
#define __STDTYPES_CPP
|
||
|
||
#include <extcdecl.h>
|
||
#include <conf.h>
|
||
#include <modaut.h>
|
||
|
||
#if XVT_OS != XVT_OS_SCOUNIX
|
||
#include <dos.h>
|
||
#include <hlapi_c.h>
|
||
#endif
|
||
|
||
#include <checks.h>
|
||
#include <isam.h>
|
||
#include <prefix.h>
|
||
|
||
#define REFKEY "CAMPOKEY"
|
||
#define VERKEY "ìpÙˆ¬cê<"
|
||
|
||
long stdlevel ;
|
||
|
||
int get_serial_number()
|
||
{
|
||
#if XVT_OS != XVT_OS_SCOUNIX
|
||
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
|
||
if (status != STATUS_OK)
|
||
return -1;
|
||
#endif
|
||
return getser();
|
||
}
|
||
|
||
void init_global_vars()
|
||
{
|
||
CHECK(prefhndl == NULL, "Can't init global vars two times");
|
||
prefhndl = new TPrefix;
|
||
|
||
// prefhndl->set("DEF");
|
||
prefhndl->set("");
|
||
stdlevel = prefhndl->filelevel();
|
||
|
||
FileDes d;
|
||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||
|
||
long maxfdir = d.EOX;
|
||
prefhndl->set("DEF");
|
||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
||
|
||
// isjournal = *((bool *) CGetConf(JOURNALING));
|
||
isjournal = FALSE;
|
||
|
||
openf = new isfdptr[maxfdir];
|
||
openrec = new TRectype*[maxfdir];
|
||
|
||
for (long i = 0; i < maxfdir; i++)
|
||
{
|
||
openf[i] = NULL;
|
||
openrec[i] = NULL;
|
||
}
|
||
|
||
#if XVT_OS == XVT_OS_SCOUNIX
|
||
const bool muflag = CGetAut(MUAUT);
|
||
if (SerNo /* && fexist("net.ini") */ && !muflag)
|
||
fatal_box("Abnormal termination: check protection or serial number\n");
|
||
#endif
|
||
}
|
||
|
||
void free_global_vars()
|
||
{
|
||
#if XVT_OS != XVT_OS_SCOUNIX
|
||
HL_LOGOUT();
|
||
#endif
|
||
if (prefhndl != NULL)
|
||
{
|
||
delete openf;
|
||
delete openrec;
|
||
delete prefhndl;
|
||
}
|
||
}
|
||
|
||
|
||
#ifndef FOXPRO
|
||
#include <xvt.h>
|
||
|
||
void* operator new(size_t size)
|
||
{
|
||
// void* mem = (void*)xvt_fmalloc(size);
|
||
void* mem = (void*)malloc(size);
|
||
if (mem == NULL)
|
||
fatal_box("Out of memory: can't allocate %u bytes", size);
|
||
return mem;
|
||
}
|
||
|
||
void operator delete(void* ptr)
|
||
{
|
||
CHECK(ptr, "Can't delete a NULL pointer");
|
||
// xvt_ffree((char*)ptr);
|
||
free(ptr);
|
||
}
|
||
|
||
#endif // FOXPRO
|