From 4d79c3ce5e8f7aad17abf914ce73dce1df7f7fd0 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 30 May 2007 00:10:00 +0000 Subject: [PATCH] Recovered from cvs revision 2007-05-29 15:08:00 --- ase/ase.sln | 9 ----- ase/awk/Awk.cpp | 6 +-- ase/awk/Awk.hpp | 6 +-- ase/awk/func.c | 74 +++++++++++++++++----------------- ase/awk/run.c | 27 ++++++++++--- ase/cnt/asecnt.csproj | 4 +- ase/doc/ase-en.man | 5 +-- ase/doc/ase-ko.man | 4 +- ase/test/awk/AseAwk.java | 18 +++++++-- ase/test/cnt/asetestcnt.csproj | 6 +-- 10 files changed, 86 insertions(+), 73 deletions(-) diff --git a/ase/ase.sln b/ase/ase.sln index a2598635..210d51f0 100644 --- a/ase/ase.sln +++ b/ase/ase.sln @@ -39,13 +39,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestlsp", "test\lsp\aset {42FE7CED-34B7-45C8-92C9-8856E16640D2} = {42FE7CED-34B7-45C8-92C9-8856E16640D2} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asetestcnt", "test\cnt\asetestcnt.csproj", "{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asecnt", "cnt\asecnt.csproj", "{7F679165-41FB-4E1E-B3F5-23C5EE94166A}" - ProjectSection(ProjectDependencies) = postProject - {963AF7B5-12E6-42B6-8CBE-89136C1A109B} = {963AF7B5-12E6-42B6-8CBE-89136C1A109B} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk++", "awk\aseawk++.vcproj", "{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}" ProjectSection(ProjectDependencies) = postProject {5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83} @@ -57,8 +50,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestawk++", "test\awk\as {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F} = {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asenet", "net\asenet.vcproj", "{A63E9DF9-1D47-4D81-834C-1D40406C18C4}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/ase/awk/Awk.cpp b/ase/awk/Awk.cpp index f3c77421..e8af1757 100644 --- a/ase/awk/Awk.cpp +++ b/ase/awk/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.38 2007/05/25 11:49:42 bacon Exp $ + * $Id: Awk.cpp,v 1.40 2007/05/28 13:53:31 bacon Exp $ */ #include @@ -364,7 +364,7 @@ namespace ASE { } - int Awk::Run::stop () + int Awk::Run::stop () const { ASE_ASSERT (this->run != ASE_NULL); return ase_awk_stop (this->run); @@ -566,7 +566,7 @@ namespace ASE ase_awk_setmaxdepth (awk, ids, depth); } - int Awk::getMaxDepth (int id) + int Awk::getMaxDepth (int id) const { ASE_ASSERT (awk != ASE_NULL); return ase_awk_getmaxdepth (awk, id); diff --git a/ase/awk/Awk.hpp b/ase/awk/Awk.hpp index 4757528b..bf283325 100644 --- a/ase/awk/Awk.hpp +++ b/ase/awk/Awk.hpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.hpp,v 1.36 2007/05/25 11:49:42 bacon Exp $ + * $Id: Awk.hpp,v 1.38 2007/05/28 13:53:31 bacon Exp $ */ #ifndef _ASE_AWK_AWK_HPP_ @@ -363,7 +363,7 @@ namespace ASE Run (Awk* awk); public: - int stop (); + int stop () const; ErrorCode getErrorCode () const; size_t getErrorLine () const; @@ -407,7 +407,7 @@ namespace ASE }; virtual void setMaxDepth (int ids, size_t depth); - virtual int getMaxDepth (int id); + virtual int getMaxDepth (int id) const; virtual int parse (); virtual int run (const char_t* main = ASE_NULL, diff --git a/ase/awk/func.c b/ase/awk/func.c index 84732b9a..bf49e395 100644 --- a/ase/awk/func.c +++ b/ase/awk/func.c @@ -1,23 +1,23 @@ /* - * $Id: func.c,v 1.4 2007/05/05 16:32:46 bacon Exp $ + * $Id: func.c,v 1.5 2007/05/28 13:54:47 bacon Exp $ * * {License} */ #include -static int __bfn_close (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_fflush (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_index (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_length (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_substr (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_split (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_tolower (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_toupper (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_gsub (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_sub (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_match (ase_awk_run_t*, const ase_char_t*, ase_size_t); -static int __bfn_sprintf (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_close (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_fflush (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_index (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_length (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_substr (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_split (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_tolower (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_toupper (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_gsub (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_sub (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_match (ase_awk_run_t*, const ase_char_t*, ase_size_t); +static int bfn_sprintf (ase_awk_run_t*, const ase_char_t*, ase_size_t); #undef MAX #define MAX ASE_TYPE_UNSIGNED_MAX(ase_size_t) @@ -25,20 +25,20 @@ static int __bfn_sprintf (ase_awk_run_t*, const ase_char_t*, ase_size_t); static ase_awk_bfn_t __sys_bfn[] = { /* io functions */ - { {ASE_T("close"), 5}, ASE_AWK_EXTIO, {1, 1, ASE_NULL}, __bfn_close}, - { {ASE_T("fflush"), 6}, ASE_AWK_EXTIO, {0, 1, ASE_NULL}, __bfn_fflush}, + { {ASE_T("close"), 5}, ASE_AWK_EXTIO, {1, 1, ASE_NULL}, bfn_close}, + { {ASE_T("fflush"), 6}, ASE_AWK_EXTIO, {0, 1, ASE_NULL}, bfn_fflush}, /* string functions */ - { {ASE_T("index"), 5}, 0, {2, 2, ASE_NULL}, __bfn_index}, - { {ASE_T("substr"), 6}, 0, {2, 3, ASE_NULL}, __bfn_substr}, - { {ASE_T("length"), 6}, 0, {1, 1, ASE_NULL}, __bfn_length}, - { {ASE_T("split"), 5}, 0, {2, 3, ASE_T("vrv")}, __bfn_split}, - { {ASE_T("tolower"), 7}, 0, {1, 1, ASE_NULL}, __bfn_tolower}, - { {ASE_T("toupper"), 7}, 0, {1, 1, ASE_NULL}, __bfn_toupper}, - { {ASE_T("gsub"), 4}, 0, {2, 3, ASE_T("xvr")}, __bfn_gsub}, - { {ASE_T("sub"), 3}, 0, {2, 3, ASE_T("xvr")}, __bfn_sub}, - { {ASE_T("match"), 5}, 0, {2, 2, ASE_T("vx")}, __bfn_match}, - { {ASE_T("sprintf"), 7}, 0, {1, MAX, ASE_NULL}, __bfn_sprintf}, + { {ASE_T("index"), 5}, 0, {2, 2, ASE_NULL}, bfn_index}, + { {ASE_T("substr"), 6}, 0, {2, 3, ASE_NULL}, bfn_substr}, + { {ASE_T("length"), 6}, 0, {1, 1, ASE_NULL}, bfn_length}, + { {ASE_T("split"), 5}, 0, {2, 3, ASE_T("vrv")}, bfn_split}, + { {ASE_T("tolower"), 7}, 0, {1, 1, ASE_NULL}, bfn_tolower}, + { {ASE_T("toupper"), 7}, 0, {1, 1, ASE_NULL}, bfn_toupper}, + { {ASE_T("gsub"), 4}, 0, {2, 3, ASE_T("xvr")}, bfn_gsub}, + { {ASE_T("sub"), 3}, 0, {2, 3, ASE_T("xvr")}, bfn_sub}, + { {ASE_T("match"), 5}, 0, {2, 2, ASE_T("vx")}, bfn_match}, + { {ASE_T("sprintf"), 7}, 0, {1, MAX, ASE_NULL}, bfn_sprintf}, { {ASE_NULL, 0}, 0, {0, 0, ASE_NULL}, ASE_NULL} }; @@ -178,7 +178,7 @@ ase_awk_bfn_t* ase_awk_getbfn ( return ASE_NULL; } -static int __bfn_close ( +static int bfn_close ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -289,7 +289,7 @@ static int __flush_extio ( return n; } -static int __bfn_fflush ( +static int bfn_fflush ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -376,7 +376,7 @@ skip_flush: return 0; } -static int __bfn_index ( +static int bfn_index ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -439,7 +439,7 @@ static int __bfn_index ( return 0; } -static int __bfn_length ( +static int bfn_length ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -474,7 +474,7 @@ static int __bfn_length ( return 0; } -static int __bfn_substr ( +static int bfn_substr ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -545,7 +545,7 @@ static int __bfn_substr ( return 0; } -static int __bfn_split ( +static int bfn_split ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -797,7 +797,7 @@ static int __bfn_split ( return 0; } -static int __bfn_tolower ( +static int bfn_tolower ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -837,7 +837,7 @@ static int __bfn_tolower ( return 0; } -static int __bfn_toupper ( +static int bfn_toupper ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -1167,19 +1167,19 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count) return 0; } -static int __bfn_gsub ( +static int bfn_gsub ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { return __substitute (run, 0); } -static int __bfn_sub ( +static int bfn_sub ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { return __substitute (run, 1); } -static int __bfn_match ( +static int bfn_match ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; @@ -1298,7 +1298,7 @@ static int __bfn_match ( return 0; } -static int __bfn_sprintf ( +static int bfn_sprintf ( ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl) { ase_size_t nargs; diff --git a/ase/awk/run.c b/ase/awk/run.c index 130680fb..254b5b63 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.7 2007/05/19 16:45:27 bacon Exp $ + * $Id: run.c,v 1.8 2007/05/28 13:53:31 bacon Exp $ * * {License} */ @@ -1719,12 +1719,17 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde) return n; } +#define ON_STATEMENT(run,nde) \ + if ((run)->cbs != ASE_NULL && \ + (run)->cbs->on_statement != ASE_NULL) \ + { \ + (run)->cbs->on_statement ( \ + run, (nde)->line, (run)->custom_data); \ + } + static int __run_statement (ase_awk_run_t* run, ase_awk_nde_t* nde) { - if (run->cbs != ASE_NULL && run->cbs->on_statement != ASE_NULL) - { - run->cbs->on_statement (run, nde->line, run->custom_data); - } + ON_STATEMENT (run, nde); switch (nde->type) { @@ -1889,6 +1894,8 @@ static int __run_while (ase_awk_run_t* run, ase_awk_nde_while_t* nde) while (1) { + ON_STATEMENT (run, nde->test); + test = __eval_expression (run, nde->test); if (test == ASE_NULL) return -1; @@ -1920,6 +1927,7 @@ static int __run_while (ase_awk_run_t* run, ase_awk_nde_while_t* nde) run->exit_level = EXIT_NONE; } else if (run->exit_level != EXIT_NONE) break; + } } else if (nde->type == ASE_AWK_NDE_DOWHILE) @@ -1943,6 +1951,8 @@ static int __run_while (ase_awk_run_t* run, ase_awk_nde_while_t* nde) } else if (run->exit_level != EXIT_NONE) break; + ON_STATEMENT (run, nde->test); + test = __eval_expression (run, nde->test); if (test == ASE_NULL) return -1; @@ -1969,6 +1979,8 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde) if (nde->init != ASE_NULL) { ASE_ASSERT (nde->init->next == ASE_NULL); + + ON_STATEMENT (run, nde->init); val = __eval_expression(run,nde->init); if (val == ASE_NULL) return -1; @@ -1986,6 +1998,7 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde) * the for statement are allowed */ ASE_ASSERT (nde->test->next == ASE_NULL); + ON_STATEMENT (run, nde->test); test = __eval_expression (run, nde->test); if (test == ASE_NULL) return -1; @@ -2025,7 +2038,9 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde) if (nde->incr != ASE_NULL) { ASE_ASSERT (nde->incr->next == ASE_NULL); - val = __eval_expression(run,nde->incr); + + ON_STATEMENT (run, nde->incr); + val = __eval_expression (run, nde->incr); if (val == ASE_NULL) return -1; ase_awk_refupval (run, val); diff --git a/ase/cnt/asecnt.csproj b/ase/cnt/asecnt.csproj index c161624c..6fd89325 100644 --- a/ase/cnt/asecnt.csproj +++ b/ase/cnt/asecnt.csproj @@ -7,7 +7,7 @@ {7F679165-41FB-4E1E-B3F5-23C5EE94166A} Library Properties - AESCNT + ASECNT asecnt @@ -55,4 +55,4 @@ --> - \ No newline at end of file + diff --git a/ase/doc/ase-en.man b/ase/doc/ase-en.man index 2779be1b..a699b8fb 100644 --- a/ase/doc/ase-en.man +++ b/ase/doc/ase-en.man @@ -10,10 +10,9 @@ ASE is a programming library implementing various programming languages and text Download the library source code from the following links. -ase-0.1.0.tgz +ase-0.2.0.tgz [[[ -* {Link 1,ase-0.1.0.tgz} -* Link 2 +* {Link 1,ase-0.2.0.tgz} ]]] == Documentation == diff --git a/ase/doc/ase-ko.man b/ase/doc/ase-ko.man index 4ee3e885..0116453f 100644 --- a/ase/doc/ase-ko.man +++ b/ase/doc/ase-ko.man @@ -10,9 +10,9 @@ ASE는 임베딩을 목적으로 여러가지 프로그래밍언어를 구현하 다음 링크에서 소스코드를 받을수 있다. -ase-0.1.0.tgz +ase-0.2.0.tgz [[[ -* {링크 1,ase-0.1.0.tgz} +* {링크 1,ase-0.2.0.tgz} * 링크 2 ]]] diff --git a/ase/test/awk/AseAwk.java b/ase/test/awk/AseAwk.java index a41d625c..e9938da8 100644 --- a/ase/test/awk/AseAwk.java +++ b/ase/test/awk/AseAwk.java @@ -1,15 +1,27 @@ /* - * $Id: AseAwk.java,v 1.7 2007/05/26 10:23:52 bacon Exp $ + * $Id: AseAwk.java,v 1.8 2007/05/28 10:29:57 bacon Exp $ */ import java.awt.*; import java.awt.event.*; -import java.io.*; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.Reader; +import java.io.Writer; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.IOException; + import java.util.LinkedList; import java.util.ArrayList; import java.util.Iterator; import java.net.URL; -import ase.awk.*; + +import ase.awk.StdAwk; +import ase.awk.Console; public class AseAwk extends StdAwk { diff --git a/ase/test/cnt/asetestcnt.csproj b/ase/test/cnt/asetestcnt.csproj index a8c1e213..550dfae7 100644 --- a/ase/test/cnt/asetestcnt.csproj +++ b/ase/test/cnt/asetestcnt.csproj @@ -78,10 +78,6 @@ {7F679165-41FB-4E1E-B3F5-23C5EE94166A} asecnt - - {A63E9DF9-1D47-4D81-834C-1D40406C18C4} - asenet - - \ No newline at end of file +