This page is available in: en

3.1.1 General Data Types


typedef	char	B;	/* signed 8-bit integer */
typedef	short	H;	/* signed 16-bit integer */
typedef	int	W;	/* signed 32-bit integer */
typedef	unsigned char	UB;	/* unsigned 8-bit integer */
typedef	unsigned short	UH;	/* unsigned 16-bit integer */
typedef	unsigned int	UW;	/* unsigned 32-bit integer */
typedef	char	VB;	/* 8-bit data without a fixed type */
typedef	short	VH;	/* 16-bit data without a fixed type */
typedef	int	VW;	/* 32-bit data without a fixed type */
typedef	void	*VP;	/* pointer to data without a fixed type */
typedef	volatile B	_B;	/* volatile declaration */
typedef	volatile H	_H;
typedef	volatile W	_W;
typedef	volatile UB	_UB;
typedef	volatile UH	_UH;
typedef	volatile UW	_UW;
typedef	int	INT;	/* signed integer of processor bit width*/
typedef	unsigned int	UINT;	/* unsigned integer of processor bit width*/
typedef	INT	ID;	/* general ID */
typedef	INT	MSEC;	/* general time (milliseconds)*/
typedef	void	(*FP)();	/* general function address */
typedef	INT	(*FUNCP)();	/* general function address */
#define	LOCAL	static	/* local symbol definition */
#define	EXPORT		/* global symbol definition */
#define	IMPORT	extern	/* global symbol reference */
/*
*Boolean	values
*	TRUE = 1 is defined, but any value other than 0 is TRUE.
* 	A decision such as bool == TRUE must be avoided for this reason.
* 	Instead use bool != FALSE.
*/
typedef INT	BOOL;
#define TRUE	1		/* True */
#define FALSE	0		/* False */
/*
* TRON character codes
*/ typedef UH	TC;	/* TRON character code */
#define TNULL	((TC)0)	/* TRON code string termination */
  • VB, VH, and VW di.er from B, H, and W in that the former mean only the bit width is known, not the contents of the data type, whereas the latter clearly indicate integer type.
  • Processor bit width must be 32 bits or above. INT and UINT must therefore always have a width of 32 bits or more.
  • BOOL de.nes TRUE = 1, but any value other than 0 is also TRUE. For this reason a decision such as
  • bool == TRUE must be avoided. Instead use bool != FALSE.

[Additional Notes]

Parameters such as stksz, wupcnt, and message size that clearly do not take negative values are also in principle signed integer (INT) data type. This is in keeping with the overall TRON rule that integers should be treated as signed numbers to the extent possible. As for the timeout (TMO tmout) parameter, its being a signed integer enables the use of TMO_FEVR(= .1) having special meaning. Parameters with unsigned data type are those treated as bit patterns (object attribute, event flag, etc.).

Comments