Recovered from cvs revision 2007-10-11 13:33:00

This commit is contained in:
hyung-hwan 2007-10-12 00:13:00 +00:00
parent 3cfcc8b0c9
commit 917d2fe1ff
23 changed files with 373 additions and 283 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.70 2007/10/10 03:37:49 bacon Exp $
* $Id: Awk.cpp,v 1.72 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -911,10 +911,16 @@ Awk::Run::operator Awk::run_t* () const
return this->run;
}
int Awk::Run::stop () const
void Awk::Run::stop () const
{
ASE_ASSERT (this->run != ASE_NULL);
return ase_awk_stop (this->run);
ase_awk_stop (this->run);
}
bool Awk::Run::isStop () const
{
ASE_ASSERT (this->run != ASE_NULL);
return ase_awk_isstop (this->run);
}
Awk::ErrorCode Awk::Run::getErrorCode () const
@ -1208,7 +1214,8 @@ int Awk::open ()
OPT_SHADING |
OPT_EXTIO |
OPT_BLOCKLESS |
OPT_BASEONE;
OPT_BASEONE |
OPT_PABLOCK;
ase_awk_setoption (awk, opt);
runCallback = false;
@ -1384,6 +1391,12 @@ int Awk::run (const char_t* main, const char_t** args, size_t nargs)
return n;
}
void Awk::stop ()
{
ASE_ASSERT (awk != ASE_NULL);
ase_awk_stopall (awk);
}
int Awk::dispatchFunction (Run* run, const char_t* name, size_t len)
{
pair_t* pair;

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.71 2007/10/10 03:37:49 bacon Exp $
* $Id: Awk.hpp,v 1.73 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -441,6 +441,7 @@ public:
ERR_IN = ASE_AWK_EIN,
ERR_NOTVAR = ASE_AWK_ENOTVAR,
ERR_EXPRES = ASE_AWK_EEXPRES,
ERR_FUNC = ASE_AWK_EFUNC,
ERR_WHILE = ASE_AWK_EWHILE,
ERR_ASSIGN = ASE_AWK_EASSIGN,
ERR_IDENT = ASE_AWK_EIDENT,
@ -552,7 +553,9 @@ public:
/** Enables the keyword 'reset' */
OPT_RESET = ASE_AWK_RESET,
/** Allows the assignment of a map value to a variable */
OPT_MAPTOVAR = ASE_AWK_MAPTOVAR
OPT_MAPTOVAR = ASE_AWK_MAPTOVAR,
/** Allows BEGIN, END, pattern-action blocks */
OPT_PABLOCK = ASE_AWK_PABLOCK
};
// end of enum Option
@ -572,7 +575,8 @@ public:
operator Awk* () const;
operator run_t* () const;
int stop () const;
void stop () const;
bool isStop () const;
ErrorCode getErrorCode () const;
size_t getErrorLine () const;
@ -817,6 +821,11 @@ public:
virtual int run (const char_t* main = ASE_NULL,
const char_t** args = ASE_NULL, size_t nargs = 0);
/**
* Requests aborting execution of the parse tree
*/
virtual void stop ();
/**
* Adds a intrinsic global variable.
*/

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.java,v 1.15 2007/09/27 11:04:10 bacon Exp $
* $Id: Awk.java,v 1.16 2007/10/10 07:03:56 bacon Exp $
*
* {License}
*/
@ -40,6 +40,7 @@ public abstract class Awk
public static final int OPTION_ARGSTOMAIN = (1 << 14);
public static final int OPTION_RESET = (1 << 15);
public static final int OPTION_MAPTOVAR = (1 << 16);
public static final int OPTION_PABLOCK = (1 << 17);
protected final static Reader stdin =
new BufferedReader (new InputStreamReader (System.in));

View File

@ -1,5 +1,5 @@
/*
* $Id: Exception.java,v 1.5 2007/06/29 11:36:45 bacon Exp $
* $Id: Exception.java,v 1.6 2007/10/10 07:03:56 bacon Exp $
*
* {License}
*/
@ -60,84 +60,87 @@ public class Exception extends java.lang.Exception
public static final int IN = 45;
public static final int NOTVAR = 46;
public static final int EXPRES = 47;
public static final int WHILE = 48;
public static final int ASSIGN = 49;
public static final int IDENT = 50;
public static final int FNNAME = 51;
public static final int BLKBEG = 52;
public static final int BLKEND = 53;
public static final int DUPBEG = 54;
public static final int DUPEND = 55;
public static final int BFNRED = 56;
public static final int AFNRED = 57;
public static final int GBLRED = 58;
public static final int PARRED = 59;
public static final int DUPPAR = 60;
public static final int DUPGBL = 61;
public static final int DUPLCL = 62;
public static final int BADPAR = 63;
public static final int BADVAR = 64;
public static final int UNDEF = 65;
public static final int LVALUE = 66;
public static final int GBLTM = 67;
public static final int LCLTM = 68;
public static final int PARTM = 69;
public static final int DELETE = 70;
public static final int BREAK = 71;
public static final int CONTINUE = 72;
public static final int NEXTBEG = 73;
public static final int NEXTEND = 74;
public static final int NEXTFBEG = 75;
public static final int NEXTFEND = 76;
public static final int PRINTFARG = 77;
public static final int PREPST = 78;
public static final int GLNCPS = 79;
public static final int DIVBY0 = 80;
public static final int OPERAND = 81;
public static final int POSIDX = 82;
public static final int ARGTF = 83;
public static final int ARGTM = 84;
public static final int FNNONE = 85;
public static final int NOTIDX = 86;
public static final int NOTDEL = 87;
public static final int NOTMAP = 88;
public static final int NOTMAPIN = 89;
public static final int NOTMAPNILIN = 90;
public static final int NOTREF = 91;
public static final int NOTASS = 92;
public static final int IDXVALASSMAP = 93;
public static final int POSVALASSMAP = 94;
public static final int MAPTOSCALAR = 95;
public static final int SCALARTOMAP = 96;
public static final int MAPNOTALLOWED = 97;
public static final int VALTYPE = 98;
public static final int RDELETE = 99;
public static final int RNEXTBEG = 100;
public static final int RNEXTEND = 101;
public static final int RNEXTFBEG = 102;
public static final int RNEXTFEND = 103;
public static final int BFNUSER = 104;
public static final int BFNIMPL = 105;
public static final int IOUSER = 106;
public static final int IONONE = 107;
public static final int IOIMPL = 108;
public static final int IONMEM = 109;
public static final int IONMNL = 110;
public static final int FMTARG = 111;
public static final int FMTCNV = 112;
public static final int CONVFMTCHR = 113;
public static final int OFMTCHR = 114;
public static final int REXRECUR = 115;
public static final int REXRPAREN = 116;
public static final int REXRBRACKET = 117;
public static final int REXRBRACE = 118;
public static final int REXUNBALPAR = 119;
public static final int REXCOLON = 120;
public static final int REXCRANGE = 121;
public static final int REXCCLASS = 122;
public static final int REXBRANGE = 123;
public static final int REXEND = 124;
public static final int REXGARBAGE = 125;
public static final int FUNC = 48;
public static final int WHILE = 49;
public static final int ASSIGN = 50;
public static final int IDENT = 51;
public static final int FNNAME = 52;
public static final int BLKBEG = 53;
public static final int BLKEND = 54;
public static final int DUPBEG = 55;
public static final int DUPEND = 56;
public static final int BFNRED = 57;
public static final int AFNRED = 58;
public static final int GBLRED = 59;
public static final int PARRED = 60;
public static final int DUPPAR = 61;
public static final int DUPGBL = 62;
public static final int DUPLCL = 63;
public static final int BADPAR = 64;
public static final int BADVAR = 65;
public static final int UNDEF = 66;
public static final int LVALUE = 67;
public static final int GBLTM = 68;
public static final int LCLTM = 69;
public static final int PARTM = 70;
public static final int DELETE = 71;
public static final int RESET = 72;
public static final int BREAK = 73;
public static final int CONTINUE = 74;
public static final int NEXTBEG = 75;
public static final int NEXTEND = 76;
public static final int NEXTFBEG = 77;
public static final int NEXTFEND = 78;
public static final int PRINTFARG = 79;
public static final int PREPST = 80;
public static final int GLNCPS = 81;
public static final int DIVBY0 = 82;
public static final int OPERAND = 83;
public static final int POSIDX = 84;
public static final int ARGTF = 85;
public static final int ARGTM = 86;
public static final int FNNONE = 87;
public static final int NOTIDX = 88;
public static final int NOTDEL = 89;
public static final int NOTMAP = 90;
public static final int NOTMAPIN = 91;
public static final int NOTMAPNILIN = 92;
public static final int NOTREF = 93;
public static final int NOTASS = 94;
public static final int IDXVALASSMAP = 95;
public static final int POSVALASSMAP = 96;
public static final int MAPTOSCALAR = 97;
public static final int SCALARTOMAP = 98;
public static final int MAPNOTALLOWED = 99;
public static final int VALTYPE = 100;
public static final int RDELETE = 101;
public static final int RRESET = 102;
public static final int RNEXTBEG = 103;
public static final int RNEXTEND = 104;
public static final int RNEXTFBEG = 105;
public static final int RNEXTFEND = 106;
public static final int BFNUSER = 107;
public static final int BFNIMPL = 108;
public static final int IOUSER = 109;
public static final int IONONE = 110;
public static final int IOIMPL = 111;
public static final int IONMEM = 112;
public static final int IONMNL = 113;
public static final int FMTARG = 114;
public static final int FMTCNV = 115;
public static final int CONVFMTCHR = 116;
public static final int OFMTCHR = 117;
public static final int REXRECUR = 118;
public static final int REXRPAREN = 119;
public static final int REXRBRACKET = 120;
public static final int REXRBRACE = 121;
public static final int REXUNBALPAR = 122;
public static final int REXCOLON = 123;
public static final int REXCRANGE = 124;
public static final int REXCCLASS = 125;
public static final int REXBRANGE = 126;
public static final int REXEND = 127;
public static final int REXGARBAGE = 128;
// end of error codes
public Exception ()

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.10 2007/09/24 08:21:25 bacon Exp $
* $Id: awk.c,v 1.11 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -109,6 +109,7 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
awk->option = 0;
awk->errnum = ASE_AWK_ENOERR;
awk->errlin = 0;
awk->stopall = ase_false;
awk->parse.nlocals_max = 0;
@ -212,6 +213,8 @@ int ase_awk_close (ase_awk_t* awk)
int ase_awk_clear (ase_awk_t* awk)
{
awk->stopall = ase_false;
ase_memset (&awk->src.ios, 0, ASE_SIZEOF(awk->src.ios));
awk->src.lex.curc = ASE_CHAR_EOF;
awk->src.lex.ungotc_count = 0;
@ -290,3 +293,8 @@ void* ase_awk_getcustomdata (ase_awk_t* awk)
{
return awk->custom_data;
}
void ase_awk_stopall (ase_awk_t* awk)
{
awk->stopall = ase_true;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.17 2007/10/10 03:37:49 bacon Exp $
* $Id: awk.h,v 1.19 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -264,6 +264,7 @@ enum ase_awk_errnum_t
ASE_AWK_ENOTVAR, /* not a variable name after 'in' */
ASE_AWK_EEXPRES, /* expression expected */
ASE_AWK_EFUNC, /* keyword 'func' is expected */
ASE_AWK_EWHILE, /* keyword 'while' is expected */
ASE_AWK_EASSIGN, /* assignment statement expected */
ASE_AWK_EIDENT, /* identifier expected */
@ -476,7 +477,11 @@ int ase_awk_run (
ase_awk_runios_t* runios, ase_awk_runcbs_t* runcbs,
ase_awk_runarg_t* runarg, void* custom_data);
int ase_awk_stop (ase_awk_run_t* run);
void ase_awk_stop (ase_awk_run_t* run);
void ase_awk_stopall (ase_awk_t* awk);
ase_bool_t ase_awk_isstop (ase_awk_run_t* run);
/* functions to access internal stack structure */
ase_size_t ase_awk_getnargs (ase_awk_run_t* run);

View File

@ -1,5 +1,5 @@
/*
* $Id: awk_i.h,v 1.7 2007/09/23 16:48:55 bacon Exp $
* $Id: awk_i.h,v 1.8 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -196,8 +196,9 @@ struct ase_awk_t
int errnum;
ase_size_t errlin;
ase_char_t errmsg[256];
ase_char_t* errstr[ASE_AWK_NUMERRNUM];
ase_bool_t stopall;
};
struct ase_awk_chain_t

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.8 2007/09/25 15:27:54 bacon Exp $
* $Id: err.c,v 1.9 2007/10/10 07:03:56 bacon Exp $
*
* {License}
*/
@ -66,6 +66,7 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("right-hand side of the 'in' operator not a variable"),
ASE_T("invalid expression"),
ASE_T("keyword 'func' expected in place of '%.*s'"),
ASE_T("keyword 'while' expected in place of '%.*s'"),
ASE_T("invalid assignment statement"),
ASE_T("an identifier expected in place of '%.*s'"),

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.16 2007/10/10 03:37:49 bacon Exp $
* $Id: jni.c,v 1.17 2007/10/10 07:03:56 bacon Exp $
*
* {License}
*/
@ -388,17 +388,12 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
(*env)->SetLongField (env, obj, handle, (jlong)awk);
opt = ASE_AWK_IMPLICIT |
ASE_AWK_EXPLICIT |
ASE_AWK_UNIQUEFN |
ASE_AWK_IDIV |
ASE_AWK_SHADING |
ASE_AWK_SHIFT |
ASE_AWK_EXTIO |
ASE_AWK_BLOCKLESS |
ASE_AWK_BASEONE |
ASE_AWK_STRIPSPACES |
ASE_AWK_NEXTOFILE |
ASE_AWK_ARGSTOMAIN;
ASE_AWK_PABLOCK;
ase_awk_setoption (awk, opt);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.19 2007/10/10 03:37:49 bacon Exp $
* $Id: parse.c,v 1.20 2007/10/10 07:03:56 bacon Exp $
*
* {License}
*/
@ -590,6 +590,12 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
}
else if (MATCH(awk,TOKEN_BEGIN))
{
if ((awk->option & ASE_AWK_PABLOCK) == 0)
{
SETERRTOK (awk, ASE_AWK_EFUNC);
return ASE_NULL;
}
if (awk->tree.begin != ASE_NULL)
{
SETERRLIN (awk, ASE_AWK_EDUPBEG, awk->token.prev.line);
@ -619,6 +625,12 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
}
else if (MATCH(awk,TOKEN_END))
{
if ((awk->option & ASE_AWK_PABLOCK) == 0)
{
SETERRTOK (awk, ASE_AWK_EFUNC);
return ASE_NULL;
}
if (awk->tree.end != ASE_NULL)
{
SETERRLIN (awk, ASE_AWK_EDUPEND, awk->token.prev.line);
@ -651,7 +663,6 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
/* patternless block */
if ((awk->option & ASE_AWK_PABLOCK) == 0)
{
/* TODO: SET ERROR */
SETERRTOK (awk, ASE_AWK_EFUNC);
return ASE_NULL;
}
@ -675,7 +686,6 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
if ((awk->option & ASE_AWK_PABLOCK) == 0)
{
/* TODO: SET ERROR */
SETERRTOK (awk, ASE_AWK_EFUNC);
return ASE_NULL;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c,v 1.16 2007/09/27 11:04:10 bacon Exp $
* $Id: run.c,v 1.17 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -689,10 +689,14 @@ int ase_awk_run (ase_awk_t* awk,
return n;
}
int ase_awk_stop (ase_awk_run_t* run)
void ase_awk_stop (ase_awk_run_t* run)
{
run->exit_level = EXIT_ABORT;
return 0;
}
ase_bool_t ase_awk_isstop (ase_awk_run_t* run)
{
return (run->exit_level == EXIT_ABORT || run->awk->stopall);
}
static void free_namedval (void* run, void* val)
@ -1705,7 +1709,7 @@ static int run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
ase_dprintf (ASE_T("executing block statements\n"));
#endif
while (p != ASE_NULL && run->exit_level == EXIT_NONE)
while (p != ASE_NULL && run->exit_level == EXIT_NONE)
{
if (run_statement (run, p) == -1)
{
@ -1731,6 +1735,7 @@ static int run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
}
#define ON_STATEMENT(run,nde) \
if ((run)->awk->stopall) (run)->exit_level = EXIT_ABORT; \
if ((run)->cbs != ASE_NULL && \
(run)->cbs->on_statement != ASE_NULL) \
{ \

View File

@ -4,19 +4,10 @@
- added ase_awk_addglobal, ase_awk_delglobal (awk/parse.c)
- added Awk::addGlobal, Awk::deleteGlobal (awk/Awk.hpp, awk/Awk.cpp)
- added Awk::Run::setGlobal, Awk::Run::getGlobal (awk/Awk.hpp, awk/Awk.cpp)
- added Awk::AddGlobal, Awk::DeleteGlobal (net/Awk.hpp, net/Awk.cpp)
- added Awk::Run::SetGlobal, Awk::Run::GetGlobal (net/Awk.hpp, net/Awk.cpp)
- enhanced ase_awk_getglobalname
* added an option
- ASE_AWK_RESET (awk/awk.h)
- Awk::OPT_RESET (awk/Awk.hpp)
- Awk::OPTION::RESET (net/Awk.hpp)
- Awk.OPTION_RESET (awk/Awk.java)
- Awk::EnableReset (net/asecom.idl, net/Awk.h)
* added an option
- ASE_AWK_MAPTOVAR (awk/awk.h)
- Awk::OPT_MAPTOVAR (awk/Awk.hpp)
- Awk::OPTION::MAPTOVAR (net/Awk.hpp)
- Awk.OPTION_MAPTOVAR (awk/Awk.java)
- Awk::AllowMapToVar (net/asecom.idl, net/Awk.h)
* added three new options - ASE_AWK_RESET, ASE_AWK_MAPTOVAR, ASE_AWK_PABLOCK
* enhanced Awk::dispatchFunction to set a more accurate error code (awk/Awk.cpp)

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.9 2007/09/30 15:12:20 bacon Exp $
* $Id: Awk.cpp,v 1.11 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -55,17 +55,13 @@ CAwk::CAwk ():
/* TODO: what is the best default option? */
option =
ASE_AWK_IMPLICIT |
ASE_AWK_EXPLICIT |
ASE_AWK_UNIQUEFN |
ASE_AWK_IDIV |
ASE_AWK_SHADING |
ASE_AWK_SHIFT |
ASE_AWK_EXTIO |
ASE_AWK_BLOCKLESS |
ASE_AWK_BASEONE |
ASE_AWK_STRIPSPACES |
ASE_AWK_NEXTOFILE |
ASE_AWK_CRLF;
ASE_AWK_CRLF |
ASE_AWK_PABLOCK;
memset (&max_depth, 0, sizeof(max_depth));
errnum = 0;
@ -232,7 +228,7 @@ static void custom_awk_dprintf (void* custom, const ase_char_t* fmt, ...)
va_end (ap);
}
static ase_ssize_t __read_source (
static ase_ssize_t read_source (
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
CAwk* awk = (CAwk*)arg;
@ -300,7 +296,7 @@ static ase_ssize_t __read_source (
return -1;
}
static ase_ssize_t __write_source (
static ase_ssize_t write_source (
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
CAwk* awk = (CAwk*)arg;
@ -344,7 +340,7 @@ static ase_ssize_t __write_source (
return -1;
}
static int __handle_bfn (
static int handle_bfn (
ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl)
{
CAwk* awk = (CAwk*)ase_awk_getruncustomdata (run);
@ -558,7 +554,7 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
if (ase_awk_addfunc (
handle, bfn->name.ptr, bfn->name.len, 0,
bfn->min_args, bfn->max_args, NULL,
__handle_bfn) == NULL)
handle_bfn) == NULL)
{
const ase_char_t* msg;
@ -593,8 +589,8 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
ase_awk_srcios_t srcios;
srcios.in = __read_source;
srcios.out = __write_source;
srcios.in = read_source;
srcios.out = write_source;
srcios.custom_data = this;
if (ase_awk_parse (handle, &srcios) == -1)
@ -615,7 +611,7 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
return S_OK;
}
static ase_ssize_t __process_extio (
static ase_ssize_t process_extio (
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
@ -796,8 +792,8 @@ HRESULT CAwk::Run (VARIANT argarray, VARIANT_BOOL* ret)
ase_awk_runios_t runios;
runios.pipe = NULL;
runios.coproc = NULL;
runios.file = __process_extio;
runios.console = __process_extio;
runios.file = process_extio;
runios.console = process_extio;
runios.custom_data = this;
if (entry_point != NULL &&
@ -907,6 +903,21 @@ HRESULT CAwk::Run (VARIANT argarray, VARIANT_BOOL* ret)
return S_OK;
}
STDMETHODIMP CAwk::AddGlobal (BSTR name, VARIANT_BOOL* ret)
{
// TODO:
*ret = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CAwk::DeleteGlobal (BSTR name, VARIANT_BOOL* ret)
{
// TODO:
*ret = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CAwk::AddFunction (
BSTR name, int minArgs, int maxArgs, VARIANT_BOOL* ret)
{
@ -1352,6 +1363,21 @@ STDMETHODIMP CAwk::put_AllowMapToVar(VARIANT_BOOL newVal)
return S_OK;
}
STDMETHODIMP CAwk::get_SupportPatternActionBlock(VARIANT_BOOL *pVal)
{
if (handle != NULL) option = ase_awk_getoption (handle);
*pVal = (option & ASE_AWK_PABLOCK) == 1;
return S_OK;
}
STDMETHODIMP CAwk::put_SupportPatternActionBlock(VARIANT_BOOL newVal)
{
if (newVal) option = option | ASE_AWK_PABLOCK;
else option = option & ~ASE_AWK_PABLOCK;
if (handle != NULL) ase_awk_setoption (handle, option);
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForBlockParse(int *pVal)
{
if (handle != NULL)

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.h,v 1.8 2007/09/30 15:12:20 bacon Exp $
* $Id: Awk.h,v 1.10 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -141,6 +141,8 @@ public:
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForBlockParse)(/*[in]*/ int newVal);
STDMETHOD(get_SupportPatternActionBlock)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_SupportPatternActionBlock)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_AllowMapToVar)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_AllowMapToVar)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_EnableReset)(/*[out, retval]*/ VARIANT_BOOL *pVal);
@ -190,6 +192,11 @@ public:
/*[in]*/ BSTR name, /*[in]*/ int minArgs,
/*[in]*/ int maxArgs, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall DeleteGlobal (
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall AddGlobal (
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall Parse (/*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall Run (
/*[in]*/ VARIANT argarray, /*[out, retval]*/ VARIANT_BOOL* ret);

View File

@ -1,5 +1,5 @@
/*
* $Id: asecom.idl,v 1.8 2007/09/30 15:12:20 bacon Exp $
* $Id: asecom.idl,v 1.10 2007/10/10 13:22:12 bacon Exp $
*/
import "oaidl.idl";
@ -21,153 +21,165 @@ interface IAwk : IDispatch
[id(2), helpstring("method Run")]
HRESULT Run([in] VARIANT argarray, [out,retval] VARIANT_BOOL* ret);
[id(3), helpstring("method AddFunction")]
[id(3), helpstring("method AddGlobal")]
HRESULT AddGlobal([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(4), helpstring("method DeleteGlobal")]
HRESULT DeleteGlobal([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(5), helpstring("method AddFunction")]
HRESULT AddFunction([in] BSTR name, [in] int minArgs, [in] int maxArgs, [out,retval] VARIANT_BOOL* ret);
[id(4), helpstring("method DeleteFunction")]
[id(6), helpstring("method DeleteFunction")]
HRESULT DeleteFunction([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(5), helpstring("method SetWord")]
[id(7), helpstring("method SetWord")]
HRESULT SetWord([in] BSTR ow, [in] BSTR nw, [out,retval] VARIANT_BOOL* ret);
[id(6), helpstring("method UnsetWord")]
[id(8), helpstring("method UnsetWord")]
HRESULT UnsetWord([in] BSTR ow, [out,retval] VARIANT_BOOL* ret);
[id(7), helpstring("method UnsetAllWords")]
[id(9), helpstring("method UnsetAllWords")]
HRESULT UnsetAllWords([out,retval] VARIANT_BOOL* ret);
[propget, id(8), helpstring("property ErrorCode")]
[propget, id(10), helpstring("property ErrorCode")]
HRESULT ErrorCode([out,retval] int *pVal);
[propget, id(9), helpstring("property ErrorLine")]
[propget, id(11), helpstring("property ErrorLine")]
HRESULT ErrorLine([out,retval] int *pVal);
[propget, id(10), helpstring("property ErrorMessage")]
[propget, id(12), helpstring("property ErrorMessage")]
HRESULT ErrorMessage([out,retval] BSTR *pVal);
[propget, id(11), helpstring("property ImplicitVariable")]
[propget, id(13), helpstring("property ImplicitVariable")]
HRESULT ImplicitVariable([out,retval] VARIANT_BOOL *pVal);
[propput, id(11), helpstring("property ImplicitVariable")]
[propput, id(13), helpstring("property ImplicitVariable")]
HRESULT ImplicitVariable([in] VARIANT_BOOL newVal);
[propget, id(12), helpstring("property ExplicitVariable")]
[propget, id(14), helpstring("property ExplicitVariable")]
HRESULT ExplicitVariable([out,retval] VARIANT_BOOL *pVal);
[propput, id(12), helpstring("property ExplicitVariable")]
[propput, id(14), helpstring("property ExplicitVariable")]
HRESULT ExplicitVariable([in] VARIANT_BOOL newVal);
[propget, id(13), helpstring("property UniqueFunction")]
[propget, id(15), helpstring("property UniqueFunction")]
HRESULT UniqueFunction([out,retval] VARIANT_BOOL *pVal);
[propput, id(13), helpstring("property UniqueFunction")]
[propput, id(15), helpstring("property UniqueFunction")]
HRESULT UniqueFunction([in] VARIANT_BOOL newVal);
[propget, id(14), helpstring("property VariableShading")]
[propget, id(16), helpstring("property VariableShading")]
HRESULT VariableShading([out,retval] VARIANT_BOOL *pVal);
[propput, id(14), helpstring("property VariableShading")]
[propput, id(16), helpstring("property VariableShading")]
HRESULT VariableShading([in] VARIANT_BOOL newVal);
[propget, id(15), helpstring("property ShiftOperators")]
[propget, id(17), helpstring("property ShiftOperators")]
HRESULT ShiftOperators([out,retval] VARIANT_BOOL *pVal);
[propput, id(15), helpstring("property ShiftOperators")]
[propput, id(17), helpstring("property ShiftOperators")]
HRESULT ShiftOperators([in] VARIANT_BOOL newVal);
[propget, id(16), helpstring("property IdivOperator")]
[propget, id(18), helpstring("property IdivOperator")]
HRESULT IdivOperator([out,retval] VARIANT_BOOL *pVal);
[propput, id(16), helpstring("property IdivOperator")]
[propput, id(18), helpstring("property IdivOperator")]
HRESULT IdivOperator([in] VARIANT_BOOL newVal);
[propget, id(17), helpstring("property ConcatString")]
[propget, id(19), helpstring("property ConcatString")]
HRESULT ConcatString([out,retval] VARIANT_BOOL *pVal);
[propput, id(17), helpstring("property ConcatString")]
[propput, id(19), helpstring("property ConcatString")]
HRESULT ConcatString([in] VARIANT_BOOL newVal);
[propget, id(18), helpstring("property SupportExtio")]
[propget, id(20), helpstring("property SupportExtio")]
HRESULT SupportExtio([out,retval] VARIANT_BOOL *pVal);
[propput, id(18), helpstring("property SupportExtio")]
[propput, id(20), helpstring("property SupportExtio")]
HRESULT SupportExtio([in] VARIANT_BOOL newVal);
[propget, id(19), helpstring("property SupportBlockless")]
[propget, id(21), helpstring("property SupportBlockless")]
HRESULT SupportBlockless([out,retval] VARIANT_BOOL *pVal);
[propput, id(19), helpstring("property SupportBlockless")]
[propput, id(21), helpstring("property SupportBlockless")]
HRESULT SupportBlockless([in] VARIANT_BOOL newVal);
[propget, id(20), helpstring("property BaseOne")]
[propget, id(22), helpstring("property BaseOne")]
HRESULT BaseOne([out,retval] VARIANT_BOOL *pVal);
[propput, id(20), helpstring("property BaseOne")]
[propput, id(22), helpstring("property BaseOne")]
HRESULT BaseOne([in] VARIANT_BOOL newVal);
[propget, id(21), helpstring("property StripSpaces")]
[propget, id(23), helpstring("property StripSpaces")]
HRESULT StripSpaces([out,retval] VARIANT_BOOL *pVal);
[propput, id(21), helpstring("property StripSpaces")]
[propput, id(23), helpstring("property StripSpaces")]
HRESULT StripSpaces([in] VARIANT_BOOL newVal);
[propget, id(22), helpstring("property EnableNextofile")]
[propget, id(24), helpstring("property EnableNextofile")]
HRESULT EnableNextofile([out,retval] VARIANT_BOOL *pVal);
[propput, id(22), helpstring("property EnableNextofile")]
[propput, id(24), helpstring("property EnableNextofile")]
HRESULT EnableNextofile([in] VARIANT_BOOL newVal);
[propget, id(23), helpstring("property UseCrlf")]
[propget, id(25), helpstring("property UseCrlf")]
HRESULT UseCrlf([out,retval] VARIANT_BOOL *pVal);
[propput, id(23), helpstring("property UseCrlf")]
[propput, id(25), helpstring("property UseCrlf")]
HRESULT UseCrlf([in] VARIANT_BOOL newVal);
[propget, id(24), helpstring("property ArgumentsToEntryPoint")]
[propget, id(26), helpstring("property ArgumentsToEntryPoint")]
HRESULT ArgumentsToEntryPoint([out,retval] VARIANT_BOOL *pVal);
[propput, id(24), helpstring("property ArgumentsToEntryPoint")]
[propput, id(26), helpstring("property ArgumentsToEntryPoint")]
HRESULT ArgumentsToEntryPoint([in] VARIANT_BOOL newVal);
[propget, id(25), helpstring("property EnableReset")]
[propget, id(27), helpstring("property EnableReset")]
HRESULT EnableReset([out,retval] VARIANT_BOOL *pVal);
[propput, id(25), helpstring("property EnableReset")]
[propput, id(27), helpstring("property EnableReset")]
HRESULT EnableReset([in] VARIANT_BOOL newVal);
[propget, id(26), helpstring("property AllowMapToVar")]
[propget, id(28), helpstring("property AllowMapToVar")]
HRESULT AllowMapToVar([out,retval] VARIANT_BOOL *pVal);
[propput, id(26), helpstring("property AllowMapToVar")]
[propput, id(28), helpstring("property AllowMapToVar")]
HRESULT AllowMapToVar([in] VARIANT_BOOL newVal);
[propget, id(27), helpstring("property MaxDepthForBlockParse")]
[propget, id(29), helpstring("property SupportPatternActionBlock")]
HRESULT SupportPatternActionBlock([out,retval] VARIANT_BOOL *pVal);
[propput, id(29), helpstring("property SupportPatternActioinBlock")]
HRESULT SupportPatternActionBlock([in] VARIANT_BOOL newVal);
[propget, id(30), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([out,retval] int *pVal);
[propput, id(27), helpstring("property MaxDepthForBlockParse")]
[propput, id(30), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([in] int newVal);
[propget, id(28), helpstring("property MaxDepthForBlockRun")]
[propget, id(31), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([out,retval] int *pVal);
[propput, id(28), helpstring("property MaxDepthForBlockRun")]
[propput, id(31), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([in] int newVal);
[propget, id(29), helpstring("property MaxDepthForExprParse")]
[propget, id(32), helpstring("property MaxDepthForExprParse")]
HRESULT MaxDepthForExprParse([out,retval] int *pVal);
[propput, id(29), helpstring("property MaxDepthForExprParse")]
[propput, id(32), helpstring("property MaxDepthForExprParse")]
HRESULT MaxDepthForExprParse([in] int newVal);
[propget, id(30), helpstring("property MaxDepthForExprRun")]
[propget, id(33), helpstring("property MaxDepthForExprRun")]
HRESULT MaxDepthForExprRun([out,retval] int *pVal);
[propput, id(30), helpstring("property MaxDepthForExprRun")]
[propput, id(33), helpstring("property MaxDepthForExprRun")]
HRESULT MaxDepthForExprRun([in] int newVal);
[propget, id(31), helpstring("property MaxDepthForRexBuild")]
[propget, id(34), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([out,retval] int *pVal);
[propput, id(31), helpstring("property MaxDepthForRexBuild")]
[propput, id(34), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([in] int newVal);
[propget, id(32), helpstring("property MaxDepthForRexMatch")]
[propget, id(35), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([out,retval] int *pVal);
[propput, id(32), helpstring("property MaxDepthForRexMatch")]
[propput, id(35), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([in] int newVal);
[propget, id(33), helpstring("property EntryPoint")]
[propget, id(36), helpstring("property EntryPoint")]
HRESULT EntryPoint([out,retval] BSTR *pVal);
[propput, id(33), helpstring("property EntryPoint")]
[propput, id(36), helpstring("property EntryPoint")]
HRESULT EntryPoint([in] BSTR newVal);
[propget, id(34), helpstring("property Debug")]
[propget, id(37), helpstring("property Debug")]
HRESULT Debug([out,retval] VARIANT_BOOL *pVal);
[propput, id(34), helpstring("property Debug")]
[propput, id(37), helpstring("property Debug")]
HRESULT Debug([in] VARIANT_BOOL newVal);
[propget, id(35), helpstring("property UseLongLong")]
[propget, id(38), helpstring("property UseLongLong")]
HRESULT UseLongLong([out,retval] VARIANT_BOOL *pVal);
[propput, id(35), helpstring("property UseLongLong")]
[propput, id(38), helpstring("property UseLongLong")]
HRESULT UseLongLong([in] VARIANT_BOOL newVal);
};

View File

@ -10,9 +10,8 @@ ASE is a programming library implementing various programming languages and text
Download the library source code from the following links.
ase-0.3.0.tgz
[[[
* {Link 1,ase-0.3.0.tgz}
* {KLDP.NET,http://kldp.net/frs/?group_id=1050}
]]]
== Documentation ==

View File

@ -10,10 +10,8 @@ ASE는 임베딩을 목적으로 여러가지 프로그래밍언어를 구현하
다음 링크에서 소스코드를 받을수 있다.
ase-0.3.0.tgz
[[[
* {링크 1,ase-0.3.0.tgz}
* 링크 2
* {KLDP.NET,http://kldp.net/frs/?group_id=1050}
]]]
== Documentation ==

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.32 2007/10/10 03:37:49 bacon Exp $
* $Id: Awk.cpp,v 1.34 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -34,7 +34,7 @@ public:
int open (ASE::Net::Awk^ wrapper)
{
this->wrapper = wrapper;
int n = Awk::open ();
int n = ASE::Awk::open ();
this->wrapper = nullptr;
return n;
}
@ -49,7 +49,7 @@ public:
int getOption (ASE::Net::Awk^ wrapper) const
{
this->wrapper = wrapper;
int n = Awk::getOption ();
int n = ASE::Awk::getOption ();
this->wrapper = nullptr;
return n;
}
@ -57,14 +57,14 @@ public:
void setOption (ASE::Net::Awk^ wrapper, int opt)
{
this->wrapper = wrapper;
Awk::setOption (opt);
ASE::Awk::setOption (opt);
this->wrapper = nullptr;
}
size_t getErrorLine (ASE::Net::Awk^ wrapper) const
{
this->wrapper = wrapper;
size_t x = Awk::getErrorLine ();
size_t x = ASE::Awk::getErrorLine ();
this->wrapper = nullptr;
return x;
}
@ -72,7 +72,7 @@ public:
ErrorCode getErrorCode (ASE::Net::Awk^ wrapper) const
{
this->wrapper = wrapper;
ASE::Awk::ErrorCode x = Awk::getErrorCode ();
ASE::Awk::ErrorCode x = ASE::Awk::getErrorCode ();
this->wrapper = nullptr;
return x;
}
@ -80,7 +80,7 @@ public:
const char_t* getErrorMessage (ASE::Net::Awk^ wrapper) const
{
this->wrapper = wrapper;
const char_t* x = Awk::getErrorMessage();
const char_t* x = ASE::Awk::getErrorMessage();
this->wrapper = nullptr;
return x;
}
@ -88,7 +88,7 @@ public:
const char_t* getErrorString (ASE::Net::Awk^ wrapper, ErrorCode num) const
{
this->wrapper = wrapper;
const char_t* x = Awk::getErrorString (num);
const char_t* x = ASE::Awk::getErrorString (num);
this->wrapper = nullptr;
return x;
}
@ -96,35 +96,35 @@ public:
void setError (ASE::Net::Awk^ wrapper, ErrorCode num)
{
this->wrapper = wrapper;
Awk::setError (num);
ASE::Awk::setError (num);
this->wrapper = nullptr;
}
void setError (ASE::Net::Awk^ wrapper, ErrorCode num, size_t line)
{
this->wrapper = wrapper;
Awk::setError (num, line);
ASE::Awk::setError (num, line);
this->wrapper = nullptr;
}
void setError (ASE::Net::Awk^ wrapper, ErrorCode num, size_t line, const char_t* arg, size_t len)
{
this->wrapper = wrapper;
Awk::setError (num, line, arg, len);
ASE::Awk::setError (num, line, arg, len);
this->wrapper = nullptr;
}
void setErrorWithMessage (ASE::Net::Awk^ wrapper, ErrorCode num, size_t line, const char_t* msg)
{
this->wrapper = wrapper;
Awk::setErrorWithMessage (num, line, msg);
ASE::Awk::setErrorWithMessage (num, line, msg);
this->wrapper = nullptr;
}
int setErrorString (ASE::Net::Awk^ wrapper, ErrorCode num, const char_t* msg)
{
this->wrapper = wrapper;
int x = Awk::setErrorString (num, msg);
int x = ASE::Awk::setErrorString (num, msg);
this->wrapper = nullptr;
return x;
}
@ -132,7 +132,7 @@ public:
int parse (ASE::Net::Awk^ wrapper)
{
this->wrapper = wrapper;
int n = Awk::parse ();
int n = ASE::Awk::parse ();
this->wrapper = nullptr;
return n;
}
@ -140,16 +140,25 @@ public:
int run (ASE::Net::Awk^ wrapper, const char_t* main = ASE_NULL,
const char_t** args = ASE_NULL, size_t nargs = 0)
{
// run can't be called more than once because this->wrapper
// can be set to nullptr while another run is under execution.
// for the same reason, you can't call other methods except stop
// untile run ends.
this->wrapper = wrapper;
int n = Awk::run (main, args, nargs);
int n = ASE::Awk::run (main, args, nargs);
this->wrapper = nullptr;
return n;
}
void stop (ASE::Net::Awk^ wrapper)
{
if ((ASE::Net::Awk^)this->wrapper != nullptr) ASE::Awk::stop ();
}
int setWord (ASE::Net::Awk^ wrapper, const char_t* ow, size_t olen, const char_t* nw, size_t nlen)
{
this->wrapper = wrapper;
int n = Awk::setWord (ow, olen, nw, nlen);
int n = ASE::Awk::setWord (ow, olen, nw, nlen);
this->wrapper = nullptr;
return n;
}
@ -157,7 +166,7 @@ public:
int unsetWord (ASE::Net::Awk^ wrapper, const char_t* ow, size_t olen)
{
this->wrapper = wrapper;
int n = Awk::unsetWord (ow, olen);
int n = ASE::Awk::unsetWord (ow, olen);
this->wrapper = nullptr;
return n;
}
@ -165,7 +174,7 @@ public:
int unsetAllWords (ASE::Net::Awk^ wrapper)
{
this->wrapper = wrapper;
int n = Awk::unsetAllWords ();
int n = ASE::Awk::unsetAllWords ();
this->wrapper = nullptr;
return n;
}
@ -173,14 +182,14 @@ public:
void setMaxDepth (ASE::Net::Awk^ wrapper, int ids, size_t depth)
{
this->wrapper = wrapper;
Awk::setMaxDepth (ids, depth);
ASE::Awk::setMaxDepth (ids, depth);
this->wrapper = nullptr;
}
size_t getMaxDepth (ASE::Net::Awk^ wrapper, int id) const
{
this->wrapper = wrapper;
size_t n = Awk::getMaxDepth (id);
size_t n = ASE::Awk::getMaxDepth (id);
this->wrapper = nullptr;
return n;
}
@ -188,14 +197,14 @@ public:
void enableRunCallback (ASE::Net::Awk^ wrapper)
{
this->wrapper = wrapper;
Awk::enableRunCallback ();
ASE::Awk::enableRunCallback ();
this->wrapper = nullptr;
}
void disableRunCallback (ASE::Net::Awk^ wrapper)
{
this->wrapper = wrapper;
Awk::disableRunCallback ();
ASE::Awk::disableRunCallback ();
this->wrapper = nullptr;
}
@ -210,11 +219,10 @@ public:
if (wrapper->OnRunStart != nullptr)
{
//wrapper->OnRunStart (wrapper);
wrapper->OnRunStart (ctx);
try { wrapper->OnRunStart (ctx); }
catch (...) {}
}
// TODO: exception handling when OnRunStart throws an exception.
// may need to destroy gh. or what???
}
void onRunEnd (Run& run)
{
@ -233,7 +241,8 @@ public:
if (wrapper->OnRunEnd != nullptr)
{
//wrapper->OnRunEnd (wrapper);
wrapper->OnRunEnd ((ASE::Net::Awk::Context^)gh.Target);
try { wrapper->OnRunEnd ((ASE::Net::Awk::Context^)gh.Target); }
catch (...) {}
}
gh.Free ();
@ -247,28 +256,28 @@ public:
GCHandle gh = GCHandle::FromIntPtr (ip);
//wrapper->OnRunReturn (wrapper);
wrapper->OnRunReturn ((ASE::Net::Awk::Context^)gh.Target);
try { wrapper->OnRunReturn ((ASE::Net::Awk::Context^)gh.Target); }
catch (...) {}
}
}
void onRunStatement (Run& run, size_t line)
{
if (wrapper->stopRequested) run.stop ();
if (wrapper->OnRunStatement != nullptr)
{
System::IntPtr ip ((void*)run.getCustom ());
GCHandle gh = GCHandle::FromIntPtr (ip);
//wrapper->OnRunStatement (wrapper);
wrapper->OnRunStatement ((ASE::Net::Awk::Context^)gh.Target);
try { wrapper->OnRunStatement ((ASE::Net::Awk::Context^)gh.Target); }
catch (...) {}
}
}
int addGlobal (ASE::Net::Awk^ wrapper, const char_t* name)
{
this->wrapper = wrapper;
int n = Awk::addGlobal (name);
int n = ASE::Awk::addGlobal (name);
this->wrapper = nullptr;
return n;
}
@ -276,7 +285,7 @@ public:
int deleteGlobal (ASE::Net::Awk^ wrapper, const char_t* name)
{
this->wrapper = wrapper;
int n = Awk::deleteGlobal (name);
int n = ASE::Awk::deleteGlobal (name);
this->wrapper = nullptr;
return n;
}
@ -286,7 +295,7 @@ public:
size_t minArgs, size_t maxArgs, FunctionHandler handler)
{
this->wrapper = wrapper;
int n = Awk::addFunction (name, minArgs, maxArgs, handler);
int n = ASE::Awk::addFunction (name, minArgs, maxArgs, handler);
this->wrapper = nullptr;
return n;
}
@ -294,7 +303,7 @@ public:
int deleteFunction (ASE::Net::Awk^ wrapper, const char_t* main)
{
this->wrapper = wrapper;
int n = Awk::deleteFunction (main);
int n = ASE::Awk::deleteFunction (main);
this->wrapper = nullptr;
return n;
}
@ -763,7 +772,7 @@ void Awk::Close ()
bool Awk::Parse ()
{
if (awk != NULL)
if (awk == NULL)
{
SetError (ERROR::NOPER);
return false;
@ -781,7 +790,6 @@ bool Awk::Run ()
bool Awk::Run (System::String^ entryPoint, cli::array<System::String^>^ args)
{
runErrorReported = false;
stopRequested = false;
if (awk == NULL)
{
@ -896,9 +904,16 @@ bool Awk::Run (System::String^ entryPoint, cli::array<System::String^>^ args)
}
}
void Awk::Stop ()
bool Awk::Stop ()
{
stopRequested = true;
if (awk == NULL)
{
SetError (ERROR::NOPER);
return false;
}
awk->stop (this);
return true;
}
bool Awk::AddGlobal (System::String^ name, [System::Runtime::InteropServices::Out] int% id)

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.37 2007/10/10 03:37:49 bacon Exp $
* $Id: Awk.hpp,v 1.39 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -39,13 +39,14 @@ public:
EXTIO = ASE::Awk::OPT_EXTIO,
COPROC = ASE::Awk::OPT_COPROC,
BLOCKLESS = ASE::Awk::OPT_BLOCKLESS,
STRBASEONE = ASE::Awk::OPT_BASEONE,
BASEONE = ASE::Awk::OPT_BASEONE,
STRIPSPACES = ASE::Awk::OPT_STRIPSPACES,
NEXTOFILE = ASE::Awk::OPT_NEXTOFILE,
CRLF = ASE::Awk::OPT_CRLF,
ARGSTOMAIN = ASE::Awk::OPT_ARGSTOMAIN,
RESET = ASE::Awk::OPT_RESET,
MAPTOVAR = ASE::Awk::OPT_MAPTOVAR
MAPTOVAR = ASE::Awk::OPT_MAPTOVAR,
PABLOCK = ASE::Awk::OPT_PABLOCK
};
enum class DEPTH: int
@ -109,6 +110,7 @@ public:
IN = ASE::Awk::ERR_IN,
NOTVAR = ASE::Awk::ERR_NOTVAR,
EXPRES = ASE::Awk::ERR_EXPRES,
FUNC = ASE::Awk::ERR_FUNC,
WHILE = ASE::Awk::ERR_WHILE,
ASSIGN = ASE::Awk::ERR_ASSIGN,
IDENT = ASE::Awk::ERR_IDENT,
@ -444,9 +446,14 @@ public:
Awk^ get () { return this->owner; }
}
bool Stop ()
void Stop ()
{
return run.stop () == 0;
run.stop ();
}
property bool isStop
{
bool get () { return run.isStop(); }
}
void SetError (ASE::Net::Awk::ERROR num)
@ -677,7 +684,7 @@ public:
virtual bool Parse ();
virtual bool Run ();
virtual bool Run (System::String^ entryPoint, cli::array<System::String^>^ args);
virtual void Stop ();
virtual bool Stop ();
delegate void RunStartHandler (Context^ ctx);
delegate void RunEndHandler (Context^ ctx);
@ -795,7 +802,6 @@ public protected:
void RetrieveError ();
bool runErrorReported; // only used if the run-callback is activated.
bool stopRequested;
};
//////////////////////////////

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.42 2007/10/10 03:37:49 bacon Exp $
* $Id: Awk.cpp,v 1.43 2007/10/10 07:03:56 bacon Exp $
*/
#include <ase/awk/StdAwk.hpp>
@ -650,7 +650,8 @@ int awk_main (int argc, ase_char_t* argv[])
{ ASE_T("crfl"), TestAwk::OPT_CRLF },
{ ASE_T("argstomain"), TestAwk::OPT_ARGSTOMAIN },
{ ASE_T("reset"), TestAwk::OPT_RESET },
{ ASE_T("maptovar"), TestAwk::OPT_MAPTOVAR }
{ ASE_T("maptovar"), TestAwk::OPT_MAPTOVAR },
{ ASE_T("pablock"), TestAwk::OPT_PABLOCK }
};
if (awk.open() == -1)

View File

@ -76,7 +76,7 @@ namespace ase.com
// btnRun
//
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.Location = new System.Drawing.Point(76, 303);
this.btnRun.Location = new System.Drawing.Point(78, 302);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 2;
@ -270,7 +270,7 @@ namespace ase.com
this.groupBox1.Controls.Add(this.lbxArguments);
this.groupBox1.Location = new System.Drawing.Point(0, 51);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(154, 247);
this.groupBox1.Size = new System.Drawing.Size(158, 245);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Arguments";
@ -278,11 +278,11 @@ namespace ase.com
// chkPassArgumentsToEntryPoint
//
this.chkPassArgumentsToEntryPoint.AutoSize = true;
this.chkPassArgumentsToEntryPoint.Location = new System.Drawing.Point(19, 211);
this.chkPassArgumentsToEntryPoint.Location = new System.Drawing.Point(6, 209);
this.chkPassArgumentsToEntryPoint.Name = "chkPassArgumentsToEntryPoint";
this.chkPassArgumentsToEntryPoint.Size = new System.Drawing.Size(119, 17);
this.chkPassArgumentsToEntryPoint.Size = new System.Drawing.Size(146, 17);
this.chkPassArgumentsToEntryPoint.TabIndex = 4;
this.chkPassArgumentsToEntryPoint.Text = "Pass To Entry Point";
this.chkPassArgumentsToEntryPoint.Text = "Arguments To Entry Point";
this.chkPassArgumentsToEntryPoint.UseVisualStyleBackColor = true;
//
// btnClearAllArguments
@ -319,7 +319,7 @@ namespace ase.com
this.lbxArguments.FormattingEnabled = true;
this.lbxArguments.Location = new System.Drawing.Point(3, 16);
this.lbxArguments.Name = "lbxArguments";
this.lbxArguments.Size = new System.Drawing.Size(147, 134);
this.lbxArguments.Size = new System.Drawing.Size(151, 134);
this.lbxArguments.TabIndex = 0;
//
// AwkForm

View File

@ -45,10 +45,9 @@ namespace ase.net
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.cbxEntryPoint = new System.Windows.Forms.ComboBox();
this.panel2 = new System.Windows.Forms.Panel();
this.clbOptions = new System.Windows.Forms.CheckedListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.chkStripSpaces = new System.Windows.Forms.CheckBox();
this.chkPassArgumentsToEntryPoint = new System.Windows.Forms.CheckBox();
this.btnClearAllArguments = new System.Windows.Forms.Button();
this.btnAddArgument = new System.Windows.Forms.Button();
this.tbxArgument = new System.Windows.Forms.TextBox();
@ -78,7 +77,7 @@ namespace ase.net
// btnRun
//
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.Location = new System.Drawing.Point(78, 327);
this.btnRun.Location = new System.Drawing.Point(78, 484);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 2;
@ -246,6 +245,7 @@ namespace ase.net
// panel2
//
this.panel2.AutoScroll = true;
this.panel2.Controls.Add(this.clbOptions);
this.panel2.Controls.Add(this.btnRun);
this.panel2.Controls.Add(this.groupBox2);
this.panel2.Controls.Add(this.groupBox1);
@ -255,6 +255,14 @@ namespace ase.net
this.panel2.Size = new System.Drawing.Size(157, 510);
this.panel2.TabIndex = 5;
//
// clbOptions
//
this.clbOptions.FormattingEnabled = true;
this.clbOptions.Location = new System.Drawing.Point(0, 279);
this.clbOptions.Name = "clbOptions";
this.clbOptions.Size = new System.Drawing.Size(157, 199);
this.clbOptions.TabIndex = 3;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cbxEntryPoint);
@ -268,41 +276,17 @@ namespace ase.net
// groupBox1
//
this.groupBox1.AutoSize = true;
this.groupBox1.Controls.Add(this.chkStripSpaces);
this.groupBox1.Controls.Add(this.chkPassArgumentsToEntryPoint);
this.groupBox1.Controls.Add(this.btnClearAllArguments);
this.groupBox1.Controls.Add(this.btnAddArgument);
this.groupBox1.Controls.Add(this.tbxArgument);
this.groupBox1.Controls.Add(this.lbxArguments);
this.groupBox1.Location = new System.Drawing.Point(0, 51);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(154, 270);
this.groupBox1.Size = new System.Drawing.Size(154, 222);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Arguments";
//
// chkStripSpaces
//
this.chkStripSpaces.AutoSize = true;
this.chkStripSpaces.Checked = true;
this.chkStripSpaces.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkStripSpaces.Location = new System.Drawing.Point(19, 234);
this.chkStripSpaces.Name = "chkStripSpaces";
this.chkStripSpaces.Size = new System.Drawing.Size(86, 17);
this.chkStripSpaces.TabIndex = 5;
this.chkStripSpaces.Text = "Strip Spaces";
this.chkStripSpaces.UseVisualStyleBackColor = true;
//
// chkPassArgumentsToEntryPoint
//
this.chkPassArgumentsToEntryPoint.AutoSize = true;
this.chkPassArgumentsToEntryPoint.Location = new System.Drawing.Point(19, 211);
this.chkPassArgumentsToEntryPoint.Name = "chkPassArgumentsToEntryPoint";
this.chkPassArgumentsToEntryPoint.Size = new System.Drawing.Size(119, 17);
this.chkPassArgumentsToEntryPoint.TabIndex = 4;
this.chkPassArgumentsToEntryPoint.Text = "Pass To Entry Point";
this.chkPassArgumentsToEntryPoint.UseVisualStyleBackColor = true;
//
// btnClearAllArguments
//
this.btnClearAllArguments.Location = new System.Drawing.Point(3, 181);
@ -350,6 +334,7 @@ namespace ase.net
this.Controls.Add(this.statusStrip1);
this.Name = "AwkForm";
this.Text = "ASE.NET.AWK";
this.Load += new System.EventHandler(this.AwkForm_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
@ -385,7 +370,6 @@ namespace ase.net
private System.Windows.Forms.Button btnAddArgument;
private System.Windows.Forms.TextBox tbxArgument;
private System.Windows.Forms.ListBox lbxArguments;
private System.Windows.Forms.CheckBox chkPassArgumentsToEntryPoint;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
@ -395,6 +379,6 @@ namespace ase.net
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkStripSpaces;
private System.Windows.Forms.CheckedListBox clbOptions;
}
}

Binary file not shown.