Recovered from cvs revision 2007-05-09 09:58:00

This commit is contained in:
hyung-hwan 2007-05-10 01:07:00 +00:00
parent 3fc43518d1
commit 1c373a9545
2 changed files with 30 additions and 41 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.cpp,v 1.13 2007/05/07 09:30:28 bacon Exp $ * $Id: Awk.cpp,v 1.14 2007/05/08 15:09:38 bacon Exp $
*/ */
#include <ase/awk/Awk.hpp> #include <ase/awk/Awk.hpp>
@ -192,7 +192,7 @@ namespace ASE
size_t i, nargs = ase_awk_getnargs(run); size_t i, nargs = ase_awk_getnargs(run);
Value** args = new Value* [nargs]; Value* args = new Value[nargs];
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
@ -202,30 +202,27 @@ namespace ASE
switch (v->type) switch (v->type)
{ {
case ASE_AWK_VAL_INT: case ASE_AWK_VAL_INT:
obj = new IntValue ( args[i].setInt (((ase_awk_val_int_t*)v)->val);
((ase_awk_val_int_t*)v)->val);
break; break;
case ASE_AWK_VAL_REAL: case ASE_AWK_VAL_REAL:
obj = new RealValue ( args[i].setReal (((ase_awk_val_real_t*)v)->val);
((ase_awk_val_real_t*)v)->val);
break; break;
case ASE_AWK_VAL_STR: case ASE_AWK_VAL_STR:
obj = new StrValue ( args[i].setStr (
((ase_awk_val_str_t*)v)->buf, ((ase_awk_val_str_t*)v)->buf,
((ase_awk_val_str_t*)v)->len); ((ase_awk_val_str_t*)v)->len);
break; break;
case ASE_AWK_VAL_NIL: case ASE_AWK_VAL_NIL:
obj = new NilValue (); args[i].setNil ();
break; break;
} }
} }
Value* ret = (this->*handler) (nargs, args); Value* ret = (this->*handler) (nargs, args);
for (i = 0; i < nargs; i++) delete args[i];
delete[] args; delete[] args;
if (ret == ASE_NULL) return -1; if (ret == ASE_NULL) return -1;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.hpp,v 1.12 2007/05/07 09:30:28 bacon Exp $ * $Id: Awk.hpp,v 1.13 2007/05/08 15:09:38 bacon Exp $
*/ */
#ifndef _ASE_AWK_AWK_HPP_ #ifndef _ASE_AWK_AWK_HPP_
@ -112,42 +112,34 @@ namespace ASE
class Value class Value
{ {
public: public:
}; Value ();
Value (long_t l);
Value (real_t r);
Value (char_t* ptr, size_t len);
~Value ();
class NilValue: public Value void setInt (long_t l);
{ void setReal (real_t r);
public: void setStr (char_t* ptr, size_t len);
NilValue ();
char_t* toStr (size_t* len);
long_t toInt ();
real_t toReal ();
protected: protected:
}; int type;
class StrValue: public Value union
{ {
public: long_t l;
StrValue (const char_t* ptr, size_t len); real_t r;
protected: struct
{
char_t* ptr; char_t* ptr;
size_t len; size_t len;
}; } s;
} v;
class RealValue: public Value
{
public:
RealValue (real_t v);
protected:
real_t value;
};
class IntValue: public Value
{
public:
IntValue (long_t v);
protected:
long_t value;
}; };
Awk (); Awk ();