tldm-universe/Ardent/UV/gcidir/include/uv.h

584 lines
17 KiB
C
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
#ifndef h_uv
#define h_uv
/******************************************************************************
*
* Top level include file for all UniVerse programs
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software, Inc.
* The copyright notice above does not evidence any actual or intented
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 08/11/99 24446 SAP Port Linux to 9.5.1
* 05/05/99 24375 RGA Add extern decl. for lseek64 for IBMrios.
* 10/14/98 23801 SAP Change copyrights.
* 08/25/98 23601 SAP Dont declare mem... routines on Solaris
* 06/05/98 19540 JSM Change BASIC, RAID and VLIST to use common SRCLEN
* definition for maximum source line length
* 07/16/98 23371 SAP Port 9.5.1 to DEC_ALPHA
* 06/25/98 23062 SAP Do not declare memchr on IBMrios - 4.3.1 & up only.
* 06/16/98 23063 SAP Port 9.5.1 to HP-UX 11.0
* 06/08/98 23062 SAP Port 9.5.1 to AIX 4.3
* 05/18/98 20094 KAM Reinclude fix to not include MIN/MAX in NOT_FATAL
* 05/04/98 22939 WSM Fix read() and write() declarations for HPUX
* 04/13/98 22887 SAP Define lseek as off_t instead of long (SGI).
* 10/21/97 21661 SAP Port 9.4.1.3 to SGI 6.2.
* 07/24/97 20094 DTM Backed out change for now...
* 06/30/97 20060 SAP Fixed memory declarations for the SCO386
* 06/19/97 20049 PEJ Define memrcpy as memmove for HPUX90 builds
* 06/16/97 20094 KAM Fixed NOT_FATAL to not include MIN and MAX
* 04/18/97 20049 PEJ Fixed ACCESS_H for build on HPUX 9.04, 10.01
* 04/14/97 20049 SAP Fix previous change for HPUX90
* 04/11/97 20049 SAP Inconsistent type declaration, "lseek" on HP.
* 10/31/96 19553 ALC On PowerPC (NT) memchr() failing to identify marks
* 09/10/96 19148 SAP Port release 8 to the ICL
* 08/18/96 18335 MAA Ported release 9 to the SNI
* 06/28/96 18614 PEJ Added missing brackets to PATHSEP
* 05/26/96 18162 MJC Added 50015 QUIT_IN_SQLPROC
* 05/15/96 18442 AGM Added comment about version number changes
* 05/22/96 18423 GMM Moved Iflags/Icritical/Ienable etc out into iflags.h
* 05/22/96 18747 AGM Add tokens for init/fin termination mode
* 05/21/96 18162 MJC Add defines for fatal 50012, 50013, 50014
* 05/02/96 18403 DTM Added information for deadlock detection
* 04/11/96 18088 JJV Added has_Drive_Path macro.
* 02/13/96 17804 GMM Added new versions of absolute pathname macros
* 12/24/95 17813 TMC Change copyright to 1996
* 12/24/95 17813 TMC Fix Uvrevision for release 9
* 10/26/95 17555 NXC Port to UNIVEL.
* 08/18/95 16881 PGW Added PRINTCR and PRINTFF for Windows NT port
* 07/14/95 16881 PGW Added PRINTTEXT and CHECKCHAN for Windows NT port
* 08/17/95 17197 AGM Add Windows 95 support
* 08/23/95 17242 AGM Replace COMPUTER==WINNT test by MSWIN test
* 07/11/95 16824 SJM Use a function to redirect getc on NT
* 06/22/95 16666 MJC change CHECK_FATAL to NOT_FATAL
* 06/21/95 16666 MJC fix 50009
* 06/20/95 16666 MJC Added CHECK_FATAL Error macro and message defines
* 06/06/95 16550 MK Added Macro to check for valid path seperators.
* 06/06/95 15077 GMM Added Is_Absolute_Path OS-dependant macro.
* 05/18/95 16358 AGM Fix Icritical definition for WINNT DLL redirection
* 05/24/95 16554 RM Protect Ienable macro from dubious coding
* 05/11/95 16358 AGM Don't do signal redefinition on WINNT
* Change definition of Iflags it not in DLL
* 04/12/95 16313 SJM Added interrupt and signal handling code for NT
* 04/10/95 16244 GMM Added definition for uv_ino_t
* 05/03/95 16466 FRA Port to AViiONX86
* 03/27/95 16233 DTM Removed references to XUVSERVER
* 03/24/95 16221 AGM Don't declare str routines on NT
* 02/28/95 15928 AGM Correct include of nt.h
* 02/21/95 16008 FRA Port DG I/O optimizations (FiiRESTORM II)
* 12/20/94 15077 GMM Added changes for NT platform
* 01/05/95 15676 AGM Tidied up handling of ClearCase
* 11/21/94 14969 TMC Fix Uvrevision for release 8
* 11/15/94 15078 SJM Changed for smp processing for new build.
* 10/05/94 14842 SPR Included semset changes on the AViiON only
* 08/26/94 14782 SPR Port of FiiRESTORM general purpose optimizations to
* release 8.
* 04/06/94 13554 SPR Corrected typo in the pre-processor rules for
* memccpy().
* 01/06/94 12811 SPR Commented out memory declarations for the pyramips.
* 11/29/93 12569 SPR Commented out memory declarations for the DEC5400.
* 11/02/93 5595 JBG Added strScat()
* 10/29/93 12282 SPR Changed STR4 to SVR4.
* 06/30/93 11749 FAI Port to FTX 2.2.
* 04/21/93 11328 MAA Port newlook 1.3.2.2 to the enc88k.
* 03/22/93 11164 DWT Port 6.3.4.2 to tandem.
* 03/09/93 11172 FAI Port to ICL.
* 12/17/92 10751 FAI Port to Solaris.
* 12/08/92 10693 DTM Made changes for Xuvserver
* 08/10/92 10004 TMC added platform names to what strings
* 01/17/92 8990 MAA Made SYSV systems use sigset instead of signal.
* 10/31/91 8657 JSM Added ISSYSDEL
* 10/01/91 8657 JSM Added SQLNUL and ISSQLNUL
* 08/15/91 8583 DTM Changes for Xuv server
* 08/01/91 8583 DTM Fixed FTEXT for xuv stuff
* 07/29/91 8597 MAA Removed references to COMPUTER ENCORE.
* 07/26/91 8583 DTM Modified FTEXT, and created FTEXT2
* 11/30/90 7800 FAI Fixed memchr() call for AViiON.
* 07/28/90 7324 JWT fixed malloc documentation
* 05/14/90 7091 TMC change typo from singal to signal in #define
* 03/19/90 6937 TMC changed STRchr() define to typecast arg 2 to (char)
* 02/26/90 6897 FAI Change 2nd arg. in memchr() to type int.
* 02/14/90 6246 FAI Make FTEXT check for positive length.
* 09/20/89 6184 JSM Made Ienable and Idisable marcos
* 06/28/89 6077 GPS TCP/IP networking additions for Eurotech
* 06/23/89 6092 GPS Correctd sytax error in _MODULE_
* 03/24/89 5844 PHH TRIM speed enhancement
* 02/03/89 5748 JSM Use memrcpy instead of memcpy with ALIGN_OK
* 01/28/89 5739 JWT New include file mapping scheme
* 01/21/89 5720 DTW define MODULE for unsccs files
*
*****************************************************************************/
/* WINNT is a macro that is replaced during smp processing */
#define COMPUTER WINNT
#include <nt.h>
#include <stdio.h>
#if COMPUTER == ICL
#if defined(uv_list_readu)
#define _KMEMUSER
#endif
#endif
#include <sys/types.h>
#if COMPUTER == ICL
#if defined(uv_list_readu)
#undef _KMEMUSER
#endif
#endif
#include "hardware.h"
#include "include.h"
#include STDLIB_H
#if COMPUTER == HP
#include ACCESS_H
#endif
#if COMPUTER == LINUX
#include <errno.h>
#endif
/*
* define the universe version of an ino_t type
*/
typedef unsigned int uv_ino_t;
#ifdef DGUX
#define semset (*semfptr)
#endif
/*
* The following macro is used to see if a file pathname has a DOS
* drive letter on the front.
*/
#define has_Drive_Path(filepath) \
((*(filepath)) && ((filepath)[0] != '\\') && ((filepath)[0] != '/') && ((filepath)[1] == ':'))
/*
* define what defines an absolute pathname for each platform (we need both
* to available to both platform types)
*
* on NT we must allow for both driver letter and UNC pathnames
* on UNIX we just have the first character being '/'
*/
#define Mswin_Absolute_Path(filepath) \
((*(filepath)) && \
(((filepath)[1] == ':') || \
((((filepath)[0] == '\\') || ((filepath)[0] == '/')) && \
(((filepath)[1] == '\\') || ((filepath)[1] == '/')))))
#define Unix_Absolute_Path(filepath) \
((filepath)[0] == '/')
/*
* now the generic macro for the given platform
*/
#ifdef MSWIN
#define Is_Absolute_Path(filepath) Mswin_Absolute_Path(filepath)
#else
#define Is_Absolute_Path(filepath) Unix_Absolute_Path(filepath)
#endif
#ifdef FASTIO
#define PREAD(w,x,y,z) pread(w,x,y,z)
#define PWRITE(w,x,y,z) pwrite(w,x,y,z)
#define FASTREAD(w,x,y,z) retry = 10;\
while (retry--)\
{ v = PREAD(w,(char *)x,y,z);\
if (v != y && errno == EINTR);\
else break;\
}
#define FASTREAD2(w,x,y,z,zz) retry = 10;\
while (retry--)\
{ zz = PREAD(w,(char *)x,y,z);\
if (zz != y && errno == EINTR);\
else break;\
}
#define FASTWRITE(w,x,y,z) retry = 10;\
while (retry--)\
{ v = PWRITE(w,(char *)x,y,z);\
if (v != y && errno == EINTR);\
else break;\
}
#define FASTWRITE2(w,x,y,z,zz) retry = 10;\
while (retry--)\
{ zz = PWRITE(w,(char *)x,y,z);\
if (zz != y && errno == EINTR);\
else break;\
}
#endif
EXTERN void Ikill();
#ifdef MSWIN
EXTERN int uvnt_fgetc(FILE *);
EXTERN char *uvnt_fgets(char *,int,FILE *);
EXTERN int uvnt_ungetc(int,FILE *);
/* yuk, we need to redefine some standard macros so that in certain
circumstances they can be made interruptable. They have to be
here because they need to be after stdio.h */
#undef getc
#define getc(stream) uvnt_fgetc(stream)
#undef getchar
#define getchar() uvnt_fgetc(stdin)
/* These operations are defined to be functions and not macros,
Redefining like this wont help if you want to take a pointer
to it, but it will stop any macro side effects */
#define fgetc(stream) uvnt_fgetc(stream)
#define fgetchar() uvnt_fgetc(stdin)
#define fgets(str,n,stream) uvnt_fgets(str,n,stream)
#define gets(str) uvnt_fgets(str,-1,stdin)
#define ungetc(c,stream) uvnt_ungetc(c,stream)
#endif
/*
* Note: Definition of the UniVerse version number has moved to the
* include file UVERSION.h
*/
#include "UVERSION.h"
#if SPECIAL && defined(__MODULE__) && defined(__SCCSID__)
PRI_RO char _What[] = "%Z%__MODULE__\t__SCCSID__";
#endif
/*
The following variables are never used, they are simply placed in
various executables to ensure that there is a copyright in them
somewhere. As Windows has a formal mechanism for doing this (using
'resources', we do not include them in the Windows platforms.
*/
#if defined(__ISMAIN__) && !defined(MSWIN)
PRI_RO char _UVversion[] = UV_VERSION_STRING;
PRI_RO char _UVplatform[] = WHAT_NAME;
PRI_RO char _Copyright[] = UV_COPYRIGHT_STRING;
#endif
#if SYSintr
# if LOCKING != 2
# define locking SYSlock
# endif
# define lseek SYSlseek
# define msgrcv SYSmsgr
# define msgsnd SYSmsgs
# define open SYSopen
# define read SYSread
# define semop SYSsemop
# define signal SYSsignal
# define wait SYSwait
# define write SYSwrite
extern long SYSlseek();
extern int SYSread(),SYSwrite();
#else
# if NETwork == OMNI
# define lseek(x,y,z) SYSlseek(x,y,z)
# define read(x,y,z) SYSread(x,y,z)
# define write(x,y,z) SYSwrite(x,y,z)
extern long SYSlseek();
extern int SYSread(),
SYSwrite();
# else
# ifndef MSWIN
# if COMPUTER == SGI || COMPUTER == HP && !defined(HPUX90)
extern off_t lseek();
# else
extern long lseek();
# endif
# if COMPUTER == HP && !defined(HPUX90)
extern ssize_t read(),write();
# else
# if !defined(HPUX11)
extern int read(),write();
# endif
# endif
# if SIG_ucb == 0 || SIG_ucb == 3
/*
* System V signals are not safe and so sigset (2)
* should be used. Without this there is a race in
* error.c in errortrap(), errorexit(), errorabort(),
* errorciritical(), errorfpe() and errorignore() as
* they try to re-establish the signal handler in
* the face of incoming repeated signals.
*/
# if COMPUTER == SCO386
/* work around SCO cpp bug */
# define signal(x,y) sigset(x,y)
# else
# define signal sigset
# endif
# endif
# endif
# endif
#endif
#include "typedef.h"
#include "param.h"
#include "uvmalloc.h"
#include "chars.h"
/*
* We define a macro here to deal with file seperators. On NT we allow both
* forward slash and back slash. On UNIX we allow only forward slashes
*/
#ifdef MSWIN
#define PATHSEP(ch) ( (ch) == '/' || (ch) == '\\' )
#else
#define PATHSEP(ch) ( (ch) == '/' )
#endif
#if MALLOC_TRACING & M_MAP
# ifndef __MODULE__
# define __MODULE__ "notsccs"
# endif
#endif
/*
this turns on the 'wide zero' checking so that
*/
#define WIDE_0 1
#if MEMfunc
#ifdef SVR4
# define STRchr(x, c) (void*)memchr((void*)(x).text, \
(int)(c), (x).len)
#else
#ifdef MSWIN
# define STRchr(x, c) (uchar*)memchr((char*)(x).text, \
(unsigned)(c), (x).len)
#else
# define STRchr(x, c) (uchar*)memchr((char*)(x).text, \
(int)((char)c), (x).len)
#endif
#endif
#else
extern uchar *STRchr();
#endif
#ifdef NO_MEM_DECL
#if defined( HPUX90 )
/* Use memmove() on systems with no memrcpy() */
#define memrcpy(x, y, z) memmove(x, y, z)
#endif
#else
#if MEMbcps && !ALIGN_OK
# define memrcpy(x, y, z) memcpy((x), (y), (z))
#else
# if MEMfunc == 2 || MEMfunc == 3
# if COMPUTER == RM600
# define memcpy(x, y, z) memmove(x, y, z)
# define memrcpy(x, y, z) memmove(x, y, z)
# else
# ifndef DGUX
# if COMPUTER != DEC_ALPHA
# define memcpy(x, y, z) bcopy(y, x, z)
# endif
# endif
# define memrcpy(x, y, z) bcopy(y, x, z)
# endif
# endif
#endif
#endif
#if INDEXfn
# define strchr(x, y) index(x, y)
# define strrchr(x, y) rindex(x, y)
extern char *index(),
*rindex();
#else
#if COMPUTER != IBMrios
# define index(x, y) strchr(x, y)
# define rindex(x, y) strrchr(x, y)
#endif
#endif
#if COMPUTER == IBMrios
extern off64_t lseek64();
#endif
#ifndef MSWIN
extern char *strcat(),
*strcpy(),
*strncpy(),
*strncat();
#endif
#ifndef NO_MEM_DECL
#if COMPUTER != DEC5400 && COMPUTER != PYR_DCOSX && COMPUTER != UNIVEL && COMPUTER != RM600 && COMPUTER != SCO386 && COMPUTER != SGI && COMPUTER != HP && COMPUTER != IBMrios && COMPUTER != Solaris
#if MEMfunc == 0 || MEMfunc == 1 || MEMbpcs == 1
extern char *memcpy();
#endif
extern char *memccpy(),
*memchr(),
*memset();
extern int memcmp();
#endif
#endif
extern int STRcmp();
extern STRING STRcat(),
STRcpy(),
STRncat(),
STRncpy(),
STRtoa(),
STRtoa(),
STRtoe(),
STRtok(),
STRtoq();
extern char *STRscpy(),
*STRtstr();
extern STRING strScpy(),
strScat(),
strtSTR();
/* this definition is complicated by the fact that itoa and ltoa
may already be defined in system header files */
#undef itoa
#undef ltoa
extern STRING uvitoa();
extern STRING uvltoa();
#define itoa uvitoa
#define ltoa uvltoa
#define itoSTR uvitoa
#define ltoSTR uvltoa
extern int STRtoi();
extern long STRtol();
#if !VFORKfn
# define vfork fork
#endif
#if LOCKING == 2
# define locking lockf
#endif
#if GTWDucb
# define getcwd(x, y) getwd(x)
#endif
#define DBgetfile(x, y, z) DBkeyfile(x, y, z, (int*)0)
#define DBclearf(x) DBclrfl(x,1)
#define SM (uchar)CHR_377
#define AM (uchar)CHR_376
#define VM (uchar)CHR_375
#define SVM (uchar)CHR_374
#define TM (uchar)CHR_373
#define STM (uchar)CHR_372
#define SYSDEL (uchar)CHR_370
#define SQLNUL (uchar)CHR_200
#define SRCLEN 8192
#define ISSQLNUL(s) (((s).len == 1) && ((s).text[0] == SQLNUL))
#define ISSYSDEL(s) (((s).len == 1) && ((s).text[0] >= SYSDEL))
#define FTEXT(f, s) if ((s).len > 0) (void)fwrite((char*)(s).text, sizeof(uchar), (s).len, f)
#ifdef MSWIN
EXTERN void Ptext();
EXTERN void Ptext_endline();
EXTERN void Ptext_newpage();
EXTERN int Ptext_check();
#define PRINTTEXT(a, b, c) Ptext(a, b, c)
#define PRINTCR(a, b) Ptext_endline(a, b)
#define PRINTFF(a, b) Ptext_newpage(a, b)
#define CHECKCHAN(a, b) Ptext_check(a, b)
#else
#define PRINTTEXT(a, b, c) FTEXT((b)->fptr, c)
#define PRINTCR(a, b) FTEXT((b)->fptr, (a)->cr)
#define PRINTFF(a, b) FTEXT((b)->fptr, (a)->ff)
#define CHECKCHAN(a, b) MFcheck(b)
#endif
EXTERN STRING trim(),
trimf(),
trimb();
extern void fatal(),
mfatal(),
ifatal(),
xfatal(),
ofatal(),
fatal_error(),
warning(),
mwarning(),
printmsg(),
Pprintmsg(),
fmtprint(),
dfmtprint(),
ffmtprint(),
Pfmtprint(),
fin(),
fin2(),
init();
/* Tokens to use when calling init(), controling how fin() terminates */
#define UVFIN_NORMAL 0 /* Default - exit process */
#define UVFIN_KILL_THREAD 1 /* Terminate the current thread */
#define UVFIN_RAISE_EXCEPTION 2 /* Raise an exception in current thread */
/* Other tokens... */
#define FATAL_ERROR_MIN 50000
#define USER_QUIT_KEY 50000
#define USER_ABORT_KEY 50001
#define ABORT_LOGIN_CMD 50002
#define LOGOUT_CMD 50003
#define PROC_PW_NO_CMD 50004
#define AUTO_LOGOFF 50005
#define LOGTO_ABORT_FAILED 50006
#define BASIC_CHAIN_TO_PROC 50007
#define BASIC_ABORT_STMT 50009
#define AVAIL_MEM_EXCEEDED 50010
#define DEADLATCH_DETECTED 50011
#define INPUT_AT_IN_SQLPROC 50012
#define KEYIN_IN_SQLPROC 50013
#define INPUT_IN_SQLPROC 50014
#define QUIT_IN_SQLPROC 50015
#define END_OF_TERM_DATA 50020
#define FATAL_ERROR_MAX 50020
#define NOT_FATAL(errnum) ((errnum) < FATAL_ERROR_MIN || (errnum) > FATAL_ERROR_MAX)
#endif /* end of uv.h */