diff --git a/ase/ase.sln b/ase/ase.sln index cbd564ff..c7d25494 100644 --- a/ase/ase.sln +++ b/ase/ase.sln @@ -18,11 +18,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk_jni", "awk\aseawk_jn EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asecom", "com\asecom.vcproj", "{963AF7B5-12E6-42B6-8CBE-89136C1A109B}" ProjectSection(ProjectDependencies) = postProject - {5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83} + {17621C83-40C9-4305-BAF9-132E250B5FE3} = {17621C83-40C9-4305-BAF9-132E250B5FE3} {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} = {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} + {5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestawk", "test\awk\asetestawk.vcproj", "{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk", "test\awk\aseawk.vcproj", "{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}" ProjectSection(ProjectDependencies) = postProject {5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83} {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} = {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} @@ -33,7 +34,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aselsp", "lsp\aselsp.vcproj {17621C83-40C9-4305-BAF9-132E250B5FE3} = {17621C83-40C9-4305-BAF9-132E250B5FE3} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestlsp", "test\lsp\asetestlsp.vcproj", "{868702B0-CB6B-4F1D-B98A-32193347EFAF}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aselsp", "test\lsp\aselsp.vcproj", "{868702B0-CB6B-4F1D-B98A-32193347EFAF}" ProjectSection(ProjectDependencies) = postProject {42FE7CED-34B7-45C8-92C9-8856E16640D2} = {42FE7CED-34B7-45C8-92C9-8856E16640D2} {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} = {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} @@ -44,7 +45,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk++", "awk\aseawk++.vc {5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestawk++", "test\awk\asetestawk++.vcproj", "{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk++", "test\awk\aseawk++.vcproj", "{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}" ProjectSection(ProjectDependencies) = postProject {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F} = {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F} {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5} = {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5} @@ -55,7 +56,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asenet", "net\asenet.vcproj {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5} = {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asetestnet", "test\net\asetestnet.csproj", "{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asenet", "test\net\asenet.csproj", "{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8A2F5860-6563-4617-BCE0-460F915007F8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -191,4 +194,10 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {868702B0-CB6B-4F1D-B98A-32193347EFAF} = {8A2F5860-6563-4617-BCE0-460F915007F8} + {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98} = {8A2F5860-6563-4617-BCE0-460F915007F8} + {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B} = {8A2F5860-6563-4617-BCE0-460F915007F8} + {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F} = {8A2F5860-6563-4617-BCE0-460F915007F8} + EndGlobalSection EndGlobal diff --git a/ase/awk/Awk.cpp b/ase/awk/Awk.cpp index 67381b77..c3135f8e 100644 --- a/ase/awk/Awk.cpp +++ b/ase/awk/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.49 2007/08/21 14:24:37 bacon Exp $ + * $Id: Awk.cpp,v 1.51 2007/08/24 15:11:36 bacon Exp $ */ @@ -441,6 +441,22 @@ namespace ASE } } + void Awk::setError ( + ErrorCode code, size_t line, const char_t* msg) + { + if (awk != ASE_NULL) + { + ase_awk_seterrmsg (awk, code, line, msg); + retrieveError (); + } + else + { + this->errnum = code; + this->errlin = line; + ase_strxcpy (this->errmsg, ASE_COUNTOF(this->errmsg), msg); + } + } + void Awk::clearError () { this->errnum = ERR_NOERR; @@ -569,12 +585,18 @@ namespace ASE ase_awk_setmaxdepth (awk, ids, depth); } - size_t Awk::getMaxDepth (int id) const + Awk::size_t Awk::getMaxDepth (int id) const { ASE_ASSERT (awk != ASE_NULL); return ase_awk_getmaxdepth (awk, id); } + const Awk::char_t* Awk::getErrorString (ErrorCode num) const + { + ASE_ASSERT (awk != ASE_NULL); + return ase_awk_geterrstr (awk, (int)num); + } + int Awk::setErrorString (ErrorCode num, const char_t* str) { ASE_ASSERT (awk != ASE_NULL); diff --git a/ase/awk/Awk.hpp b/ase/awk/Awk.hpp index b87ad1f9..9972f7eb 100644 --- a/ase/awk/Awk.hpp +++ b/ase/awk/Awk.hpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.hpp,v 1.47 2007/08/21 14:24:37 bacon Exp $ + * $Id: Awk.hpp,v 1.48 2007/08/24 13:17:59 bacon Exp $ */ #ifndef _ASE_AWK_AWK_HPP_ @@ -389,6 +389,8 @@ namespace ASE protected: void setError (ErrorCode code, size_t line = 0, const char_t* arg = ASE_NULL, size_t len = 0); + void setError (ErrorCode code, size_t line, const char_t* msg); + void clearError (); void retrieveError (); @@ -412,6 +414,7 @@ namespace ASE virtual void setMaxDepth (int ids, size_t depth); virtual size_t getMaxDepth (int id) const; + virtual const char_t* getErrorString (ErrorCode num) const; virtual int setErrorString (ErrorCode num, const char_t* str); virtual int setWord ( diff --git a/ase/awk/awk.h b/ase/awk/awk.h index e68a0d82..16da7509 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.8 2007/06/29 11:36:45 bacon Exp $ + * $Id: awk.h,v 1.9 2007/08/24 13:17:59 bacon Exp $ * * {License} */ @@ -202,12 +202,12 @@ enum ase_awk_errnum_t ASE_AWK_ENOMEM, /* out of memory */ ASE_AWK_ENOSUP, /* not supported */ ASE_AWK_ENOPER, /* operation not allowed */ - ASE_AWK_ENODEV, /* function '%.*s' not found */ + ASE_AWK_ENODEV, /* no such device */ ASE_AWK_ENOSPC, /* no space left on device */ ASE_AWK_EMFILE, /* too many open files */ ASE_AWK_EMLINK, /* too many links */ ASE_AWK_EAGAIN, /* resource temporarily unavailable */ - ASE_AWK_ENOENT, /* file or data not existing */ + ASE_AWK_ENOENT, /* "'%.*s' not existing */ ASE_AWK_EEXIST, /* file or data exists */ ASE_AWK_EFTBIG, /* file or data too big */ ASE_AWK_ETBUSY, /* system too busy */ @@ -399,7 +399,10 @@ int ase_awk_seterrstr (ase_awk_t* awk, int num, const ase_char_t* str); int ase_awk_geterrnum (ase_awk_t* awk); ase_size_t ase_awk_geterrlin (ase_awk_t* awk); const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk); + void ase_awk_seterrnum (ase_awk_t* awk, int errnum); +void ase_awk_seterrmsg (ase_awk_t* awk, + int errnum, ase_size_t errlin, const ase_char_t* errmsg); void ase_awk_geterror ( ase_awk_t* awk, int* errnum, @@ -463,6 +466,8 @@ int ase_awk_getrunerrnum (ase_awk_run_t* run); ase_size_t ase_awk_getrunerrlin (ase_awk_run_t* run); const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run); void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum); +void ase_awk_setrunerrmsg (ase_awk_run_t* run, + int errnum, ase_size_t errlin, const ase_char_t* errmsg); void ase_awk_getrunerror ( ase_awk_run_t* run, int* errnum, diff --git a/ase/awk/err.c b/ase/awk/err.c index 3e573f4c..cf4cafd7 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.5 2007/06/29 11:36:45 bacon Exp $ + * $Id: err.c,v 1.6 2007/08/24 13:17:59 bacon Exp $ * * {License} */ @@ -219,6 +219,14 @@ void ase_awk_seterrnum (ase_awk_t* awk, int errnum) awk->errmsg[0] = ASE_T('\0'); } +void ase_awk_seterrmsg (ase_awk_t* awk, + int errnum, ase_size_t errlin, const ase_char_t* errmsg) +{ + awk->errnum = errnum; + awk->errlin = errlin; + ase_strxcpy (awk->errmsg, ASE_COUNTOF(awk->errmsg), errmsg); +} + void ase_awk_seterror ( ase_awk_t* awk, int errnum, ase_size_t errlin, const ase_cstr_t* errarg, ase_size_t argcnt) @@ -346,6 +354,14 @@ void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum) run->errmsg[0] = ASE_T('\0'); } +void ase_awk_setrunerrmsg (ase_awk_run_t* run, + int errnum, ase_size_t errlin, const ase_char_t* errmsg) +{ + run->errnum = errnum; + run->errlin = errlin; + ase_strxcpy (run->errmsg, ASE_COUNTOF(run->errmsg), errmsg); +} + void ase_awk_getrunerror ( ase_awk_run_t* run, int* errnum, ase_size_t* errlin, const ase_char_t** errmsg) diff --git a/ase/change.log b/ase/change.log index 192db5fa..de47dcc7 100644 --- a/ase/change.log +++ b/ase/change.log @@ -2,6 +2,7 @@ * added ase_awk_setword to enable customization of keywords and intrinsic function names. +* added ase_awk_seterrmsg to set the error message to be any string given * added setWord/unsetWord method to the awk c++ class (awk/Awk.cpp) * added setErrorString method to the awk c++ class (awk/Awk.cpp) * added setWord/unsetWord method to the awk java class (awk/Awk.java) diff --git a/ase/net/Awk.cpp b/ase/net/Awk.cpp index 1e04bdab..7001424d 100644 --- a/ase/net/Awk.cpp +++ b/ase/net/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.21 2007/08/22 13:56:21 bacon Exp $ + * $Id: Awk.cpp,v 1.22 2007/08/24 13:17:59 bacon Exp $ */ #include "stdafx.h" @@ -60,6 +60,22 @@ namespace ASE this->wrapper = nullptr; } + size_t getErrorLine (ASE::Net::Awk^ wrapper) const + { + this->wrapper = wrapper; + size_t x = Awk::getErrorLine (); + this->wrapper = nullptr; + return x; + } + + ErrorCode getErrorCode (ASE::Net::Awk^ wrapper) const + { + this->wrapper = wrapper; + ASE::Awk::ErrorCode x = Awk::getErrorCode (); + this->wrapper = nullptr; + return x; + } + const char_t* getErrorMessage (ASE::Net::Awk^ wrapper) const { this->wrapper = wrapper; @@ -68,11 +84,12 @@ namespace ASE return x; } - void setError (ASE::Net::Awk^ wrapper) + const char_t* getErrorString (ASE::Net::Awk^ wrapper, ErrorCode num) const { this->wrapper = wrapper; - //Awk::setError (code); + const char_t* x = Awk::getErrorString(num); this->wrapper = nullptr; + return x; } int parse (ASE::Net::Awk^ wrapper) @@ -147,6 +164,8 @@ namespace ASE void onRunStart (const Run& run) { + wrapper->runErrorReported = false; + if (wrapper->OnRunStart != nullptr) { wrapper->OnRunStart (wrapper); @@ -154,15 +173,13 @@ namespace ASE } void onRunEnd (const Run& run) { - if (run.getErrorCode() != ERR_NOERR) + ErrorCode code = run.getErrorCode(); + if (code != ERR_NOERR) { - // TODO: SET THE ERROR CODE TO THIS AWK OBJECT... - // TODO: set the error properly when an error is returned through this callback. - // this callback should always be available.... - ASE::Awk::setError (run.getErrorCode(), run.getErrorLine()); - - // TODO: also make Run to return false in this case. Unlike normal c++ awk, this version of awk doesn't support multiple run instances. - // wrapper->runFailureReported = true; + wrapper->runErrorReported = true; + wrapper->errMsg = gcnew System::String (run.getErrorMessage()); + wrapper->errLine = run.getErrorLine(); + wrapper->errCode = (ASE::Net::Awk::ERROR)code; } if (wrapper->OnRunEnd != nullptr) @@ -581,21 +598,21 @@ namespace ASE awk = new ASE::MojoAwk (); if (awk->open (this) == -1) { - // TODO:... - //throw new AwkException ("cannot open awk"); + throw gcnew System::Exception (gcnew System::String(awk->getErrorMessage(this))); } //option = (OPTION)(awk->getOption (this) | MojoAwk::OPT_CRLF); option = (OPTION)(awk->getOption (this) | ASE::Awk::OPT_CRLF); awk->setOption (this, (int)option); - errorMsg = ""; + errMsg = ""; + errLine = 0; + errCode = ASE::Net::Awk::ERROR::NOERR; + runErrorReported = false; } Awk::~Awk () { -System::Diagnostics::Debug::Print ("Awk::~Awk"); - if (awk != NULL) { awk->close (this); @@ -613,7 +630,6 @@ System::Diagnostics::Debug::Print ("Awk::~Awk"); Awk::!Awk () { -System::Diagnostics::Debug::Print ("Awk::!Awk"); if (awk != NULL) { awk->close (this); @@ -622,13 +638,6 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); } } - System::String^ Awk::ErrorMessage::get () - { - if (awk != NULL) - this->errorMsg = gcnew System::String(awk->getErrorMessage (this)); - return this->errorMsg; - } - Awk::OPTION Awk::Option::get () { if (awk != NULL) this->option = (OPTION)awk->getOption (this); @@ -660,8 +669,14 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); bool Awk::Parse () { - if (awk == NULL) return false; - return awk->parse (this) == 0; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } + bool r = (awk->parse (this) == 0); + if (!r) { retrieveError (); } + return r; } bool Awk::Run () @@ -671,7 +686,13 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); bool Awk::Run (System::String^ entryPoint, cli::array^ args) { - if (awk == NULL) return false; + runErrorReported = false; + + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } if (OnRunStart != nullptr || OnRunEnd != nullptr || OnRunReturn != nullptr || OnRunStatement != nullptr) @@ -683,12 +704,18 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); { if (entryPoint == nullptr || entryPoint->Length <= 0) { - return awk->run (this) == 0; + bool r = (awk->run (this) == 0); + if (runErrorReported) r = false; + else if (!r) retrieveError (); + return r; } else { cli::pin_ptr nptr = PtrToStringChars(entryPoint); - return awk->run (this, nptr) == 0; + bool r = (awk->run (this, nptr) == 0); + if (runErrorReported) r = false; + else if (!r) retrieveError (); + return r; } } else @@ -703,7 +730,7 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); ptr = (ASE::Awk::char_t**)awk->allocMem (nargs * ASE_SIZEOF(ASE::Awk::char_t*)); if (ptr == ASE_NULL) { - // TODO: error handling + setError (ERROR::NOMEM); return false; } for (int i = 0; i < nargs; i++) ptr[i] = ASE_NULL; @@ -714,6 +741,7 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); if (ptr[i] == ASE_NULL) { r = false; + setError (ERROR::NOMEM); goto exit_run; } memcpy (ptr[i], nptr, args[i]->Length*ASE_SIZEOF(ASE::Awk::char_t)); @@ -741,10 +769,14 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); ptr[i] = ASE_NULL; } } - awk->freeMem (ptr); + + awk->freeMem (ptr); ptr = ASE_NULL; } + if (runErrorReported) r = false; + else if (!r) retrieveError (); + return r; } catch (...) @@ -763,7 +795,7 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); ptr = ASE_NULL; } - // TODO: error... + setError (ERROR::NOMEM); return false; } } @@ -773,20 +805,30 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); System::String^ name, int minArgs, int maxArgs, FunctionHandler^ handler) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } cli::pin_ptr nptr = PtrToStringChars(name); int n = awk->addFunction (this, nptr, minArgs, maxArgs, (ASE::Awk::FunctionHandler)&MojoAwk::mojoFunctionHandler); if (n == 0) funcs->Add(name, handler); + else retrieveError (); return n == 0; } bool Awk::DeleteFunction (System::String^ name) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } cli::pin_ptr nptr = PtrToStringChars(name); int n = awk->deleteFunction (this, nptr); if (n == 0) funcs->Remove (name); + else retrieveError (); return n == 0; } @@ -797,7 +839,11 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); System::String^ nm = gcnew System::String (name, 0, len); FunctionHandler^ fh = (FunctionHandler^)funcs[nm]; - if (fh == nullptr) return false; + if (fh == nullptr) + { + setError (ERROR::INVAL); + return false; + } cli::array^ arg_arr = gcnew cli::array (nargs); for (size_t i = 0; i < nargs; i++) arg_arr[i] = gcnew Argument(args[i]); @@ -808,7 +854,11 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); bool Awk::SetWord (System::String^ ow, System::String^ nw) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } cli::pin_ptr optr = PtrToStringChars(ow); cli::pin_ptr nptr = PtrToStringChars(nw); return (awk->setWord (this, optr, ow->Length, nptr, nw->Length) == 0); @@ -816,35 +866,68 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); bool Awk::UnsetWord (System::String^ ow) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } cli::pin_ptr optr = PtrToStringChars(ow); return (awk->unsetWord (this, optr, ow->Length) == 0); } bool Awk::UnsetAllWords () { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } return (awk->unsetAllWords (this) == 0); } bool Awk::SetMaxDepth (DEPTH id, size_t depth) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } awk->setMaxDepth (this, (int)id, depth); return true; } bool Awk::GetMaxDepth (DEPTH id, size_t* depth) { - if (awk == NULL) return false; + if (awk == NULL) + { + setError (ERROR::NOPER); + return false; + } *depth = awk->getMaxDepth (this, (int)id); return true; } - void Awk::SetError () + void Awk::setError (ERROR num) { - if (awk == NULL) return; - awk->setError (this); + errMsg = ""; + errLine = 0; + errCode = num; + + if (awk != NULL) + { + errMsg = gcnew System::String ( + awk->getErrorString (this, (ASE::Awk::ErrorCode)num)); + } + } + + void Awk::retrieveError () + { + if (awk != NULL) + { + errMsg = gcnew System::String (awk->getErrorMessage(this)); + errLine = awk->getErrorLine (this); + errCode = (ERROR)awk->getErrorCode (this); + } } } diff --git a/ase/net/Awk.hpp b/ase/net/Awk.hpp index cfa4fb27..54873416 100644 --- a/ase/net/Awk.hpp +++ b/ase/net/Awk.hpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.hpp,v 1.18 2007/08/22 13:56:21 bacon Exp $ + * $Id: Awk.hpp,v 1.19 2007/08/24 13:17:59 bacon Exp $ */ #pragma once @@ -296,8 +296,7 @@ namespace ASE private: MODE^ mode; }; - - + [System::Flags] enum class OPTION: int { NONE = 0, @@ -460,7 +459,6 @@ namespace ASE }; // end of enum class ERROR - typedef ASE::Awk::char_t char_t; Awk (); @@ -499,19 +497,25 @@ namespace ASE void set (OPTION opt); //{ this->option = opt; } } - // TODO: Error code, Error line property System::String^ ErrorMessage { - System::String^ get (); + System::String^ get () { return this->errMsg; } } - void SetError (); + property ERROR ErrorCode + { + ERROR get () { return this->errCode; } + } + + property unsigned int ErrorLine + { + unsigned int get () { return this->errLine; } + } protected: MojoAwk* awk; OPTION option; System::Collections::Hashtable^ funcs; - System::String^ errorMsg; public protected: // Source @@ -554,6 +558,15 @@ namespace ASE bool Awk::DispatchFunction (ASE::Awk::Return* ret, const ASE::Awk::Argument* args, size_t nargs, const char_t* name, size_t len); + + public protected: + System::String^ errMsg; + unsigned int errLine; + ERROR errCode; + + void setError (ERROR num); + void retrieveError (); + bool runErrorReported; // only used if the run-callback is activated. }; } diff --git a/ase/net/StdAwk.cpp b/ase/net/StdAwk.cpp index 54bf417b..189b2c43 100644 --- a/ase/net/StdAwk.cpp +++ b/ase/net/StdAwk.cpp @@ -1,5 +1,5 @@ /* - * $Id: StdAwk.cpp,v 1.6 2007/08/21 14:24:37 bacon Exp $ + * $Id: StdAwk.cpp,v 1.7 2007/08/24 16:02:49 bacon Exp $ */ #include "stdafx.h" @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/ase/net/misc.cpp b/ase/net/misc.cpp index 6cc82ee6..748b550a 100644 --- a/ase/net/misc.cpp +++ b/ase/net/misc.cpp @@ -1,17 +1,17 @@ /* - * $Id: misc.cpp,v 1.2 2007/08/21 14:24:37 bacon Exp $ + * $Id: misc.cpp,v 1.3 2007/08/24 16:02:49 bacon Exp $ */ #include "stdafx.h" #include "misc.h" +#include +#include +#include #ifndef NDEBUG #include #include -#include -#include -#include #pragma warning(disable:4996) #pragma unmanaged diff --git a/ase/test/awk/asetestawk++.vcproj b/ase/test/awk/aseawk++.vcproj similarity index 92% rename from ase/test/awk/asetestawk++.vcproj rename to ase/test/awk/aseawk++.vcproj index 9d30feb1..f549c25b 100644 --- a/ase/test/awk/asetestawk++.vcproj +++ b/ase/test/awk/aseawk++.vcproj @@ -2,9 +2,9 @@ //------------------------------------------------------------------------------ -namespace asetestnet.Properties { +namespace ase.net.Properties { using System; @@ -39,7 +39,7 @@ namespace asetestnet.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("asetestnet.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ase.net.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/ase/test/net/Properties/Settings.Designer.cs b/ase/test/net/Properties/Settings.Designer.cs index 617744bd..9dfd2cf8 100644 --- a/ase/test/net/Properties/Settings.Designer.cs +++ b/ase/test/net/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace asetestnet.Properties { +namespace ase.net.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/ase/test/net/asetestnet.csproj b/ase/test/net/asenet.csproj similarity index 88% rename from ase/test/net/asetestnet.csproj rename to ase/test/net/asenet.csproj index b36c87d7..50539e15 100644 --- a/ase/test/net/asetestnet.csproj +++ b/ase/test/net/asenet.csproj @@ -7,8 +7,8 @@ {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B} WinExe Properties - asetestnet - asetestnet + ase.net + ase.net true @@ -43,22 +43,12 @@ AwkForm.cs - - Form - - - AwkFormOrg.cs - AwkForm.cs Designer - - Designer - AwkFormOrg.cs - ResXFileCodeGenerator Resources.Designer.cs