cleaned up run_delete() in awk/run.c

improved Awk::Value
This commit is contained in:
2009-07-11 21:01:36 +00:00
parent 9f382bb951
commit 356e4c0792
5 changed files with 244 additions and 161 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 227 2009-07-10 14:05:51Z hyunghwan.chung $
* $Id: Awk.hpp 228 2009-07-11 03:01:36Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -238,17 +238,28 @@ public:
Value& operator= (const Value& v);
operator val_t* () const { return val; }
operator long_t () const;
operator real_t () const;
operator const char_t* () const;
void clear ();
int setValue (val_t* v);
int setValue (Run* r, val_t* v);
int get (long_t* v) const;
int get (real_t* v) const;
int get (const char_t** str, size_t* len) const;
int setInt (long_t v);
int setInt (Run* r, long_t v);
int setReal (real_t v);
int setReal (Run* r, real_t v);
int setStr (const char_t* str, size_t len);
int setStr (Run* r, const char_t* str, size_t len);
int set (val_t* v);
int set (Run* r, val_t* v);
int set (long_t v);
int set (Run* r, long_t v);
int set (real_t v);
int set (Run* r, real_t v);
int set (const char_t* str, size_t len);
int set (Run* r, const char_t* str, size_t len);
int set (const char_t* str);
int set (Run* r, const char_t* str);
int setIndexed (const char_t* idx, size_t isz, val_t* v);
int setIndexed (Run* r, const char_t* idx, size_t isz, val_t* v);

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 220 2009-07-01 13:14:39Z hyunghwan.chung $
* $Id: awk.h 228 2009-07-11 03:01:36Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1712,6 +1712,10 @@ qse_bool_t qse_awk_rtx_valtobool (
* the same as QSE_AWK_RTX_VALTOSTR_STRP except that you have to use the
* u.strpcat field instead of the u.strp field.
*
* In the context where @a val is determined to be of the type
* #QSE_AWK_VAL_STR, you may access its string pointer and length directly
* instead of calling this function.
*
* @return the pointer to a string converted on success, #QSE_NULL on failure
*/
qse_char_t* qse_awk_rtx_valtostr (
@ -1747,6 +1751,7 @@ qse_char_t* qse_awk_rtx_valtocpldup (
* If the value is converted to a long number, it is stored in the memory
* pointed to by l and 0 is returned. If the value is converted to a real
* number, it is stored in the memory pointed to by r and 1 is returned.
* The function never fails as long as @a val points to a valid value.
*
* The code below shows how to convert a value to a number and determine
* if it is an integer or a floating-point number.