campo-sirio/include/stdtypes.cpp

99 lines
1.7 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdlib.h>
#include <stdio.h>
#define __STDTYPES_CPP
#include <extcdecl.h>
#include <lffiles.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 <prefix.h>
#include <isam.h>
#define REFKEY "CAMPOKEY"
#define VERKEY "ìpÙˆ¬cê<"
void init_global_vars()
{
#if XVT_OS != XVT_OS_SCOUNIX
HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
#endif
const int ws = getser();
if (ws < 0)
fatal_box("Perhaps you forgot to connect the dongle?");
CHECK(prefhndl == NULL, "Can't init global vars two times");
prefhndl = new TPrefix;
prefhndl->set("DEF");
prefhndl->set("");
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;
/*
char pd[64];
strcpy(pd, CInsPref("dta.gen", NORDIR));
CGetDitta(pd);
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
if ((SerNo) && (!CGetAut(MUAUT)))
fatal_box("Abnormal termination: check protection or serial number\n");
#endif
}
void free_global_vars()
{
#if XVT_OS != XVT_OS_SCOUNIX
HL_LOGOUT();
#endif
delete openf;
delete openrec;
delete prefhndl;
}
#ifndef FOXPRO
#include <xvt.h>
void* operator new(size_t size)
{
void* mem = (void*)xvt_fmalloc(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);
}
#endif // FOXPRO