documented qse_awk_rtx_valtostr() and renamed qse_awk_rtx_valtostrdup()

to qse_awk_rtx_valtocpldup()
This commit is contained in:
hyung-hwan 2009-03-02 03:58:19 +00:00
parent 0b89f7e322
commit 004ba389f2
16 changed files with 233 additions and 88 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: awk.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -154,7 +154,7 @@ static qse_map_walk_t print_awk_value (
qse_char_t* str;
qse_size_t len;
str = qse_awk_rtx_valtostrdup (run, QSE_MAP_VPTR(pair), &len);
str = qse_awk_rtx_valtocpldup (run, QSE_MAP_VPTR(pair), &len);
if (str == QSE_NULL)
{
dprint (QSE_T("***OUT OF MEMORY***\n"));
@ -209,7 +209,7 @@ static void on_run_exit (
}
else
{
str = qse_awk_rtx_valtostrdup (rtx, ret, &len);
str = qse_awk_rtx_valtocpldup (rtx, ret, &len);
if (str == QSE_NULL)
{
dprint (QSE_T("[RETURN] - ***OUT OF MEMORY***\n"));

View File

@ -46,13 +46,13 @@ accept files:
*.c
*.h
headertypes:
o "Overview" robo_overview 10
d "Definitions" robo_definitions 6
t "Types" robo_types 5
e "Enumerations" robo_enumerations 6
s "Structures" robo_structures 5
f "Functions" robo_functions 4
S "Samples" robo_samples 0
o "Overview" robo_overview 10
m "Macros" robo_macros 6
t "Types" robo_types 5
e "Enumerations" robo_enumerations 6
s "Structures" robo_structures 5
f "Functions" robo_functions 4
S "Sample Programs" robo_samples 0
options:
--cmode
--nopre

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: awk.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -49,6 +49,11 @@ typedef struct qse_awk_t qse_awk_t;
typedef struct qse_awk_rtx_t qse_awk_rtx_t; /* (R)untime con(T)e(X)t */
/******/
/****m* AWK/QSE_AWK_VAL_HDR
* NAME
* QSE_AWK_VAL_HDR - define the common header of a value
* SYNOPSIS
*/
#if QSE_SIZEOF_INT == 2
# define QSE_AWK_VAL_HDR \
unsigned int type: 3; \
@ -58,6 +63,7 @@ typedef struct qse_awk_rtx_t qse_awk_rtx_t; /* (R)untime con(T)e(X)t */
unsigned int type: 3; \
unsigned int ref: 29
#endif
/******/
#define QSE_AWK_VAL_TYPE(x) ((x)->type)
@ -708,20 +714,37 @@ enum qse_awk_val_ref_id_t
QSE_AWK_VAL_REF_POS
};
enum qse_awk_valtostr_type_t
/****e* AWK/qse_awk_rtx_valtostr_type_t
* NAME
* qse_awk_rtx_valtostr_type_t - define a value-to-string conversion type
* DESCRIPTION
* The values defined are used to set the type field of the
* qse_awk_rtx_valtostr_out_t structure. The field should be one of the
* following values:
* * QSE_AWK_RTX_VALTOSTR_CPL
* * QSE_AWK_RTX_VALTOSTR_CPLDUP
* * QSE_AWK_RTX_VALTOSTR_STRP
* * QSE_AWK_RTX_VALTOSTR_STRPCAT
* and it can optionally be ORed with QSE_AWK_RTX_VALTOSTR_PRINT.
* SYNOPSIS
*/
enum qse_awk_rtx_valtostr_type_t
{
QSE_AWK_RTX_VALTOSTR_CPL = 0x00,
QSE_AWK_RTX_VALTOSTR_CPLDUP = 0x01,
QSE_AWK_RTX_VALTOSTR_STRP = 0x02,
QSE_AWK_RTX_VALTOSTR_STRPCAT = 0x03,
/* can be ORed with one of the values above */
QSE_AWK_RTX_VALTOSTR_PRINT = 0x10
};
/******/
/****s* AWK/qse_rtx_awk_valtostr_out_t
/****s* AWK/qse_awk_rtx_valtostr_out_t
* NAME
* qse_awk_rtx_valtostr_out_t - define a value-to-string converion output type
* qse_awk_rtx_valtostr_out_t - define a output structure for value-to-string
* conversion
* DESCRIPTION
* The qse_awk_rtx_valtostr() function converts a value to a string as
* indicated in a parameter of the qse_awk_rtx_valtostr_out_t type.
* SYNOPSIS
*/
struct qse_awk_rtx_valtostr_out_t
@ -1570,15 +1593,30 @@ qse_bool_t qse_awk_rtx_isstaticval (
qse_awk_val_t* val
);
/****f* AWK/qse_awk_rtx_refupval
* NAME
* qse_awk_rtx_refupval - increment a reference count
* SYNOPSIS
*/
void qse_awk_rtx_refupval (
qse_awk_rtx_t* rtx,
qse_awk_val_t* val
);
/******/
/****f* AWK/qse_awk_rtx_refdownval
* NAME
* qse_awk_rtx_refdownval - decrement a reference count
* DESCRIPTION
* The qse_awk_rtx_refdownval() function decrements a reference count of
* a value. It destroys the value if it has reached the count of 0.
* SYNOPSIS
*/
void qse_awk_rtx_refdownval (
qse_awk_rtx_t* rtx,
qse_awk_val_t* val
);
/******/
void qse_awk_rtx_refdownval_nofree (
qse_awk_rtx_t* rtx,
@ -1593,6 +1631,62 @@ qse_bool_t qse_awk_rtx_valtobool (
/****f* AWK/qse_awk_rtx_valtostr
* NAME
* qse_awk_rtx_valtostr - convert a value to a string
* DESCRIPTION
* The qse_awk_rtx_valtostr() function convers a value val to a string as
* instructed in the parameter out. Before the call to the function, you
* should initialize a variable of the qse_awk_rtx_valtostr_out_t type.
*
* The type field is one of the following qse_awk_rtx_valtostr_type_t values:
* * QSE_AWK_RTX_VALTOSTR_CPL
* * QSE_AWK_RTX_VALTOSTR_CPLDUP
* * QSE_AWK_RTX_VALTOSTR_STRP
* * QSE_AWK_RTX_VALTOSTR_STRPCAT
* It can optionally be ORed with QSE_AWK_RTX_VALTOSTR_PRINT. The option
* causes the function to use OFMT for real number conversion. Otherwise,
* it uses CONVFMT.
*
* You should initialize or free other fields before and after the call
* depending on the type field as shown in EXAMPLES.
*
* RETURN
* The qse_awk_rtx_valtostr() function returns the pointer to the string
* converted on success, and QSE_NULL on failure.
*
* EXAMPLES
* If you have a static buffer, use QSE_AWK_RTX_VALTOSTR_CPL.
* qse_awk_rtx_valtostr_out_t out;
* qse_char_t buf[100];
* out.type = QSE_AWK_RTX_VALTOSTR_CPL;
* out.u.cpl.ptr = buf;
* out.u.cpl.len = QSE_COUNTOF(buf);
* if (qse_awk_rtx_valtostr (rtx, v, &out) == QSE_NULL) goto oops;
* qse_printf (QSE_T("%.*s\n"), (int)out.u.cpl.len, out.u.cpl.ptr);
*
* When unsure of the size of the string after conversion, you can use
* QSE_AWK_RTX_VALTOSTR_CPLDUP. However, you should free the memory block
* pointed to by the u.cpldup.ptr field after use.
* qse_awk_rtx_valtostr_out_t out;
* out.type = QSE_AWK_RTX_VALTOSTR_CPLDUP;
* if (qse_awk_rtx_valtostr (rtx, v, &out) == QSE_NULL) goto oops;
* qse_printf (QSE_T("%.*s\n"), (int)out.u.cpldup.len, out.u.cpldup.ptr);
* qse_awk_rtx_free (rtx, out.u.cpldup.ptr);
*
* You may like to store the result in a dynamically resizable string.
* Consider QSE_AWK_RTX_VALTOSTR_STRP.
* qse_awk_rtx_valtostr_out_t out;
* qse_str_t str;
* qse_str_init (&str, qse_awk_rtx_getmmgr(rtx), 100);
* out.type = QSE_AWK_RTX_VALTOSTR_STRP;
* out.u.strp = str;
* if (qse_awk_rtx_valtostr (rtx, v, &out) == QSE_NULL) goto oops;
* qse_printf (QSE_T("%.*s\n"),
* (int)QSE_STR_LEN(out.u.strp), QSE_STR_PTR(out.u.strp));
* qse_str_fini (&str);
*
* If you want to append the converted string to an existing dynamically
* resizable string, QSE_AWK_RTX_VALTOSTR_STRPCAT is the answer. The usage is
* the same as QSE_AWK_RTX_VALTOSTR_STRP except that you have to use the
* u.strpcat field instead of the u.strp field.
* SYNOPSIS
*/
qse_char_t* qse_awk_rtx_valtostr (
@ -1602,14 +1696,29 @@ qse_char_t* qse_awk_rtx_valtostr (
);
/******/
/****f* AWK/qse_awk_rtx_valtostrdup
/****f* AWK/qse_awk_rtx_valtocpldup
* NAME
* qse_awk_rtx_valtostrdup - convert a value to a duplicated string
* qse_awk_rtx_valtocpldup - convert a value to a string
* DESCRIPTION
* The qse_awk_rtx_valtocpldup() function provides a shortcut to the
* qse_awk_rtx_valtostr() function with the QSE_AWK_RTX_VALTOSTR_CPLDUP type.
* It returns the pointer to the string converted and stores the length
* to memory pointed to by the parameter len. You should free the returned
* memory block after use.
* RETURN
* It returns the pointer to the string converted on success, and
* QSE_NULL on failure.
* EXAMPLE
* The example shows a simple usage of the function.
* ptr = qse_awk_rtx_valtocpldup (rtx, v, &len);
* if (str == QSE_NULL) goto oops;
* qse_printf (QSE_T("%.*s\n"), (int)len, ptr);
* qse_awk_rtx_free (rtx, ptr);
* SYNOPSIS
*/
qse_char_t* qse_awk_rtx_valtostrdup (
qse_awk_rtx_t* rtx,
qse_awk_val_t* v,
qse_char_t* qse_awk_rtx_valtocpldup (
qse_awk_rtx_t* rtx,
qse_awk_val_t* val,
qse_size_t* len
);
/******/
@ -1639,9 +1748,9 @@ qse_char_t* qse_awk_rtx_valtostrdup (
*/
int qse_awk_rtx_valtonum (
qse_awk_rtx_t* rtx,
qse_awk_val_t* v /* the value to convert to a number */,
qse_long_t* l /* a pointer to a long number */,
qse_real_t* r /* a pointer to a qse_real_t */
qse_awk_val_t* val,
qse_long_t* l,
qse_real_t* r
);
/******/
@ -1659,15 +1768,30 @@ int qse_awk_rtx_strtonum (
);
/******/
/****f* AWK/qse_awk_rtx_alloc
* NAME
* qse_awk_rtx_alloc - allocate memory
* RETURN
* The qse_awk_rtx_alloc() function returns a pointer to the memory block
* allocated on success, and QSE_NULL on failure.
* SYNOPSIS
*/
void* qse_awk_rtx_alloc (
qse_awk_rtx_t* rtx,
qse_size_t size
);
/******/
/****f* AWK/qse_awk_rtx_free
* NAME
* qse_awk_rtx_free - free memory
* SYNOPSIS
*/
void qse_awk_rtx_free (
qse_awk_rtx_t* rtx,
void* ptr
);
/******/
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* $Id: map.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
* $Id: map.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -206,7 +206,7 @@ struct qse_map_t
#define QSE_MAP_COPIER_SIMPLE ((qse_map_copier_t)1)
#define QSE_MAP_COPIER_INLINE ((qse_map_copier_t)2)
/****d* Common/QSE_MAP_SIZE
/****m* Common/QSE_MAP_SIZE
* NAME
* QSE_MAP_SIZE - get the number of pairs
* DESCRIPTION
@ -216,7 +216,7 @@ struct qse_map_t
#define QSE_MAP_SIZE(m) ((m)->size)
/*****/
/****d* Common/QSE_MAP_CAPA
/****m* Common/QSE_MAP_CAPA
* NAME
* QSE_MAP_CAPA - get the capacity of a map
*

View File

@ -1,5 +1,5 @@
/*
* $Id: sll.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
* $Id: sll.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -186,7 +186,7 @@ struct qse_sll_node_t
#define QSE_SLL_SIZE(sll) ((sll)->size)
#define QSE_SLL_SCALE(sll) ((sll)->scale)
/****d* Common/QSE_SLL_DPTR
/****m* Common/QSE_SLL_DPTR
* NAME
* QSE_SLL_DPTR - get the data pointer in a node
* SYNOPSIS
@ -194,7 +194,7 @@ struct qse_sll_node_t
#define QSE_SLL_DPTR(node) ((node)->dptr)
/******/
/****d* Common/QSE_SLL_DLEN
/****m* Common/QSE_SLL_DLEN
* NAME
* QSE_SLL_DLEN - get the length of data in a node
* SYNOPSIS
@ -202,7 +202,7 @@ struct qse_sll_node_t
#define QSE_SLL_DLEN(node) ((node)->dlen)
/******/
/****d* Common/QSE_SLL_NEXT
/****m* Common/QSE_SLL_NEXT
* NAME
* QSE_SLL_NEXT - get the next node
* SYNOPSIS

View File

@ -1,5 +1,5 @@
/*
* $Id: str.h 83 2009-02-24 14:05:17Z hyunghwan.chung $
* $Id: str.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -345,18 +345,30 @@ void qse_str_close (
qse_str_t* str
);
/*
* If capa is 0, it doesn't allocate the buffer in advance.
/****f* Common/qse_str_init
* NAME
* qse_str_init - initialize a dynamically resizable string
* NOTE
* If the parameter capa is 0, it doesn't allocate the internal buffer
* in advance.
* SYNOPSIS
*/
qse_str_t* qse_str_init (
qse_str_t* str,
qse_str_t* str,
qse_mmgr_t* mmgr,
qse_size_t capa
qse_size_t capa
);
/******/
/****f* Common/qse_str_fini
* NAME
* qse_str_fini - finialize a dynamically resizable string
* SYNOPSIS
*/
void qse_str_fini (
qse_str_t* str
);
/******/
/****f* Common/qse_str_yield
* NAME

View File

@ -1,5 +1,5 @@
/*
* $Id: macros.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
* $Id: macros.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -37,8 +37,22 @@
#define QSE_WCHAR_EOF ((qse_wcint_t)-1)
#define QSE_CHAR_EOF ((qse_cint_t)-1)
/****m* Base/QSE_SIZEOF
* NAME
* QSE_SIZEOF - get data size in bytes
* SYNOPSIS
*/
#define QSE_SIZEOF(n) (sizeof(n))
/******/
/****m* Base/QSE_COUNTOF
* NAME
* QSE_COUNTOF - get the number elements in a array
* SYNOPSIS
*/
#define QSE_COUNTOF(n) (sizeof(n)/sizeof(n[0]))
/******/
#define QSE_OFFSETOF(type,member) ((qse_size_t)&((type*)0)->member)
#define QSE_TYPE_IS_SIGNED(type) (((type)0) > ((type)-1))
@ -152,7 +166,7 @@
# define QSE_END_NAMESPACE2(y,x) }}
#endif
/****d* Base/QSE_DEFINE_COMMON_FIELDS
/****m* Base/QSE_DEFINE_COMMON_FIELDS
* NAME
* QSE_DEFINE_COMMON_FIELDS - define common fields
* SYNOPSIS
@ -161,7 +175,7 @@
qse_mmgr_t* mmgr;
/******/
/****d* Base/QSE_DEFINE_COMMON_FUNCTIONS
/****m* Base/QSE_DEFINE_COMMON_FUNCTIONS
* NAME
* QSE_DEFINE_COMMON_FUNCTIONS - define common functions
* SYNOPSIS
@ -172,7 +186,7 @@ qse_mmgr_t* qse_##name##_getmmgr (qse_##name##_t* name); \
void* qse_##name##_getxtn (qse_##name##_t* name);
/******/
/****d* Base/QSE_MMGR
/****m* Base/QSE_MMGR
* NAME
* QSE_MMGR - get the memory manager field
* SYNOPSIS
@ -180,7 +194,7 @@ void* qse_##name##_getxtn (qse_##name##_t* name);
#define QSE_MMGR(obj) (obj->mmgr)
/******/
/****d* Base/QSE_XTN
/****m* Base/QSE_XTN
* NAME
* QSE_XTN - get a pointer to extension space
* DESCRIPTION
@ -192,7 +206,7 @@ void* qse_##name##_getxtn (qse_##name##_t* name);
#define QSE_XTN(obj) ((void*)(obj + 1))
/******/
/****d* Base/QSE_IMPLEMENT_COMMON_FUNCTIONS
/****m* Base/QSE_IMPLEMENT_COMMON_FUNCTIONS
* NAME
* QSE_IMPLEMENT_COMMON_FUNCTIONS - implement common functions
* SYNOPSIS

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h 82 2009-02-24 10:07:01Z hyunghwan.chung $
* $Id: types.h 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -251,7 +251,11 @@ typedef qse_int_t qse_ssize_t;
*/
typedef qse_uint_t qse_word_t;
/* floating-point number */
/****t* Base/qse_real_t
* NAME
* qse_real_t - define a largest floating-pointer number type supported
******
*/
#if defined(__FreeBSD__)
/* TODO: check if the support for long double is complete.
* if so, use long double for qse_real_t */

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: Awk.cpp 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -340,7 +340,7 @@ int Awk::Argument::init (val_t* v)
this->inum = ((qse_awk_val_int_t*)v)->val;
this->rnum = (qse_real_t)((qse_awk_val_int_t*)v)->val;
this->str.ptr = qse_awk_rtx_valtostrdup (
this->str.ptr = qse_awk_rtx_valtocpldup (
this->run->run, v, &this->str.len);
if (this->str.ptr != QSE_NULL) return 0;
}
@ -349,7 +349,7 @@ int Awk::Argument::init (val_t* v)
this->inum = (qse_long_t)((qse_awk_val_real_t*)v)->val;
this->rnum = ((qse_awk_val_real_t*)v)->val;
this->str.ptr = qse_awk_rtx_valtostrdup (
this->str.ptr = qse_awk_rtx_valtocpldup (
this->run->run, v, &this->str.len);
if (this->str.ptr != QSE_NULL) return 0;
}
@ -358,7 +358,7 @@ int Awk::Argument::init (val_t* v)
this->inum = 0;
this->rnum = 0.0;
this->str.ptr = qse_awk_rtx_valtostrdup (
this->str.ptr = qse_awk_rtx_valtocpldup (
this->run->run, v, &this->str.len);
if (this->str.ptr != QSE_NULL) return 0;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: fnc.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: fnc.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -249,7 +249,7 @@ static int fnc_close (
}
else
{
name = qse_awk_rtx_valtostrdup (run, a0, &len);
name = qse_awk_rtx_valtocpldup (run, a0, &len);
if (name == QSE_NULL) return -1;
}
@ -362,7 +362,7 @@ static int fnc_fflush (
}
else
{
str0 = qse_awk_rtx_valtostrdup (run, a0, &len0);
str0 = qse_awk_rtx_valtocpldup (run, a0, &len0);
if (str0 == QSE_NULL) return -1;
}
@ -433,7 +433,7 @@ static int fnc_index (
}
else
{
str0 = qse_awk_rtx_valtostrdup (run, a0, &len0);
str0 = qse_awk_rtx_valtocpldup (run, a0, &len0);
if (str0 == QSE_NULL) return -1;
}
@ -444,7 +444,7 @@ static int fnc_index (
}
else
{
str1 = qse_awk_rtx_valtostrdup (run, a1, &len1);
str1 = qse_awk_rtx_valtocpldup (run, a1, &len1);
if (str1 == QSE_NULL)
{
if (a0->type != QSE_AWK_VAL_STR)
@ -488,7 +488,7 @@ static int fnc_length (
}
else
{
str = qse_awk_rtx_valtostrdup (run, v, &len);
str = qse_awk_rtx_valtocpldup (run, v, &len);
if (str == QSE_NULL) return -1;
QSE_AWK_FREE (run->awk, str);
}
@ -529,7 +529,7 @@ static int fnc_substr (
}
else
{
str = qse_awk_rtx_valtostrdup (run, a0, &len);
str = qse_awk_rtx_valtocpldup (run, a0, &len);
if (str == QSE_NULL) return -1;
}
@ -634,7 +634,7 @@ static int fnc_split (
}
else
{
str = qse_awk_rtx_valtostrdup (run, a0, &str_len);
str = qse_awk_rtx_valtocpldup (run, a0, &str_len);
if (str == QSE_NULL) return -1;
str_free = str;
}
@ -657,7 +657,7 @@ static int fnc_split (
}
else
{
fs_ptr = qse_awk_rtx_valtostrdup (run, t1, &fs_len);
fs_ptr = qse_awk_rtx_valtocpldup (run, t1, &fs_len);
if (fs_ptr == QSE_NULL)
{
if (str_free != QSE_NULL)
@ -683,7 +683,7 @@ static int fnc_split (
}
else
{
fs_ptr = qse_awk_rtx_valtostrdup (run, a2, &fs_len);
fs_ptr = qse_awk_rtx_valtocpldup (run, a2, &fs_len);
if (fs_ptr == QSE_NULL)
{
if (str_free != QSE_NULL)
@ -850,7 +850,7 @@ static int fnc_tolower (
}
else
{
str = qse_awk_rtx_valtostrdup (run, a0, &len);
str = qse_awk_rtx_valtocpldup (run, a0, &len);
if (str == QSE_NULL) return -1;
}
@ -889,7 +889,7 @@ static int fnc_toupper (
}
else
{
str = qse_awk_rtx_valtostrdup (run, a0, &len);
str = qse_awk_rtx_valtocpldup (run, a0, &len);
if (str == QSE_NULL) return -1;
}
@ -955,7 +955,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_long_t max_count)
}
else
{
a0_ptr = qse_awk_rtx_valtostrdup (run, a0, &a0_len);
a0_ptr = qse_awk_rtx_valtocpldup (run, a0, &a0_len);
if (a0_ptr == QSE_NULL)
{
FREE_A_PTRS (run->awk);
@ -971,7 +971,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_long_t max_count)
}
else
{
a1_ptr = qse_awk_rtx_valtostrdup (run, a1, &a1_len);
a1_ptr = qse_awk_rtx_valtocpldup (run, a1, &a1_len);
if (a1_ptr == QSE_NULL)
{
FREE_A_PTRS (run->awk);
@ -1026,7 +1026,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_long_t max_count)
}
else
{
a2_ptr = qse_awk_rtx_valtostrdup (run, *a2_ref, &a2_len);
a2_ptr = qse_awk_rtx_valtocpldup (run, *a2_ref, &a2_len);
if (a2_ptr == QSE_NULL)
{
FREE_A_PTRS (run->awk);
@ -1234,7 +1234,7 @@ static int fnc_match (
}
else
{
str0 = qse_awk_rtx_valtostrdup (run, a0, &len0);
str0 = qse_awk_rtx_valtocpldup (run, a0, &len0);
if (str0 == QSE_NULL) return -1;
}
@ -1251,7 +1251,7 @@ static int fnc_match (
}
else
{
str1 = qse_awk_rtx_valtostrdup (run, a1, &len1);
str1 = qse_awk_rtx_valtocpldup (run, a1, &len1);
if (str1 == QSE_NULL)
{
if (a0->type != QSE_AWK_VAL_STR)
@ -1356,7 +1356,7 @@ static int fnc_sprintf (
}
else
{
cs0.ptr = qse_awk_rtx_valtostrdup (run, a0, &cs0.len);
cs0.ptr = qse_awk_rtx_valtocpldup (run, a0, &cs0.len);
if (cs0.ptr == QSE_NULL)
{
qse_str_fini (&fbu);

View File

@ -1,5 +1,5 @@
/*
* $Id: rio.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: rio.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -217,7 +217,7 @@ int qse_awk_rtx_readio (
}
else
{
rs_ptr = qse_awk_rtx_valtostrdup (run, rs, &rs_len);
rs_ptr = qse_awk_rtx_valtocpldup (run, rs, &rs_len);
if (rs_ptr == QSE_NULL)
{
qse_awk_rtx_refdownval (run, rs);

View File

@ -1,5 +1,5 @@
/*
* $Id: std.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: std.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1268,7 +1268,7 @@ static int fnc_system (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl
}
else
{
str = qse_awk_rtx_valtostrdup (run, v, &len);
str = qse_awk_rtx_valtocpldup (run, v, &len);
if (str == QSE_NULL) return -1;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: val.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -730,15 +730,6 @@ static qse_char_t* str_to_str (
}
#endif
/* TODO: current combination
no buffer => indicated by NULL, option (PRINT)
fixed buffer => indicated by FIXED, option (PRINT) => USE CPL INSTEAD, PRINT made an option
dynamic buffer => option (CLEAR, PRINT) =>
PRINT OPTION applies to real_to_str only.
how to handle CLEAR...
*/
static qse_char_t* str_to_str (
qse_awk_rtx_t* rtx, const qse_char_t* str, qse_size_t str_len,
qse_awk_rtx_valtostr_out_t* out)
@ -1129,7 +1120,7 @@ qse_char_t* qse_awk_rtx_valtostr (
return QSE_NULL;
}
qse_char_t* qse_awk_rtx_valtostrdup (
qse_char_t* qse_awk_rtx_valtocpldup (
qse_awk_rtx_t* rtx, qse_awk_val_t* v, qse_size_t* len)
{
qse_awk_rtx_valtostr_out_t out;

View File

@ -1,5 +1,5 @@
/*
* $Id: awk02.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* $Id: awk02.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -16,9 +16,9 @@
limitations under the License.
*/
/****S* AWK/Basic Loop
/****S* AWK/Basic Loop With Deparsing
* DESCRIPTION
* This program demonstrates how to use qse_awk_rtx_loop().
* The program deparses the source code and prints it before executing it.
* SOURCE
*/

View File

@ -1,5 +1,5 @@
/*
* $Id: awk03.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: awk03.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -103,7 +103,7 @@ int main ()
ret = -1; goto oops;
}
str = qse_awk_rtx_valtostrdup (rtx, v, &len);
str = qse_awk_rtx_valtocpldup (rtx, v, &len);
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),

View File

@ -1,5 +1,5 @@
/*
* $Id: awk04.c 89 2009-02-28 15:27:03Z hyunghwan.chung $
* $Id: awk04.c 90 2009-03-01 09:58:19Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -105,7 +105,7 @@ int main ()
ret = -1; goto oops;
}
str = qse_awk_rtx_valtostrdup (rtx, v, &len);
str = qse_awk_rtx_valtocpldup (rtx, v, &len);
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),