qse/ase/awk/val.h

101 lines
2.0 KiB
C
Raw Normal View History

2006-03-03 11:45:45 +00:00
/*
2006-04-14 10:56:42 +00:00
* $Id: val.h,v 1.15 2006-04-14 10:56:42 bacon Exp $
2006-03-03 11:45:45 +00:00
*/
#ifndef _XP_AWK_VAL_H_
#define _XP_AWK_VAL_H_
#ifndef _XP_AWK_AWK_H_
#error Never include this file directly. Include <xp/awk/awk.h> instead
#endif
2006-03-04 15:54:37 +00:00
enum
{
2006-03-27 11:43:17 +00:00
XP_AWK_VAL_NIL = 0,
XP_AWK_VAL_INT = 1,
XP_AWK_VAL_REAL = 2,
2006-03-27 15:44:38 +00:00
XP_AWK_VAL_STR = 3,
XP_AWK_VAL_MAP = 4
2006-03-04 15:54:37 +00:00
};
2006-03-03 11:45:45 +00:00
typedef struct xp_awk_val_t xp_awk_val_t;
2006-03-07 15:55:14 +00:00
typedef struct xp_awk_val_nil_t xp_awk_val_nil_t;
2006-03-03 11:45:45 +00:00
typedef struct xp_awk_val_int_t xp_awk_val_int_t;
typedef struct xp_awk_val_real_t xp_awk_val_real_t;
typedef struct xp_awk_val_str_t xp_awk_val_str_t;
2006-03-27 15:44:38 +00:00
typedef struct xp_awk_val_map_t xp_awk_val_map_t;
2006-03-03 11:45:45 +00:00
#define XP_AWK_VAL_HDR \
2006-03-27 15:44:38 +00:00
int type: 3; \
int ref: 29
2006-03-03 11:45:45 +00:00
struct xp_awk_val_t
{
XP_AWK_VAL_HDR;
};
2006-03-07 15:55:14 +00:00
/* XP_AWK_VAL_NIL */
struct xp_awk_val_nil_t
{
XP_AWK_VAL_HDR;
};
2006-03-04 15:54:37 +00:00
/* XP_AWK_VAL_INT */
2006-03-03 11:45:45 +00:00
struct xp_awk_val_int_t
{
XP_AWK_VAL_HDR;
xp_long_t val;
};
2006-03-04 15:54:37 +00:00
/* XP_AWK_VAL_REAL */
2006-03-03 11:45:45 +00:00
struct xp_awk_val_real_t
{
XP_AWK_VAL_HDR;
xp_real_t val;
};
2006-03-04 15:54:37 +00:00
/* XP_AWK_VAL_STR */
2006-03-03 11:45:45 +00:00
struct xp_awk_val_str_t
{
XP_AWK_VAL_HDR;
xp_char_t* buf;
xp_size_t len;
};
2006-03-27 15:44:38 +00:00
/* XP_AWK_VAL_MAP */
struct xp_awk_val_map_t
{
XP_AWK_VAL_HDR;
2006-04-14 10:56:42 +00:00
/* xp_awk_vap_t vap; */
2006-03-27 15:44:38 +00:00
};
2006-03-04 15:54:37 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2006-03-07 15:55:14 +00:00
extern xp_awk_val_t* xp_awk_val_nil;
2006-03-27 11:43:17 +00:00
xp_awk_val_t* xp_awk_makeintval (xp_awk_t* awk, xp_long_t v);
2006-03-28 16:33:09 +00:00
xp_awk_val_t* xp_awk_makerealval (xp_awk_t* awk, xp_real_t v);
2006-03-05 17:07:33 +00:00
xp_awk_val_t* xp_awk_makestrval (const xp_char_t* str, xp_size_t len);
2006-04-06 16:25:37 +00:00
xp_awk_val_t* xp_awk_makestrval2 (
const xp_char_t* str1, xp_size_t len1,
const xp_char_t* str2, xp_size_t len2);
2006-04-14 10:56:42 +00:00
/*xp_awk_val_t* xp_awk_makemapval ();*/
2006-03-05 17:07:33 +00:00
2006-03-26 16:36:30 +00:00
xp_bool_t xp_awk_isbuiltinval (xp_awk_val_t* val);
2006-03-27 11:43:17 +00:00
void xp_awk_freeval (xp_awk_t* awk, xp_awk_val_t* val);
2006-03-23 13:26:04 +00:00
void xp_awk_refupval (xp_awk_val_t* val);
2006-03-27 11:43:17 +00:00
void xp_awk_refdownval (xp_awk_t* awk, xp_awk_val_t* val);
void xp_awk_refdownval_nofree (xp_awk_t* awk, xp_awk_val_t* val);
2006-03-23 13:26:04 +00:00
2006-03-27 11:43:17 +00:00
xp_awk_val_t* xp_awk_cloneval (xp_awk_t* awk, xp_awk_val_t* val);
2006-04-07 04:23:11 +00:00
xp_bool_t xp_awk_boolval (xp_awk_val_t* val);
2006-03-04 15:54:37 +00:00
void xp_awk_printval (xp_awk_val_t* val);
#ifdef __cplusplus
}
#endif
2006-03-03 11:45:45 +00:00
#endif