SDK Include File

From Recital Documentation Wiki
Jump to: navigation, search

The include file "dbapi.h" contains definitions of variable types, data structures and macro synonyms which are used by many of the Recital/API functions.

API Variable Types

TYPE NAME USED FOR DATATYPE
API_ATYPE Array variable int (512)
API_BOTTOM DBF_GOTO( API_BOTTOM ) int (-2)
API_CLASS User defined class (UDC) int (1)
API_CTYPE Character variable int (1)
API_DTYPE Date variable int (8)
API_FUNCTION User defined function (UDF) int (0)
API_LTYPE Logical variable int (4)
API_NTYPE Numeric variable int (2)
API_OTYPE Object variable int (256)
API_PRIVATE Private memory variable int (1)
API_PUBLIC Public memory variable int (1)
API_REFPAR Passed by reference with @ int (32)
API_TOP DBF_GOTO( API_TOP ) int (-1)
API_TTYPE DateTime variable int (64)
API_UTYPE Undefined variable int (0)
API_YTYPE Currency variable int (128)
CHARACTER Character string char
CURRENCY Recital currency Currency structure
DATE Recital date unsigned long
DATETIME Recital datetime DateTime structure
LOGICAL Logical data type int
MEMO Recital memo Operating system dependant
NUMERIC Numeric data type double
OBJARG Object argument Recital object argument format
OBJECT Recital object Pointer to an object


API Data Structures

The API_FUNCTION_TABLE data structure below is used to store information relating the C UDF to its name within Recital. This structure is used when statically linking in the function.


struct	API_FUNCTION_TABLE {
	char			*name;				/* Pointer to recital function name		*/
	int			(*address)();			/* Address of C support function		*/
};

The API_SHARED_FUNCTION_TABLE data structure below is used to store information relating the C UDF or UDC to its name within Recital. This structure is used when dynamically loading in the function or class.

struct	API_SHARED_FUNCTION_TABLE {
	char			*name;				/* Pointer to recital function name		*/
	char			*apiname;			/* Pointer to C support function name	*/
	int			type;				/* Function type 0 function 1 class		*/
};

The API_EXPRESSION_RESULT data structure below is used to store the result which is returned from the api_expression() function.

struct	API_EXPRESSION {
	int			errno;				/* RECITAL error() number			*/
	char			type;				/* Data type of result				*/
	int			width;				/* Width of result					*/
	int			decimal;				/* Decimal places					*/
	char			character;			/* CHARACTER result				*/
	double 		number;				/* NUMERIC RESULT				*/
	char			logical;				/* LOGICAL result					*/
	unsigned long	date;				/* Recital DATE result				*/
	DATETIME 	datetime;			/* DATETIME result					*/
	CURRENCY 	currency;			/* CURRENCY result					*/
};

The API_MEMVAR data structure below is used to describe the contents of a Recital memory variable.

union	API_UNION {
	char			*info_character;		/* Char memory variable				*/
	char			info_logical;			/* Logical memory variable			*/
	double		info_number;			/* Numeric memory variable			*/
	unsigned long	info_date;			/* Date memory variable				*/
	DATETIME	info_datetime;	 	/* DateTime memory variable			*/
	CURRENCY	info_currency;		/* Currency memory variable			*/
};


struct	API_MEMVAR {
	char			type;				/* Data type of the memory			*/
	union		API_UNION value;	/* Value of the memory variable		*/
	int			width;				/* Display width					*/
	int			decimal;				/* Display # of decimal places			*/
};

The API_FIELD data structure is used to describe the structure of a Recital field.

struct	API_FIELD {
    int			fieldno;				/* Field number					*/
    char		type;				/* Data type of field					*/
    int			size;				/* Storage size in the record			*/
    int			width;				/* Display width					*/
    int 			decimal;				/* # decimal places for numerics		*/
    char		*value;				/* Pointer to data in current record		*/
};