⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ibase.h

📁 East make Tray Icon in delphi
💻 H
📖 第 1 页 / 共 5 页
字号:
/*
 *	MODULE:		ibase.h
 *	DESCRIPTION:	OSRI entrypoints and defines
 *
 * The contents of this file are subject to the Interbase Public
 * License Version 1.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy
 * of the License at http://www.Inprise.com/IPL.html
 *
 * Software distributed under the License is distributed on an
 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code was created by Inprise Corporation
 * and its predecessors. Portions created by Inprise Corporation are
 * Copyright (C) Inprise Corporation.
 *
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 * Added TCP_NO_DELAY option for superserver on Linux
 * FSG 16.03.2001
 * 2001.07.28: John Bellardo:  Added blr_skip
 * 2001.09.18: Ann Harrison:   New info codes
 * 17-Oct-2001 Mike Nordell: CPU affinity
 * 2001-04-16 Paul Beach: ISC_TIME_SECONDS_PRECISION_SCALE modified for HP10
 * Compiler Compatibility
 */
/*
$Id: ibase.h,v 1.1 2003/06/23 21:09:24 peter3 Exp $
 *
 * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
 *                          - EPSON, XENIX, MAC (MAC_AUX), Cray and OS/2
 *
 */

#ifndef JRD_IBASE_H
#define JRD_IBASE_H


#ifndef CONST
#define CONST const
#endif


#if (defined(_MSC_VER) && defined(_WIN32)) || \
    (defined(__BORLANDC__) && defined(__WIN32__))
#define  GDS_EXPORT	__stdcall
#else
#define  GDS_EXPORT
#endif

#ifndef GDS_FAR
#define GDS_FAR
#endif


#if (defined(__osf__) && defined(__alpha))
/* It appears the alpha has a 32 bit int and a 64 bit long. */
#define LONG_DEFINED
    typedef int SLONG;
    typedef unsigned int ULONG;

#define SQUAD_DEFINED
    typedef long SQUAD;
    typedef unsigned long UQUAD;
#define NATIVE_QUAD

#endif /* DEC osf */



/* Basic data types */


typedef char SCHAR;
typedef unsigned char UCHAR;
typedef short SSHORT;
typedef unsigned short USHORT;


#ifndef LONG_DEFINED			/* 32 bit */
typedef long SLONG;
typedef unsigned long ULONG;
#else
#undef LONG_DEFINED
#endif


#ifndef SQUAD_DEFINED			/* 64 bit */
typedef struct {
	SLONG high;
	ULONG low;
} SQUAD;
#endif


#ifndef DEFINED_GDS_QUAD
#define DEFINED_GDS_QUAD
struct GDS_QUAD_t {
	SLONG gds_quad_high;
	ULONG gds_quad_low;
};

typedef struct GDS_QUAD_t GDS_QUAD;

#endif /* DEFINED_GDS_QUAD */

//
// TMN: some misc data types from all over the place
//
struct vary
{
	SSHORT vary_length;
	char   vary_string[1];
};
// TMN: Currently we can't do this, since remote uses a different
// definition of VARY than the rest of the code! :-<
//typedef vary* VARY;

struct lstring
{
	ULONG	lstr_length;
	ULONG	lstr_allocated;
	UCHAR*	lstr_address;
};
typedef struct lstring LSTRING;


typedef unsigned char BOOLEAN;
typedef char TEXT;				/* To be expunged over time */
typedef unsigned char STEXT;	/* Signed text - very rare */
typedef unsigned char UTEXT;	/* Unsigned text - common */
typedef unsigned char BYTE;		/* Unsigned byte - common */
typedef char SBYTE;				/* Signed byte - rare usage */
typedef long STATUS;
typedef long IPTR;
typedef unsigned long U_IPTR;
typedef void (*FPTR_VOID) ();
typedef void (*FPTR_VOID_PTR) (void *);
typedef int (*FPTR_INT) ();
typedef int (*FPTR_INT_VOID_PTR) (void *);
typedef ULONG RCRD_OFFSET;
typedef USHORT FLD_LENGTH;


#define GDS_TRUE	1
#define GDS_FALSE	0

#if !(defined __cplusplus)
#define GDS__TRUE	GDS_TRUE
#define GDS__FALSE	GDS_FALSE
#endif

/* We can remove these three #defines if we change gdsold.h and gen/codes.h */
#define GDS_LONG SLONG
#define GDS_ULONG ULONG

#define GDS_STATUS	long


#define isc_version4

#define  ISC_TRUE	1
#define  ISC_FALSE	0
#if !(defined __cplusplus)
#define  ISC__TRUE	ISC_TRUE
#define  ISC__FALSE	ISC_FALSE
#endif

#if (defined __osf__ && defined __alpha)
#define  ISC_LONG	int
#define  ISC_ULONG	unsigned int
#else
#define  ISC_LONG	signed long
#define  ISC_ULONG	unsigned long
#endif

#define  ISC_SHORT	signed short
#define  ISC_USHORT	unsigned short
#define  ISC_STATUS	long

#define ISC_UCHAR	unsigned char

#define  DSQL_close     1
#define  DSQL_drop      2


/******************************************************************/
/* Define type, export and other stuff based on c/c++ and Windows */
/******************************************************************/

#define ISC_EXPORT GDS_EXPORT
#define ISC_FAR

#if (defined(_MSC_VER) && defined(_WIN32)) || \
    (defined(__BORLANDC__) && defined(__WIN32__))
#  define  ISC_FAR
#  define  ISC_EXPORT_VARARG	__cdecl
	typedef __int64 ISC_INT64;
	typedef unsigned __int64 ISC_UINT64;
#  define  ISC_INT64_DEFINED
#else /* Not Windows*/
#   define  ISC_EXPORT_VARARG
#endif /* Windows/NT */

/*******************************************************************/
/* 64 bit Integers                                                 */
/*******************************************************************/

#ifdef  ISC_INT64_DEFINED
#undef  ISC_INT64_DEFINED
#else
typedef long long int			ISC_INT64;
typedef unsigned long long int	ISC_UINT64;
#endif

/*******************************************************************/
/* Time & Date Support                                             */
/*******************************************************************/

#ifndef ISC_TIMESTAMP_DEFINED
typedef long			ISC_DATE;
typedef unsigned long	ISC_TIME;
typedef struct
{
	ISC_DATE timestamp_date;
	ISC_TIME timestamp_time;
} ISC_TIMESTAMP;
#define ISC_TIMESTAMP_DEFINED
#endif	/* ISC_TIMESTAMP_DEFINED */

#define ISC_TIME_SECONDS_PRECISION          10000L
#define ISC_TIME_SECONDS_PRECISION_SCALE    (-4)

/*******************************************************************/
/* Blob id structure                                               */
/*******************************************************************/

#if !(defined __cplusplus)
typedef GDS_QUAD GDS__QUAD;
#endif /* !(defined __cplusplus) */

typedef struct GDS_QUAD_t ISC_QUAD;


typedef struct
{
	short array_bound_lower;
	short array_bound_upper;
} ISC_ARRAY_BOUND;

typedef struct
{
	unsigned char	array_desc_dtype;
	char			array_desc_scale;
	unsigned short	array_desc_length;
	char			array_desc_field_name[32];
	char			array_desc_relation_name[32];
	short			array_desc_dimensions;
	short			array_desc_flags;
	ISC_ARRAY_BOUND	array_desc_bounds[16];
} ISC_ARRAY_DESC;

typedef struct
{
	short			blob_desc_subtype;
	short			blob_desc_charset;
	short			blob_desc_segment_size;
	unsigned char	blob_desc_field_name[32];
	unsigned char	blob_desc_relation_name[32];
} ISC_BLOB_DESC;



/***************************/
/* Blob control structure  */
/***************************/

typedef struct isc_blob_ctl
{
	ISC_STATUS	(ISC_FAR* ctl_source)();	/* Source filter */
	struct isc_blob_ctl ISC_FAR*	ctl_source_handle;	/* Argument to pass to source filter */
	short					ctl_to_sub_type;		/* Target type */
	short					ctl_from_sub_type;		/* Source type */
	unsigned short			ctl_buffer_length;		/* Length of buffer */
	unsigned short			ctl_segment_length;		/* Length of current segment */
	unsigned short			ctl_bpb_length;			/* Length of blob parameter  block */
	char ISC_FAR*			ctl_bpb;				/* Address of blob parameter block */
	unsigned char ISC_FAR*	ctl_buffer;				/* Address of segment buffer */
	ISC_LONG				ctl_max_segment;		/* Length of longest segment */
	ISC_LONG				ctl_number_segments;	/* Total number of segments */
	ISC_LONG				ctl_total_length;		/* Total length of blob */
	ISC_STATUS ISC_FAR*		ctl_status;				/* Address of status vector */
	long					ctl_data[8];			/* Application specific data */
} ISC_FAR* ISC_BLOB_CTL;

/***************************/
/* Blob stream definitions */
/***************************/

typedef struct bstream
{
	void ISC_FAR*	bstr_blob;		/* Blob handle */
	char ISC_FAR*	bstr_buffer;	/* Address of buffer */
	char ISC_FAR*	bstr_ptr;		/* Next character */
	short			bstr_length;	/* Length of buffer */
	short			bstr_cnt;		/* Characters in buffer */
	char			bstr_mode;		/* (mode) ? OUTPUT : INPUT */
} BSTREAM;

/* Three ugly macros, one even using octal radix... sigh... */
#define getb(p)	(--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p))
#define putb(x,p) (((x) == '\n' || (!(--(p)->bstr_cnt))) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x))))
#define putbx(x,p) ((!(--(p)->bstr_cnt)) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x))))


/********************************************************************/
/* CVC: Public blob interface definition held in val.h.             */
/* For some unknown reason, it was only documented in langRef       */
/* and being the structure passed by the engine to UDFs it never    */
/* made its way into this public definitions file.                  */
/* Being its original name "blob", I renamed it blobcallback here.  */
/* I did the full definition with the proper parameters instead of  */
/* the weak C declaration with any number and type of parameters.   */
/* Since the first parameter -BLB- is unknown outside the engine,   */
/* it's more accurate to use void* than int* as the blob pointer    */
/********************************************************************/

#if !defined(_JRD_VAL_H_) && !defined(REQUESTER)
/* Blob passing structure */

enum lseek_mode {blb_seek_relative = 1, blb_seek_from_tail = 2};

typedef struct blobcallback {
    short (ISC_FAR *blob_get_segment)
		(void ISC_FAR* hnd, unsigned char* buffer, ISC_USHORT buf_size, ISC_USHORT* result_len);
    void		ISC_FAR	*blob_handle;
    ISC_LONG	blob_number_segments;
    ISC_LONG	blob_max_segment;
    ISC_LONG	blob_total_length;
    void (ISC_FAR *blob_put_segment)
		(void ISC_FAR* hnd, unsigned char* buffer, ISC_USHORT buf_size);
    ISC_LONG (ISC_FAR *blob_lseek)
		(void ISC_FAR* hnd, ISC_USHORT mode, ISC_LONG offset);
} ISC_FAR *BLOBCALLBACK;
#endif /* !defined(_JRD_VAL_H_) && !defined(REQUESTER) */



/********************************************************************/
/* CVC: Public descriptor interface held in dsc.h.                  */
/* We need it documented to be able to recognize NULL in UDFs.      */
/* Being its original name "dsc", I renamed it paramdsc here.       */
/* Notice that I adjust to the original definition: contrary to     */
/* other cases, the typedef is the same struct not the pointer.     */
/* I included the enumeration of dsc_dtype possible values.         */
/* Ultimately, dsc.h should be part of the public interface.        */
/********************************************************************/

#if !defined(_JRD_DSC_H_)
/* This is the famous internal descriptor that UDFs can use, too. */
typedef struct paramdsc {
    unsigned char	dsc_dtype;
    signed char		dsc_scale;
    ISC_USHORT		dsc_length;
    short		dsc_sub_type;
    ISC_USHORT		dsc_flags;
    unsigned char	*dsc_address;
} PARAMDSC;

#if !defined(_JRD_VAL_H_)
/* This is a helper struct to work with varchars. */
typedef struct paramvary {
    ISC_USHORT		vary_length;
    unsigned char	vary_string [1];
} PARAMVARY;
#endif /* !defined(_JRD_VAL_H_) */

/* values for dsc_flags */
/* Note: DSC_null is only reliably set for local variables
   (blr_variable) */
#define DSC_null		1
#define DSC_no_subtype		2	/* dsc has no sub type specified */
#define DSC_nullable  		4	/* not stored. instead, is derived
                                	from metadata primarily to flag
                                 	SQLDA (in DSQL)               */

/* Overload text typing information into the dsc_sub_type field.
   See intl.h for definitions of text types */ 

#ifndef dsc_ttype
#define dsc_ttype	dsc_sub_type
#endif


/* Note that dtype_null actually means that we do not yet know the
   dtype for this descriptor.  A nice cleanup item would be to globally
   change it to dtype_unknown.  --chrisj 1999-02-17 */

#define dtype_null	0
#define dtype_text	1
#define dtype_cstring	2
#define dtype_varying	3

#define dtype_packed	6
#define dtype_byte	7
#define dtype_short	8

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -