Recovered from cvs revision 2007-10-10 13:22:00
This commit is contained in:
parent
c79702df8e
commit
3cfcc8b0c9
21
ase/ase.sln
21
ase/ase.sln
@ -19,15 +19,15 @@ 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}
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD} = {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}
|
||||
{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}") = "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}
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83} = {5F2E77D5-1485-48D1-9371-987BC55FEE83}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aselsp", "lsp\aselsp.vcproj", "{42FE7CED-34B7-45C8-92C9-8856E16640D2}"
|
||||
@ -37,8 +37,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aselsp", "lsp\aselsp.vcproj
|
||||
EndProject
|
||||
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}
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2} = {42FE7CED-34B7-45C8-92C9-8856E16640D2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk++", "awk\aseawk++.vcproj", "{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}"
|
||||
@ -48,8 +48,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aseawk++", "awk\aseawk++.vc
|
||||
EndProject
|
||||
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}
|
||||
{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}"
|
||||
@ -85,6 +85,7 @@ Global
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -100,6 +101,7 @@ Global
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -115,6 +117,7 @@ Global
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -130,6 +133,7 @@ Global
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -145,6 +149,7 @@ Global
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -160,6 +165,7 @@ Global
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -175,6 +181,7 @@ Global
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -190,6 +197,7 @@ Global
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -205,6 +213,7 @@ Global
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -220,6 +229,7 @@ Global
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@ -235,6 +245,7 @@ Global
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug MD|Win32.ActiveCfg = Debug MD|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug MD|Win32.Build.0 = Debug MD|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.69 2007/10/08 09:43:15 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.70 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -935,16 +935,34 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
|
||||
return ase_awk_getrunerrmsg (this->run);
|
||||
}
|
||||
|
||||
void Awk::Run::setError (
|
||||
ErrorCode code, size_t line, const char_t* arg, size_t len)
|
||||
void Awk::Run::setError (ErrorCode code)
|
||||
{
|
||||
ASE_ASSERT (this->run != ASE_NULL);
|
||||
ase_awk_setrunerror (this->run, code, 0, ASE_NULL, 0);
|
||||
}
|
||||
|
||||
ase_cstr_t x = { arg, len };
|
||||
void Awk::Run::setError (ErrorCode code, size_t line)
|
||||
{
|
||||
ASE_ASSERT (this->run != ASE_NULL);
|
||||
ase_awk_setrunerror (this->run, code, line, ASE_NULL, 0);
|
||||
}
|
||||
|
||||
void Awk::Run::setError (ErrorCode code, size_t line, const char_t* arg)
|
||||
{
|
||||
ASE_ASSERT (this->run != ASE_NULL);
|
||||
ase_cstr_t x = { arg, ase_strlen(arg) };
|
||||
ase_awk_setrunerror (this->run, code, line, &x, 1);
|
||||
}
|
||||
|
||||
void Awk::Run::setError (
|
||||
ErrorCode code, size_t line, const char_t* arg, size_t len)
|
||||
{
|
||||
ASE_ASSERT (this->run != ASE_NULL);
|
||||
ase_cstr_t x = { arg, len };
|
||||
ase_awk_setrunerror (this->run, code, line, &x, 1);
|
||||
}
|
||||
|
||||
void Awk::Run::setErrorWithMessage (
|
||||
ErrorCode code, size_t line, const char_t* msg)
|
||||
{
|
||||
ASE_ASSERT (this->run != ASE_NULL);
|
||||
@ -1063,8 +1081,22 @@ const Awk::char_t* Awk::getErrorMessage () const
|
||||
return this->errmsg;
|
||||
}
|
||||
|
||||
void Awk::setError (
|
||||
ErrorCode code, size_t line, const char_t* arg, size_t len)
|
||||
void Awk::setError (ErrorCode code)
|
||||
{
|
||||
setError (code, 0, ASE_NULL, 0);
|
||||
}
|
||||
|
||||
void Awk::setError (ErrorCode code, size_t line)
|
||||
{
|
||||
setError (code, line, ASE_NULL, 0);
|
||||
}
|
||||
|
||||
void Awk::setError (ErrorCode code, size_t line, const char_t* arg)
|
||||
{
|
||||
setError (code, line, arg, ase_strlen(arg));
|
||||
}
|
||||
|
||||
void Awk::setError (ErrorCode code, size_t line, const char_t* arg, size_t len)
|
||||
{
|
||||
if (awk != ASE_NULL)
|
||||
{
|
||||
@ -1082,8 +1114,7 @@ void Awk::setError (
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::setError (
|
||||
ErrorCode code, size_t line, const char_t* msg)
|
||||
void Awk::setErrorWithMessage (ErrorCode code, size_t line, const char_t* msg)
|
||||
{
|
||||
if (awk != ASE_NULL)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp,v 1.70 2007/10/08 09:43:15 bacon Exp $
|
||||
* $Id: Awk.hpp,v 1.71 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -578,9 +578,13 @@ public:
|
||||
size_t getErrorLine () const;
|
||||
const char_t* getErrorMessage () const;
|
||||
|
||||
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 setError (ErrorCode code);
|
||||
void setError (ErrorCode code, size_t line);
|
||||
void setError (ErrorCode code, size_t line, const char_t* arg);
|
||||
void setError (ErrorCode code, size_t line, const char_t* arg, size_t len);
|
||||
|
||||
void setErrorWithMessage (
|
||||
ErrorCode code, size_t line, const char_t* msg);
|
||||
|
||||
/**
|
||||
* Sets the value of a global variable. The global variable
|
||||
@ -705,9 +709,13 @@ public:
|
||||
const char_t* getErrorMessage () const;
|
||||
|
||||
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 setError (ErrorCode code);
|
||||
void setError (ErrorCode code, size_t line);
|
||||
void setError (ErrorCode code, size_t line, const char_t* arg);
|
||||
void setError (ErrorCode code, size_t line, const char_t* arg, size_t len);
|
||||
|
||||
void setErrorWithMessage (
|
||||
ErrorCode code, size_t line, const char_t* msg);
|
||||
|
||||
void clearError ();
|
||||
void retrieveError ();
|
||||
|
@ -17,7 +17,7 @@
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\jni"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
@ -54,10 +54,6 @@
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\release/aseawk_jni.pch"
|
||||
AssemblerListingLocation=".\release/"
|
||||
ObjectFile=".\release/"
|
||||
ProgramDataBaseFileName=".\release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
@ -79,9 +75,6 @@
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
ProgramDatabaseFile=".\../release/lib/aseawk_jni.pdb"
|
||||
ImportLibrary="release/aseawk_jni.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@ -112,7 +105,7 @@
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\jni"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
@ -148,10 +141,6 @@
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\debug/aseawk_jni.pch"
|
||||
AssemblerListingLocation=".\debug/"
|
||||
ObjectFile=".\debug/"
|
||||
ProgramDataBaseFileName=".\debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
@ -175,9 +164,6 @@
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\../debug/lib/aseawk_jni.pdb"
|
||||
ImportLibrary="debug/aseawk_jni.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@ -208,7 +194,7 @@
|
||||
<Configuration
|
||||
Name="Debug MD|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\jni"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
@ -244,10 +230,6 @@
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
PrecompiledHeaderFile=".\debug/aseawk_jni.pch"
|
||||
AssemblerListingLocation=".\debug/"
|
||||
ObjectFile=".\debug/"
|
||||
ProgramDataBaseFileName=".\debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
@ -271,9 +253,6 @@
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\../debug/lib/aseawk_jni.pdb"
|
||||
ImportLibrary="debug/aseawk_jni.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.16 2007/09/27 11:30:54 bacon Exp $
|
||||
* $Id: awk.h,v 1.17 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -199,7 +199,10 @@ enum ase_awk_option_t
|
||||
ASE_AWK_RESET = (1 << 15),
|
||||
|
||||
/* allows the assignment of a map value to a variable */
|
||||
ASE_AWK_MAPTOVAR = (1 << 16)
|
||||
ASE_AWK_MAPTOVAR = (1 << 16),
|
||||
|
||||
/* allows BEGIN, END, pattern-action blocks */
|
||||
ASE_AWK_PABLOCK = (1 << 17)
|
||||
};
|
||||
|
||||
/* error code */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: jni.c,v 1.15 2007/09/24 11:15:58 bacon Exp $
|
||||
* $Id: jni.c,v 1.16 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -34,7 +34,14 @@
|
||||
#define CLASS_EXTIO "ase/awk/Extio"
|
||||
#define FIELD_HANDLE "handle"
|
||||
|
||||
#define MSG_SIZE 256
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER>=1400)
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
#define time_t __time64_t
|
||||
#define time _time64
|
||||
#define localtime _localtime64
|
||||
#define gmtime _gmtime64
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
@ -1450,10 +1457,10 @@ static int __handle_bfn (
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp[0] = (jchar*)'b';
|
||||
tmp[1] = (jchar*)'f';
|
||||
tmp[2] = (jchar*)'n';
|
||||
tmp[3] = (jchar*)'_';
|
||||
tmp[0] = (jchar)'b';
|
||||
tmp[1] = (jchar)'f';
|
||||
tmp[2] = (jchar)'n';
|
||||
tmp[3] = (jchar)'_';
|
||||
for (i = 0; i < fnl; i++) tmp[i+4] = (jchar)fnm[i];
|
||||
name = (*env)->NewString (env, tmp, fnl+4);
|
||||
free (tmp);
|
||||
@ -1689,7 +1696,7 @@ static int __handle_bfn (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -1700,7 +1707,7 @@ static int __handle_bfn (
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
v = ase_awk_makestrval (run, tmp, len);
|
||||
free (tmp);
|
||||
}
|
||||
@ -1771,7 +1778,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -1785,7 +1792,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
n = (ase_awk_addfunc (awk, tmp, len, 0,
|
||||
min_args, max_args, ASE_NULL, __handle_bfn) == NULL)? -1: 0;
|
||||
free (tmp);
|
||||
@ -1848,7 +1855,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_delfunc (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -1862,7 +1869,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_delfunc (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
n = ase_awk_delfunc (awk, tmp, len);
|
||||
free (tmp);
|
||||
}
|
||||
@ -2069,7 +2076,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setword (
|
||||
|
||||
if (ol > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ox = (ase_char_t*)malloc (ASE_SIZEOF(ase_char_t)*ol);
|
||||
if (ox == ASE_NULL)
|
||||
{
|
||||
@ -2084,13 +2091,13 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setword (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ol; i++) ox[i] = (ase_char_t)op[i];
|
||||
for (x = 0; x < ol; x++) ox[x] = (ase_char_t)op[x];
|
||||
}
|
||||
else ox = (ase_char_t*)op;
|
||||
|
||||
if (nl > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
nx = (ase_char_t*) malloc (ASE_SIZEOF(ase_char_t)*nl);
|
||||
if (nx == ASE_NULL)
|
||||
{
|
||||
@ -2107,7 +2114,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setword (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < nl; i++) nx[i] = (ase_char_t)np[i];
|
||||
for (x = 0; x < nl; x++) nx[x] = (ase_char_t)np[x];
|
||||
}
|
||||
else nx = (ase_char_t*)np;
|
||||
|
||||
@ -2152,7 +2159,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setfilename (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -2167,7 +2174,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setfilename (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
n = ase_awk_setfilename (run, tmp, len);
|
||||
free (tmp);
|
||||
}
|
||||
@ -2211,7 +2218,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setofilename (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -2226,7 +2233,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setofilename (
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
n = ase_awk_setofilename (run, tmp, len);
|
||||
free (tmp);
|
||||
}
|
||||
@ -2273,7 +2280,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Awk_strtonum (
|
||||
|
||||
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
|
||||
{
|
||||
ase_size_t i;
|
||||
jsize x;
|
||||
ase_char_t* tmp = (ase_char_t*)
|
||||
malloc (ASE_SIZEOF(ase_char_t)*len);
|
||||
if (tmp == ASE_NULL)
|
||||
@ -2287,7 +2294,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Awk_strtonum (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) tmp[i] = (ase_char_t)ptr[i];
|
||||
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
|
||||
n = ase_awk_strtonum (
|
||||
(ase_awk_run_t*)runid, tmp, len, &lv, &rv);
|
||||
free (tmp);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.18 2007/09/25 15:27:54 bacon Exp $
|
||||
* $Id: parse.c,v 1.19 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -237,8 +237,8 @@ static kwent_t kwtab[] =
|
||||
{ ASE_T("in"), 2, TOKEN_IN, 0 },
|
||||
|
||||
/* top-level block starters */
|
||||
{ ASE_T("BEGIN"), 5, TOKEN_BEGIN, 0 },
|
||||
{ ASE_T("END"), 3, TOKEN_END, 0 },
|
||||
{ ASE_T("BEGIN"), 5, TOKEN_BEGIN, ASE_AWK_PABLOCK },
|
||||
{ ASE_T("END"), 3, TOKEN_END, ASE_AWK_PABLOCK },
|
||||
{ ASE_T("function"), 8, TOKEN_FUNCTION, 0 },
|
||||
{ ASE_T("func"), 4, TOKEN_FUNCTION, 0 },
|
||||
|
||||
@ -649,6 +649,13 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
|
||||
else if (MATCH(awk,TOKEN_LBRACE))
|
||||
{
|
||||
/* patternless block */
|
||||
if ((awk->option & ASE_AWK_PABLOCK) == 0)
|
||||
{
|
||||
/* TODO: SET ERROR */
|
||||
SETERRTOK (awk, ASE_AWK_EFUNC);
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
awk->parse.id.block = PARSE_ACTION_BLOCK;
|
||||
if (parse_pattern_block (
|
||||
awk, ASE_NULL, ase_false) == ASE_NULL) return ASE_NULL;
|
||||
@ -666,6 +673,13 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
|
||||
*/
|
||||
ase_awk_nde_t* ptn;
|
||||
|
||||
if ((awk->option & ASE_AWK_PABLOCK) == 0)
|
||||
{
|
||||
/* TODO: SET ERROR */
|
||||
SETERRTOK (awk, ASE_AWK_EFUNC);
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
awk->parse.id.block = PARSE_PATTERN;
|
||||
|
||||
ptn = parse_expression (awk, awk->token.line);
|
||||
|
305
ase/net/Awk.cpp
305
ase/net/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.31 2007/10/08 09:43:15 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.32 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -18,12 +18,11 @@
|
||||
|
||||
using System::Runtime::InteropServices::GCHandle;
|
||||
|
||||
namespace ASE
|
||||
{
|
||||
ASE_BEGIN_NAMESPACE2(ASE,Net)
|
||||
|
||||
class MojoAwk: protected Awk
|
||||
{
|
||||
public:
|
||||
class MojoAwk: protected ASE::Awk
|
||||
{
|
||||
public:
|
||||
MojoAwk (): wrapper(nullptr)
|
||||
{
|
||||
}
|
||||
@ -94,6 +93,34 @@ namespace ASE
|
||||
return x;
|
||||
}
|
||||
|
||||
void setError (ASE::Net::Awk^ wrapper, ErrorCode num)
|
||||
{
|
||||
this->wrapper = wrapper;
|
||||
Awk::setError (num);
|
||||
this->wrapper = nullptr;
|
||||
}
|
||||
|
||||
void setError (ASE::Net::Awk^ wrapper, ErrorCode num, size_t line)
|
||||
{
|
||||
this->wrapper = wrapper;
|
||||
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);
|
||||
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);
|
||||
this->wrapper = nullptr;
|
||||
}
|
||||
|
||||
int setErrorString (ASE::Net::Awk^ wrapper, ErrorCode num, const char_t* msg)
|
||||
{
|
||||
this->wrapper = wrapper;
|
||||
@ -226,7 +253,7 @@ namespace ASE
|
||||
|
||||
void onRunStatement (Run& run, size_t line)
|
||||
{
|
||||
//if (wrapper->stopRequested) run.stop ();
|
||||
if (wrapper->stopRequested) run.stop ();
|
||||
|
||||
if (wrapper->OnRunStatement != nullptr)
|
||||
{
|
||||
@ -639,18 +666,16 @@ namespace ASE
|
||||
ase_vfprintf (stderr, fmt, arg);
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
//msclr::auto_gcroot<ASE::Net::Awk^> wrapper;
|
||||
mutable gcroot<ASE::Net::Awk^> wrapper;
|
||||
};
|
||||
};
|
||||
|
||||
namespace Net
|
||||
{
|
||||
Awk::Awk ()
|
||||
{
|
||||
Awk::Awk ()
|
||||
{
|
||||
funcs = gcnew System::Collections::Hashtable();
|
||||
|
||||
awk = new ASE::MojoAwk ();
|
||||
awk = new ASE::Net::MojoAwk ();
|
||||
if (awk->open (this) == -1)
|
||||
{
|
||||
throw gcnew System::Exception (gcnew System::String(awk->getErrorMessage(this)));
|
||||
@ -664,10 +689,10 @@ namespace ASE
|
||||
errLine = 0;
|
||||
errCode = ASE::Net::Awk::ERROR::NOERR;
|
||||
runErrorReported = false;
|
||||
}
|
||||
}
|
||||
|
||||
Awk::~Awk ()
|
||||
{
|
||||
Awk::~Awk ()
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
awk->close (this);
|
||||
@ -681,46 +706,46 @@ namespace ASE
|
||||
delete funcs;
|
||||
funcs = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Awk::!Awk ()
|
||||
{
|
||||
Awk::!Awk ()
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
awk->close (this);
|
||||
delete awk;
|
||||
awk = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Awk::OPTION Awk::Option::get ()
|
||||
{
|
||||
Awk::OPTION Awk::Option::get ()
|
||||
{
|
||||
if (awk != NULL) this->option = (OPTION)awk->getOption (this);
|
||||
return this->option;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::Option::set (Awk::OPTION opt)
|
||||
{
|
||||
void Awk::Option::set (Awk::OPTION opt)
|
||||
{
|
||||
this->option = opt;
|
||||
if (awk != NULL) awk->setOption (this, (int)this->option);
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::SetErrorString (Awk::ERROR num, System::String^ msg)
|
||||
{
|
||||
bool Awk::SetErrorString (Awk::ERROR num, System::String^ msg)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
cli::pin_ptr<const ASE::Awk::char_t> nptr = PtrToStringChars(msg);
|
||||
bool r = (awk->setErrorString (this, (ASE::Awk::ErrorCode)num, nptr) == 0);
|
||||
if (!r) { retrieveError (); }
|
||||
if (!r) { RetrieveError (); }
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::Close ()
|
||||
{
|
||||
void Awk::Close ()
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
awk->close (this);
|
||||
@ -734,33 +759,33 @@ namespace ASE
|
||||
delete funcs;
|
||||
funcs = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::Parse ()
|
||||
bool Awk::Parse ()
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
bool r = (awk->parse (this) == 0);
|
||||
if (!r) { retrieveError (); }
|
||||
if (!r) { RetrieveError (); }
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::Run ()
|
||||
{
|
||||
bool Awk::Run ()
|
||||
{
|
||||
return Run (nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::Run (System::String^ entryPoint, cli::array<System::String^>^ args)
|
||||
{
|
||||
bool Awk::Run (System::String^ entryPoint, cli::array<System::String^>^ args)
|
||||
{
|
||||
runErrorReported = false;
|
||||
//stopRequested = false;
|
||||
stopRequested = false;
|
||||
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -776,7 +801,7 @@ namespace ASE
|
||||
{
|
||||
bool r = (awk->run (this) == 0);
|
||||
if (runErrorReported) r = false;
|
||||
else if (!r) retrieveError ();
|
||||
else if (!r) RetrieveError ();
|
||||
return r;
|
||||
}
|
||||
else
|
||||
@ -784,7 +809,7 @@ namespace ASE
|
||||
cli::pin_ptr<const ASE::Awk::char_t> nptr = PtrToStringChars(entryPoint);
|
||||
bool r = (awk->run (this, nptr) == 0);
|
||||
if (runErrorReported) r = false;
|
||||
else if (!r) retrieveError ();
|
||||
else if (!r) RetrieveError ();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -800,7 +825,7 @@ namespace ASE
|
||||
ptr = (ASE::Awk::char_t**)awk->allocMem (nargs * ASE_SIZEOF(ASE::Awk::char_t*));
|
||||
if (ptr == ASE_NULL)
|
||||
{
|
||||
setError (ERROR::NOMEM);
|
||||
SetError (ERROR::NOMEM);
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < nargs; i++) ptr[i] = ASE_NULL;
|
||||
@ -811,7 +836,7 @@ namespace ASE
|
||||
if (ptr[i] == ASE_NULL)
|
||||
{
|
||||
r = false;
|
||||
setError (ERROR::NOMEM);
|
||||
SetError (ERROR::NOMEM);
|
||||
goto exit_run;
|
||||
}
|
||||
memcpy (ptr[i], nptr, args[i]->Length*ASE_SIZEOF(ASE::Awk::char_t));
|
||||
@ -845,7 +870,7 @@ namespace ASE
|
||||
}
|
||||
|
||||
if (runErrorReported) r = false;
|
||||
else if (!r) retrieveError ();
|
||||
else if (!r) RetrieveError ();
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -865,23 +890,22 @@ namespace ASE
|
||||
ptr = ASE_NULL;
|
||||
}
|
||||
|
||||
setError (ERROR::NOMEM);
|
||||
SetError (ERROR::NOMEM);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::Stop ()
|
||||
{
|
||||
//stopRequested = true;
|
||||
// TODO: implement it...
|
||||
}
|
||||
void Awk::Stop ()
|
||||
{
|
||||
stopRequested = true;
|
||||
}
|
||||
|
||||
bool Awk::AddGlobal (System::String^ name, [System::Runtime::InteropServices::Out] int% id)
|
||||
{
|
||||
bool Awk::AddGlobal (System::String^ name, [System::Runtime::InteropServices::Out] int% id)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -889,78 +913,75 @@ namespace ASE
|
||||
int n = awk->addGlobal (this, nptr);
|
||||
if (n == -1)
|
||||
{
|
||||
retrieveError ();
|
||||
RetrieveError ();
|
||||
return false;
|
||||
}
|
||||
|
||||
id = n;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::DeleteGlobal (System::String^ name)
|
||||
{
|
||||
bool Awk::DeleteGlobal (System::String^ name)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
cli::pin_ptr<const ASE::Awk::char_t> nptr = PtrToStringChars(name);
|
||||
int n = awk->deleteGlobal (this, nptr);
|
||||
if (n == -1) retrieveError ();
|
||||
if (n == -1) RetrieveError ();
|
||||
return n == 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::AddFunction (
|
||||
bool Awk::AddFunction (
|
||||
System::String^ name, int minArgs, int maxArgs,
|
||||
FunctionHandler^ handler)
|
||||
{
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
cli::pin_ptr<const ASE::Awk::char_t> 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 ();
|
||||
else RetrieveError ();
|
||||
return n == 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::DeleteFunction (System::String^ name)
|
||||
{
|
||||
bool Awk::DeleteFunction (System::String^ name)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
cli::pin_ptr<const ASE::Awk::char_t> nptr = PtrToStringChars(name);
|
||||
int n = awk->deleteFunction (this, nptr);
|
||||
if (n == 0) funcs->Remove (name);
|
||||
else retrieveError ();
|
||||
else RetrieveError ();
|
||||
return n == 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::DispatchFunction (
|
||||
bool Awk::DispatchFunction (
|
||||
Context^ ctx, ASE::Awk::Return& ret,
|
||||
const ASE::Awk::Argument* args, size_t nargs,
|
||||
const char_t* name, size_t len)
|
||||
{
|
||||
System::String^ nm =
|
||||
gcnew System::String (name, 0, len);
|
||||
{
|
||||
System::String^ nm = gcnew System::String (name, 0, len);
|
||||
|
||||
FunctionHandler^ fh = (FunctionHandler^)funcs[nm];
|
||||
if (fh == nullptr)
|
||||
{
|
||||
// TODO: ctx.setError...
|
||||
setError (ERROR::INVAL);
|
||||
ctx->SetError (ERROR::INVAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
Return^ r = gcnew Return (ret);
|
||||
cli::array<Argument^>^ a =
|
||||
gcnew cli::array<Argument^> (nargs);
|
||||
cli::array<Argument^>^ a = gcnew cli::array<Argument^> (nargs);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < nargs; i++)
|
||||
@ -973,86 +994,134 @@ namespace ASE
|
||||
delete r;
|
||||
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::SetWord (System::String^ ow, System::String^ nw)
|
||||
{
|
||||
bool Awk::SetWord (System::String^ ow, System::String^ nw)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
cli::pin_ptr<const ASE::Awk::char_t> optr = PtrToStringChars(ow);
|
||||
cli::pin_ptr<const ASE::Awk::char_t> nptr = PtrToStringChars(nw);
|
||||
return (awk->setWord (this, optr, ow->Length, nptr, nw->Length) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::UnsetWord (System::String^ ow)
|
||||
{
|
||||
bool Awk::UnsetWord (System::String^ ow)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
cli::pin_ptr<const ASE::Awk::char_t> optr = PtrToStringChars(ow);
|
||||
return (awk->unsetWord (this, optr, ow->Length) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::UnsetAllWords ()
|
||||
{
|
||||
bool Awk::UnsetAllWords ()
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
return (awk->unsetAllWords (this) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::SetMaxDepth (DEPTH id, size_t depth)
|
||||
{
|
||||
bool Awk::SetMaxDepth (DEPTH id, size_t depth)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
awk->setMaxDepth (this, (int)id, depth);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Awk::GetMaxDepth (DEPTH id, size_t* depth)
|
||||
{
|
||||
bool Awk::GetMaxDepth (DEPTH id, size_t* depth)
|
||||
{
|
||||
if (awk == NULL)
|
||||
{
|
||||
setError (ERROR::NOPER);
|
||||
SetError (ERROR::NOPER);
|
||||
return false;
|
||||
}
|
||||
*depth = awk->getMaxDepth (this, (int)id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::setError (ERROR num)
|
||||
void Awk::SetError (ERROR num)
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
awk->setError (this, (ASE::Awk::ErrorCode)num);
|
||||
RetrieveError ();
|
||||
}
|
||||
else
|
||||
{
|
||||
errMsg = "";
|
||||
errLine = 0;
|
||||
errCode = num;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::SetError (ERROR num, size_t line)
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
errMsg = gcnew System::String (
|
||||
awk->getErrorString (this, (ASE::Awk::ErrorCode)num));
|
||||
awk->setError (this, (ASE::Awk::ErrorCode)num, line);
|
||||
RetrieveError ();
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::retrieveError ()
|
||||
else
|
||||
{
|
||||
errMsg = "";
|
||||
errLine = line;
|
||||
errCode = num;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::SetError (ERROR num, size_t line, System::String^ arg)
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
cli::pin_ptr<const ASE::Awk::char_t> p = PtrToStringChars(arg);
|
||||
awk->setError (this, (ASE::Awk::ErrorCode)num, line, p, arg->Length);
|
||||
RetrieveError ();
|
||||
}
|
||||
else
|
||||
{
|
||||
errMsg = "";
|
||||
errLine = line;
|
||||
errCode = num;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::SetErrorWithMessage (ERROR num, size_t line, System::String^ msg)
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
cli::pin_ptr<const ASE::Awk::char_t> p = PtrToStringChars(msg);
|
||||
awk->setErrorWithMessage (this, (ASE::Awk::ErrorCode)num, line, p);
|
||||
RetrieveError ();
|
||||
}
|
||||
else
|
||||
{
|
||||
errMsg = msg;
|
||||
errLine = line;
|
||||
errCode = num;
|
||||
}
|
||||
}
|
||||
|
||||
void Awk::RetrieveError ()
|
||||
{
|
||||
if (awk != NULL)
|
||||
{
|
||||
errMsg = gcnew System::String (awk->getErrorMessage(this));
|
||||
errLine = awk->getErrorLine (this);
|
||||
errCode = (ERROR)awk->getErrorCode (this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ASE_END_NAMESPACE2(Net,ASE)
|
||||
|
404
ase/net/Awk.hpp
404
ase/net/Awk.hpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp,v 1.36 2007/10/08 09:50:52 bacon Exp $
|
||||
* $Id: Awk.hpp,v 1.37 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -9,15 +9,15 @@
|
||||
#include <ase/awk/Awk.hpp>
|
||||
#include <vcclr.h>
|
||||
|
||||
namespace ASE
|
||||
{
|
||||
class MojoAwk;
|
||||
///////////////////////////////
|
||||
ASE_BEGIN_NAMESPACE2(ASE,Net)
|
||||
///////////////////////////////
|
||||
|
||||
namespace Net
|
||||
{
|
||||
public ref class Awk abstract
|
||||
{
|
||||
public:
|
||||
class MojoAwk;
|
||||
|
||||
public ref class Awk abstract
|
||||
{
|
||||
public:
|
||||
typedef ASE::Awk::long_t long_t;
|
||||
typedef ASE::Awk::real_t real_t;
|
||||
typedef ASE::Awk::char_t char_t;
|
||||
@ -26,6 +26,170 @@ namespace ASE
|
||||
typedef ASE::Awk::cint_t cint_t;
|
||||
typedef ASE::Awk::bool_t bool_t;
|
||||
|
||||
[System::Flags] enum class OPTION: int
|
||||
{
|
||||
NONE = 0,
|
||||
IMPLICIT = ASE::Awk::OPT_IMPLICIT,
|
||||
EXPLICIT = ASE::Awk::OPT_EXPLICIT,
|
||||
UNIQUEFN = ASE::Awk::OPT_UNIQUEFN,
|
||||
SHADING = ASE::Awk::OPT_SHADING,
|
||||
SHIFT = ASE::Awk::OPT_SHIFT,
|
||||
IDIV = ASE::Awk::OPT_IDIV,
|
||||
STRCONCAT = ASE::Awk::OPT_STRCONCAT,
|
||||
EXTIO = ASE::Awk::OPT_EXTIO,
|
||||
COPROC = ASE::Awk::OPT_COPROC,
|
||||
BLOCKLESS = ASE::Awk::OPT_BLOCKLESS,
|
||||
STRBASEONE = 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
|
||||
};
|
||||
|
||||
enum class DEPTH: int
|
||||
{
|
||||
BLOCK_PARSE = ASE::Awk::DEPTH_BLOCK_PARSE,
|
||||
BLOCK_RUN = ASE::Awk::DEPTH_BLOCK_RUN,
|
||||
EXPR_PARSE = ASE::Awk::DEPTH_EXPR_PARSE,
|
||||
EXPR_RUN = ASE::Awk::DEPTH_EXPR_RUN,
|
||||
REX_BUILD = ASE::Awk::DEPTH_REX_BUILD,
|
||||
REX_MATCH = ASE::Awk::DEPTH_REX_MATCH
|
||||
};
|
||||
|
||||
// generated by generrcode-net.awk
|
||||
enum class ERROR: int
|
||||
{
|
||||
NOERR = ASE::Awk::ERR_NOERR,
|
||||
INVAL = ASE::Awk::ERR_INVAL,
|
||||
NOMEM = ASE::Awk::ERR_NOMEM,
|
||||
NOSUP = ASE::Awk::ERR_NOSUP,
|
||||
NOPER = ASE::Awk::ERR_NOPER,
|
||||
NODEV = ASE::Awk::ERR_NODEV,
|
||||
NOSPC = ASE::Awk::ERR_NOSPC,
|
||||
MFILE = ASE::Awk::ERR_MFILE,
|
||||
MLINK = ASE::Awk::ERR_MLINK,
|
||||
AGAIN = ASE::Awk::ERR_AGAIN,
|
||||
NOENT = ASE::Awk::ERR_NOENT,
|
||||
EXIST = ASE::Awk::ERR_EXIST,
|
||||
FTBIG = ASE::Awk::ERR_FTBIG,
|
||||
TBUSY = ASE::Awk::ERR_TBUSY,
|
||||
ISDIR = ASE::Awk::ERR_ISDIR,
|
||||
IOERR = ASE::Awk::ERR_IOERR,
|
||||
OPEN = ASE::Awk::ERR_OPEN,
|
||||
READ = ASE::Awk::ERR_READ,
|
||||
WRITE = ASE::Awk::ERR_WRITE,
|
||||
CLOSE = ASE::Awk::ERR_CLOSE,
|
||||
INTERN = ASE::Awk::ERR_INTERN,
|
||||
RUNTIME = ASE::Awk::ERR_RUNTIME,
|
||||
BLKNST = ASE::Awk::ERR_BLKNST,
|
||||
EXPRNST = ASE::Awk::ERR_EXPRNST,
|
||||
SINOP = ASE::Awk::ERR_SINOP,
|
||||
SINCL = ASE::Awk::ERR_SINCL,
|
||||
SINRD = ASE::Awk::ERR_SINRD,
|
||||
SOUTOP = ASE::Awk::ERR_SOUTOP,
|
||||
SOUTCL = ASE::Awk::ERR_SOUTCL,
|
||||
SOUTWR = ASE::Awk::ERR_SOUTWR,
|
||||
LXCHR = ASE::Awk::ERR_LXCHR,
|
||||
LXDIG = ASE::Awk::ERR_LXDIG,
|
||||
LXUNG = ASE::Awk::ERR_LXUNG,
|
||||
ENDSRC = ASE::Awk::ERR_ENDSRC,
|
||||
ENDCMT = ASE::Awk::ERR_ENDCMT,
|
||||
ENDSTR = ASE::Awk::ERR_ENDSTR,
|
||||
ENDREX = ASE::Awk::ERR_ENDREX,
|
||||
LBRACE = ASE::Awk::ERR_LBRACE,
|
||||
LPAREN = ASE::Awk::ERR_LPAREN,
|
||||
RPAREN = ASE::Awk::ERR_RPAREN,
|
||||
RBRACK = ASE::Awk::ERR_RBRACK,
|
||||
COMMA = ASE::Awk::ERR_COMMA,
|
||||
SCOLON = ASE::Awk::ERR_SCOLON,
|
||||
COLON = ASE::Awk::ERR_COLON,
|
||||
STMEND = ASE::Awk::ERR_STMEND,
|
||||
IN = ASE::Awk::ERR_IN,
|
||||
NOTVAR = ASE::Awk::ERR_NOTVAR,
|
||||
EXPRES = ASE::Awk::ERR_EXPRES,
|
||||
WHILE = ASE::Awk::ERR_WHILE,
|
||||
ASSIGN = ASE::Awk::ERR_ASSIGN,
|
||||
IDENT = ASE::Awk::ERR_IDENT,
|
||||
FNNAME = ASE::Awk::ERR_FNNAME,
|
||||
BLKBEG = ASE::Awk::ERR_BLKBEG,
|
||||
BLKEND = ASE::Awk::ERR_BLKEND,
|
||||
DUPBEG = ASE::Awk::ERR_DUPBEG,
|
||||
DUPEND = ASE::Awk::ERR_DUPEND,
|
||||
BFNRED = ASE::Awk::ERR_BFNRED,
|
||||
AFNRED = ASE::Awk::ERR_AFNRED,
|
||||
GBLRED = ASE::Awk::ERR_GBLRED,
|
||||
PARRED = ASE::Awk::ERR_PARRED,
|
||||
DUPPAR = ASE::Awk::ERR_DUPPAR,
|
||||
DUPGBL = ASE::Awk::ERR_DUPGBL,
|
||||
DUPLCL = ASE::Awk::ERR_DUPLCL,
|
||||
BADPAR = ASE::Awk::ERR_BADPAR,
|
||||
BADVAR = ASE::Awk::ERR_BADVAR,
|
||||
UNDEF = ASE::Awk::ERR_UNDEF,
|
||||
LVALUE = ASE::Awk::ERR_LVALUE,
|
||||
GBLTM = ASE::Awk::ERR_GBLTM,
|
||||
LCLTM = ASE::Awk::ERR_LCLTM,
|
||||
PARTM = ASE::Awk::ERR_PARTM,
|
||||
DELETE = ASE::Awk::ERR_DELETE,
|
||||
BREAK = ASE::Awk::ERR_BREAK,
|
||||
CONTINUE = ASE::Awk::ERR_CONTINUE,
|
||||
NEXTBEG = ASE::Awk::ERR_NEXTBEG,
|
||||
NEXTEND = ASE::Awk::ERR_NEXTEND,
|
||||
NEXTFBEG = ASE::Awk::ERR_NEXTFBEG,
|
||||
NEXTFEND = ASE::Awk::ERR_NEXTFEND,
|
||||
PRINTFARG = ASE::Awk::ERR_PRINTFARG,
|
||||
PREPST = ASE::Awk::ERR_PREPST,
|
||||
GLNCPS = ASE::Awk::ERR_GLNCPS,
|
||||
DIVBY0 = ASE::Awk::ERR_DIVBY0,
|
||||
OPERAND = ASE::Awk::ERR_OPERAND,
|
||||
POSIDX = ASE::Awk::ERR_POSIDX,
|
||||
ARGTF = ASE::Awk::ERR_ARGTF,
|
||||
ARGTM = ASE::Awk::ERR_ARGTM,
|
||||
FNNONE = ASE::Awk::ERR_FNNONE,
|
||||
NOTIDX = ASE::Awk::ERR_NOTIDX,
|
||||
NOTDEL = ASE::Awk::ERR_NOTDEL,
|
||||
NOTMAP = ASE::Awk::ERR_NOTMAP,
|
||||
NOTMAPIN = ASE::Awk::ERR_NOTMAPIN,
|
||||
NOTMAPNILIN = ASE::Awk::ERR_NOTMAPNILIN,
|
||||
NOTREF = ASE::Awk::ERR_NOTREF,
|
||||
NOTASS = ASE::Awk::ERR_NOTASS,
|
||||
IDXVALASSMAP = ASE::Awk::ERR_IDXVALASSMAP,
|
||||
POSVALASSMAP = ASE::Awk::ERR_POSVALASSMAP,
|
||||
MAPTOSCALAR = ASE::Awk::ERR_MAPTOSCALAR,
|
||||
SCALARTOMAP = ASE::Awk::ERR_SCALARTOMAP,
|
||||
MAPNOTALLOWED = ASE::Awk::ERR_MAPNOTALLOWED,
|
||||
VALTYPE = ASE::Awk::ERR_VALTYPE,
|
||||
RDELETE = ASE::Awk::ERR_RDELETE,
|
||||
RNEXTBEG = ASE::Awk::ERR_RNEXTBEG,
|
||||
RNEXTEND = ASE::Awk::ERR_RNEXTEND,
|
||||
RNEXTFBEG = ASE::Awk::ERR_RNEXTFBEG,
|
||||
RNEXTFEND = ASE::Awk::ERR_RNEXTFEND,
|
||||
BFNUSER = ASE::Awk::ERR_BFNUSER,
|
||||
BFNIMPL = ASE::Awk::ERR_BFNIMPL,
|
||||
IOUSER = ASE::Awk::ERR_IOUSER,
|
||||
IONONE = ASE::Awk::ERR_IONONE,
|
||||
IOIMPL = ASE::Awk::ERR_IOIMPL,
|
||||
IONMEM = ASE::Awk::ERR_IONMEM,
|
||||
IONMNL = ASE::Awk::ERR_IONMNL,
|
||||
FMTARG = ASE::Awk::ERR_FMTARG,
|
||||
FMTCNV = ASE::Awk::ERR_FMTCNV,
|
||||
CONVFMTCHR = ASE::Awk::ERR_CONVFMTCHR,
|
||||
OFMTCHR = ASE::Awk::ERR_OFMTCHR,
|
||||
REXRECUR = ASE::Awk::ERR_REXRECUR,
|
||||
REXRPAREN = ASE::Awk::ERR_REXRPAREN,
|
||||
REXRBRACKET = ASE::Awk::ERR_REXRBRACKET,
|
||||
REXRBRACE = ASE::Awk::ERR_REXRBRACE,
|
||||
REXUNBALPAR = ASE::Awk::ERR_REXUNBALPAR,
|
||||
REXCOLON = ASE::Awk::ERR_REXCOLON,
|
||||
REXCRANGE = ASE::Awk::ERR_REXCRANGE,
|
||||
REXCCLASS = ASE::Awk::ERR_REXCCLASS,
|
||||
REXBRANGE = ASE::Awk::ERR_REXBRANGE,
|
||||
REXEND = ASE::Awk::ERR_REXEND,
|
||||
REXGARBAGE = ASE::Awk::ERR_REXGARBAGE
|
||||
};
|
||||
// end of enum class ERROR
|
||||
|
||||
ref class Context;
|
||||
|
||||
ref class Argument
|
||||
@ -285,10 +449,30 @@ namespace ASE
|
||||
return run.stop () == 0;
|
||||
}
|
||||
|
||||
/* TODO:
|
||||
* GetError
|
||||
* SetError
|
||||
*/
|
||||
void SetError (ASE::Net::Awk::ERROR num)
|
||||
{
|
||||
return run.setError ((ASE::Awk::ErrorCode)num);
|
||||
}
|
||||
|
||||
void SetError (ASE::Net::Awk::ERROR num, size_t line)
|
||||
{
|
||||
return run.setError ((ASE::Awk::ErrorCode)num, line);
|
||||
}
|
||||
|
||||
void SetError (ASE::Net::Awk::ERROR num, size_t line, System::String^ arg)
|
||||
{
|
||||
cli::pin_ptr<const char_t> p = PtrToStringChars(arg);
|
||||
return run.setError (
|
||||
(ASE::Awk::ErrorCode)num, line, p, arg->Length);
|
||||
}
|
||||
|
||||
void SetErrorWithMessage (
|
||||
ASE::Net::Awk::ERROR num, size_t line, System::String^ msg)
|
||||
{
|
||||
cli::pin_ptr<const char_t> p = PtrToStringChars(msg);
|
||||
return run.setErrorWithMessage (
|
||||
(ASE::Awk::ErrorCode)num, line, p);
|
||||
}
|
||||
|
||||
bool SetGlobal (int id, System::String^ v)
|
||||
{
|
||||
@ -485,172 +669,6 @@ namespace ASE
|
||||
MODE^ mode;
|
||||
};
|
||||
|
||||
[System::Flags] enum class OPTION: int
|
||||
{
|
||||
NONE = 0,
|
||||
IMPLICIT = ASE::Awk::OPT_IMPLICIT,
|
||||
EXPLICIT = ASE::Awk::OPT_EXPLICIT,
|
||||
UNIQUEFN = ASE::Awk::OPT_UNIQUEFN,
|
||||
SHADING = ASE::Awk::OPT_SHADING,
|
||||
SHIFT = ASE::Awk::OPT_SHIFT,
|
||||
IDIV = ASE::Awk::OPT_IDIV,
|
||||
STRCONCAT = ASE::Awk::OPT_STRCONCAT,
|
||||
EXTIO = ASE::Awk::OPT_EXTIO,
|
||||
COPROC = ASE::Awk::OPT_COPROC,
|
||||
BLOCKLESS = ASE::Awk::OPT_BLOCKLESS,
|
||||
STRBASEONE = 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
|
||||
};
|
||||
|
||||
enum class DEPTH: int
|
||||
{
|
||||
BLOCK_PARSE = ASE::Awk::DEPTH_BLOCK_PARSE,
|
||||
BLOCK_RUN = ASE::Awk::DEPTH_BLOCK_RUN,
|
||||
EXPR_PARSE = ASE::Awk::DEPTH_EXPR_PARSE,
|
||||
EXPR_RUN = ASE::Awk::DEPTH_EXPR_RUN,
|
||||
REX_BUILD = ASE::Awk::DEPTH_REX_BUILD,
|
||||
REX_MATCH = ASE::Awk::DEPTH_REX_MATCH
|
||||
};
|
||||
|
||||
// generated by generrcode-net.awk
|
||||
enum class ERROR: int
|
||||
{
|
||||
NOERR = ASE::Awk::ERR_NOERR,
|
||||
INVAL = ASE::Awk::ERR_INVAL,
|
||||
NOMEM = ASE::Awk::ERR_NOMEM,
|
||||
NOSUP = ASE::Awk::ERR_NOSUP,
|
||||
NOPER = ASE::Awk::ERR_NOPER,
|
||||
NODEV = ASE::Awk::ERR_NODEV,
|
||||
NOSPC = ASE::Awk::ERR_NOSPC,
|
||||
MFILE = ASE::Awk::ERR_MFILE,
|
||||
MLINK = ASE::Awk::ERR_MLINK,
|
||||
AGAIN = ASE::Awk::ERR_AGAIN,
|
||||
NOENT = ASE::Awk::ERR_NOENT,
|
||||
EXIST = ASE::Awk::ERR_EXIST,
|
||||
FTBIG = ASE::Awk::ERR_FTBIG,
|
||||
TBUSY = ASE::Awk::ERR_TBUSY,
|
||||
ISDIR = ASE::Awk::ERR_ISDIR,
|
||||
IOERR = ASE::Awk::ERR_IOERR,
|
||||
OPEN = ASE::Awk::ERR_OPEN,
|
||||
READ = ASE::Awk::ERR_READ,
|
||||
WRITE = ASE::Awk::ERR_WRITE,
|
||||
CLOSE = ASE::Awk::ERR_CLOSE,
|
||||
INTERN = ASE::Awk::ERR_INTERN,
|
||||
RUNTIME = ASE::Awk::ERR_RUNTIME,
|
||||
BLKNST = ASE::Awk::ERR_BLKNST,
|
||||
EXPRNST = ASE::Awk::ERR_EXPRNST,
|
||||
SINOP = ASE::Awk::ERR_SINOP,
|
||||
SINCL = ASE::Awk::ERR_SINCL,
|
||||
SINRD = ASE::Awk::ERR_SINRD,
|
||||
SOUTOP = ASE::Awk::ERR_SOUTOP,
|
||||
SOUTCL = ASE::Awk::ERR_SOUTCL,
|
||||
SOUTWR = ASE::Awk::ERR_SOUTWR,
|
||||
LXCHR = ASE::Awk::ERR_LXCHR,
|
||||
LXDIG = ASE::Awk::ERR_LXDIG,
|
||||
LXUNG = ASE::Awk::ERR_LXUNG,
|
||||
ENDSRC = ASE::Awk::ERR_ENDSRC,
|
||||
ENDCMT = ASE::Awk::ERR_ENDCMT,
|
||||
ENDSTR = ASE::Awk::ERR_ENDSTR,
|
||||
ENDREX = ASE::Awk::ERR_ENDREX,
|
||||
LBRACE = ASE::Awk::ERR_LBRACE,
|
||||
LPAREN = ASE::Awk::ERR_LPAREN,
|
||||
RPAREN = ASE::Awk::ERR_RPAREN,
|
||||
RBRACK = ASE::Awk::ERR_RBRACK,
|
||||
COMMA = ASE::Awk::ERR_COMMA,
|
||||
SCOLON = ASE::Awk::ERR_SCOLON,
|
||||
COLON = ASE::Awk::ERR_COLON,
|
||||
STMEND = ASE::Awk::ERR_STMEND,
|
||||
IN = ASE::Awk::ERR_IN,
|
||||
NOTVAR = ASE::Awk::ERR_NOTVAR,
|
||||
EXPRES = ASE::Awk::ERR_EXPRES,
|
||||
WHILE = ASE::Awk::ERR_WHILE,
|
||||
ASSIGN = ASE::Awk::ERR_ASSIGN,
|
||||
IDENT = ASE::Awk::ERR_IDENT,
|
||||
FNNAME = ASE::Awk::ERR_FNNAME,
|
||||
BLKBEG = ASE::Awk::ERR_BLKBEG,
|
||||
BLKEND = ASE::Awk::ERR_BLKEND,
|
||||
DUPBEG = ASE::Awk::ERR_DUPBEG,
|
||||
DUPEND = ASE::Awk::ERR_DUPEND,
|
||||
BFNRED = ASE::Awk::ERR_BFNRED,
|
||||
AFNRED = ASE::Awk::ERR_AFNRED,
|
||||
GBLRED = ASE::Awk::ERR_GBLRED,
|
||||
PARRED = ASE::Awk::ERR_PARRED,
|
||||
DUPPAR = ASE::Awk::ERR_DUPPAR,
|
||||
DUPGBL = ASE::Awk::ERR_DUPGBL,
|
||||
DUPLCL = ASE::Awk::ERR_DUPLCL,
|
||||
BADPAR = ASE::Awk::ERR_BADPAR,
|
||||
BADVAR = ASE::Awk::ERR_BADVAR,
|
||||
UNDEF = ASE::Awk::ERR_UNDEF,
|
||||
LVALUE = ASE::Awk::ERR_LVALUE,
|
||||
GBLTM = ASE::Awk::ERR_GBLTM,
|
||||
LCLTM = ASE::Awk::ERR_LCLTM,
|
||||
PARTM = ASE::Awk::ERR_PARTM,
|
||||
DELETE = ASE::Awk::ERR_DELETE,
|
||||
BREAK = ASE::Awk::ERR_BREAK,
|
||||
CONTINUE = ASE::Awk::ERR_CONTINUE,
|
||||
NEXTBEG = ASE::Awk::ERR_NEXTBEG,
|
||||
NEXTEND = ASE::Awk::ERR_NEXTEND,
|
||||
NEXTFBEG = ASE::Awk::ERR_NEXTFBEG,
|
||||
NEXTFEND = ASE::Awk::ERR_NEXTFEND,
|
||||
PRINTFARG = ASE::Awk::ERR_PRINTFARG,
|
||||
PREPST = ASE::Awk::ERR_PREPST,
|
||||
GLNCPS = ASE::Awk::ERR_GLNCPS,
|
||||
DIVBY0 = ASE::Awk::ERR_DIVBY0,
|
||||
OPERAND = ASE::Awk::ERR_OPERAND,
|
||||
POSIDX = ASE::Awk::ERR_POSIDX,
|
||||
ARGTF = ASE::Awk::ERR_ARGTF,
|
||||
ARGTM = ASE::Awk::ERR_ARGTM,
|
||||
FNNONE = ASE::Awk::ERR_FNNONE,
|
||||
NOTIDX = ASE::Awk::ERR_NOTIDX,
|
||||
NOTDEL = ASE::Awk::ERR_NOTDEL,
|
||||
NOTMAP = ASE::Awk::ERR_NOTMAP,
|
||||
NOTMAPIN = ASE::Awk::ERR_NOTMAPIN,
|
||||
NOTMAPNILIN = ASE::Awk::ERR_NOTMAPNILIN,
|
||||
NOTREF = ASE::Awk::ERR_NOTREF,
|
||||
NOTASS = ASE::Awk::ERR_NOTASS,
|
||||
IDXVALASSMAP = ASE::Awk::ERR_IDXVALASSMAP,
|
||||
POSVALASSMAP = ASE::Awk::ERR_POSVALASSMAP,
|
||||
MAPTOSCALAR = ASE::Awk::ERR_MAPTOSCALAR,
|
||||
SCALARTOMAP = ASE::Awk::ERR_SCALARTOMAP,
|
||||
MAPNOTALLOWED = ASE::Awk::ERR_MAPNOTALLOWED,
|
||||
VALTYPE = ASE::Awk::ERR_VALTYPE,
|
||||
RDELETE = ASE::Awk::ERR_RDELETE,
|
||||
RNEXTBEG = ASE::Awk::ERR_RNEXTBEG,
|
||||
RNEXTEND = ASE::Awk::ERR_RNEXTEND,
|
||||
RNEXTFBEG = ASE::Awk::ERR_RNEXTFBEG,
|
||||
RNEXTFEND = ASE::Awk::ERR_RNEXTFEND,
|
||||
BFNUSER = ASE::Awk::ERR_BFNUSER,
|
||||
BFNIMPL = ASE::Awk::ERR_BFNIMPL,
|
||||
IOUSER = ASE::Awk::ERR_IOUSER,
|
||||
IONONE = ASE::Awk::ERR_IONONE,
|
||||
IOIMPL = ASE::Awk::ERR_IOIMPL,
|
||||
IONMEM = ASE::Awk::ERR_IONMEM,
|
||||
IONMNL = ASE::Awk::ERR_IONMNL,
|
||||
FMTARG = ASE::Awk::ERR_FMTARG,
|
||||
FMTCNV = ASE::Awk::ERR_FMTCNV,
|
||||
CONVFMTCHR = ASE::Awk::ERR_CONVFMTCHR,
|
||||
OFMTCHR = ASE::Awk::ERR_OFMTCHR,
|
||||
REXRECUR = ASE::Awk::ERR_REXRECUR,
|
||||
REXRPAREN = ASE::Awk::ERR_REXRPAREN,
|
||||
REXRBRACKET = ASE::Awk::ERR_REXRBRACKET,
|
||||
REXRBRACE = ASE::Awk::ERR_REXRBRACE,
|
||||
REXUNBALPAR = ASE::Awk::ERR_REXUNBALPAR,
|
||||
REXCOLON = ASE::Awk::ERR_REXCOLON,
|
||||
REXCRANGE = ASE::Awk::ERR_REXCRANGE,
|
||||
REXCCLASS = ASE::Awk::ERR_REXCCLASS,
|
||||
REXBRANGE = ASE::Awk::ERR_REXBRANGE,
|
||||
REXEND = ASE::Awk::ERR_REXEND,
|
||||
REXGARBAGE = ASE::Awk::ERR_REXGARBAGE
|
||||
};
|
||||
// end of enum class ERROR
|
||||
|
||||
typedef ASE::Awk::char_t char_t;
|
||||
|
||||
Awk ();
|
||||
!Awk ();
|
||||
virtual ~Awk ();
|
||||
@ -715,12 +733,13 @@ namespace ASE
|
||||
unsigned int get () { return this->errLine; }
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
MojoAwk* awk;
|
||||
OPTION option;
|
||||
System::Collections::Hashtable^ funcs;
|
||||
|
||||
public protected:
|
||||
public protected:
|
||||
// Source
|
||||
virtual int OpenSource (Source^ source) = 0;
|
||||
virtual int CloseSource (Source^ source) = 0;
|
||||
@ -757,21 +776,28 @@ namespace ASE
|
||||
virtual int FlushConsole (Console^ console) = 0;
|
||||
virtual int NextConsole (Console^ console) = 0;
|
||||
|
||||
public protected:
|
||||
public protected:
|
||||
bool Awk::DispatchFunction (
|
||||
Context^ ctx, ASE::Awk::Return& ret,
|
||||
const ASE::Awk::Argument* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
|
||||
public protected:
|
||||
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.
|
||||
};
|
||||
void SetError (ERROR num);
|
||||
void SetError (ERROR num, size_t line);
|
||||
void SetError (ERROR num, size_t line, System::String^ arg);
|
||||
void SetErrorWithMessage (ERROR num, size_t line, System::String^ msg);
|
||||
|
||||
}
|
||||
}
|
||||
void RetrieveError ();
|
||||
|
||||
bool runErrorReported; // only used if the run-callback is activated.
|
||||
bool stopRequested;
|
||||
};
|
||||
|
||||
//////////////////////////////
|
||||
ASE_END_NAMESPACE2(Net,ASE)
|
||||
//////////////////////////////
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: StdAwk.cpp,v 1.16 2007/10/08 09:43:15 bacon Exp $
|
||||
* $Id: StdAwk.cpp,v 1.17 2007/10/10 03:37:49 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -16,13 +16,10 @@
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
namespace ASE
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
ASE_BEGIN_NAMESPACE2(ASE,Net)
|
||||
|
||||
StdAwk::StdAwk ()
|
||||
{
|
||||
StdAwk::StdAwk ()
|
||||
{
|
||||
random_seed = (gcnew System::Random)->Next (System::Int32::MinValue, System::Int32::MaxValue);
|
||||
random = gcnew System::Random (random_seed);
|
||||
|
||||
@ -41,64 +38,64 @@ namespace ASE
|
||||
AddFunction ("systime", 0, 0, gcnew FunctionHandler (this, &StdAwk::Systime));
|
||||
AddFunction ("strftime", 0, 2, gcnew FunctionHandler (this, &StdAwk::Strftime));
|
||||
AddFunction ("strfgmtime", 0, 2, gcnew FunctionHandler (this, &StdAwk::Strfgmtime));
|
||||
}
|
||||
}
|
||||
|
||||
StdAwk::~StdAwk ()
|
||||
{
|
||||
}
|
||||
StdAwk::~StdAwk ()
|
||||
{
|
||||
}
|
||||
|
||||
bool StdAwk::Sin (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Sin (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Sin (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Cos (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Cos (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Cos (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Tan (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Tan (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Tan (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Atan (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Atan (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Atan (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Atan2 (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Atan2 (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Atan2 (args[0]->RealValue, args[1]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Log (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Log (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Log (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Exp (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Exp (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Exp (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Sqrt (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Sqrt (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((real_t)System::Math::Sqrt (args[0]->RealValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Int (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Int (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set (args[0]->LongValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Rand (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Rand (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((long_t)random->Next ());
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Srand (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Srand (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
int seed = (int)args[0]->LongValue;
|
||||
System::Random^ tmp = gcnew System::Random (seed);
|
||||
|
||||
@ -107,7 +104,7 @@ namespace ASE
|
||||
this->random_seed = seed;
|
||||
this->random = tmp;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER>=1400)
|
||||
#define time_t __time64_t
|
||||
@ -116,13 +113,13 @@ namespace ASE
|
||||
#define gmtime _gmtime64
|
||||
#endif
|
||||
|
||||
bool StdAwk::Systime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Systime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
return ret->Set ((long_t)::time(NULL));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Strftime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Strftime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
wchar_t buf[128];
|
||||
struct tm* tm;
|
||||
size_t len;
|
||||
@ -146,10 +143,10 @@ namespace ASE
|
||||
}
|
||||
|
||||
return ret->Set (gcnew System::String (buf, 0, len));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdAwk::Strfgmtime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
bool StdAwk::Strfgmtime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret)
|
||||
{
|
||||
wchar_t buf[128];
|
||||
struct tm* tm;
|
||||
size_t len;
|
||||
@ -173,10 +170,10 @@ namespace ASE
|
||||
}
|
||||
|
||||
return ret->Set (gcnew System::String (buf, 0, len));
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::OpenFile (File^ file)
|
||||
{
|
||||
int StdAwk::OpenFile (File^ file)
|
||||
{
|
||||
System::IO::FileMode mode;
|
||||
System::IO::FileAccess access;
|
||||
System::IO::FileStream^ fs;
|
||||
@ -210,10 +207,10 @@ namespace ASE
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::CloseFile (File^ file)
|
||||
{
|
||||
int StdAwk::CloseFile (File^ file)
|
||||
{
|
||||
if (file->Mode->Equals(File::MODE::READ))
|
||||
{
|
||||
System::IO::StreamReader^ sr = (System::IO::StreamReader^)file->Handle;
|
||||
@ -225,31 +222,31 @@ namespace ASE
|
||||
sw->Close ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::ReadFile (File^ file, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
int StdAwk::ReadFile (File^ file, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
System::IO::StreamReader^ sr = (System::IO::StreamReader^)file->Handle;
|
||||
return sr->Read (buf, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::WriteFile (File^ file, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
int StdAwk::WriteFile (File^ file, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
System::IO::StreamWriter^ sw = (System::IO::StreamWriter^)file->Handle;
|
||||
sw->Write (buf, 0, len);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::FlushFile (File^ file)
|
||||
{
|
||||
int StdAwk::FlushFile (File^ file)
|
||||
{
|
||||
System::IO::StreamWriter^ sw = (System::IO::StreamWriter^)file->Handle;
|
||||
sw->Flush ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int StdAwk::OpenPipe (Pipe^ pipe)
|
||||
{
|
||||
int StdAwk::OpenPipe (Pipe^ pipe)
|
||||
{
|
||||
FILE* fp = NULL;
|
||||
|
||||
cli::pin_ptr<const wchar_t> name =
|
||||
@ -268,17 +265,17 @@ namespace ASE
|
||||
|
||||
pipe->Handle = System::IntPtr ((void*)fp);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::ClosePipe (Pipe^ pipe)
|
||||
{
|
||||
int StdAwk::ClosePipe (Pipe^ pipe)
|
||||
{
|
||||
System::IntPtr ip = (System::IntPtr)pipe->Handle;
|
||||
FILE* fp = (FILE*)ip.ToPointer();
|
||||
return (::_pclose (fp) == EOF)? -1: 0;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::ReadPipe (Pipe^ pipe, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
int StdAwk::ReadPipe (Pipe^ pipe, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
System::IntPtr ip = (System::IntPtr)pipe->Handle;
|
||||
FILE* fp = (FILE*)ip.ToPointer();
|
||||
|
||||
@ -294,10 +291,10 @@ namespace ASE
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::WritePipe (Pipe^ pipe, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
int StdAwk::WritePipe (Pipe^ pipe, cli::array<char_t>^ buf, int len)
|
||||
{
|
||||
System::IntPtr ip = (System::IntPtr)pipe->Handle;
|
||||
FILE* fp = (FILE*)ip.ToPointer();
|
||||
int left;
|
||||
@ -354,13 +351,13 @@ namespace ASE
|
||||
|
||||
::free (mbp);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
int StdAwk::FlushPipe (Pipe^ pipe)
|
||||
{
|
||||
int StdAwk::FlushPipe (Pipe^ pipe)
|
||||
{
|
||||
System::IntPtr ip = (System::IntPtr)pipe->Handle;
|
||||
FILE* fp = (FILE*)ip.ToPointer();
|
||||
return (::fflush (fp) == EOF)? -1: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASE_END_NAMESPACE2(Net,ASE)
|
||||
|
@ -1,21 +1,18 @@
|
||||
/*
|
||||
* $Id: StdAwk.hpp,v 1.8 2007/10/08 09:43:15 bacon Exp $
|
||||
* $Id: StdAwk.hpp,v 1.9 2007/10/10 03:37:49 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/net/Awk.hpp>
|
||||
|
||||
namespace ASE
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
ASE_BEGIN_NAMESPACE2(ASE,Net)
|
||||
|
||||
public ref class StdAwk abstract: public Awk
|
||||
{
|
||||
public:
|
||||
public ref class StdAwk abstract: public Awk
|
||||
{
|
||||
public:
|
||||
StdAwk ();
|
||||
~StdAwk ();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int random_seed;
|
||||
System::Random^ random;
|
||||
|
||||
@ -34,7 +31,7 @@ namespace ASE
|
||||
bool Strftime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret);
|
||||
bool Strfgmtime (Context^ ctx, System::String^ name, array<Argument^>^ args, Return^ ret);
|
||||
|
||||
public protected:
|
||||
public protected:
|
||||
// File
|
||||
virtual int OpenFile (File^ file) override;
|
||||
virtual int CloseFile (File^ file) override;
|
||||
@ -52,6 +49,6 @@ namespace ASE
|
||||
virtual int WritePipe (
|
||||
Pipe^ pipe, cli::array<char_t>^ buf, int len) override;
|
||||
virtual int FlushPipe (Pipe^ pipe) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ASE_END_NAMESPACE2(Net,ASE)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.41 2007/10/07 15:27:39 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.42 2007/10/10 03:37:49 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/StdAwk.hpp>
|
||||
@ -16,6 +16,11 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
class TestAwk: public ASE::StdAwk
|
||||
{
|
||||
public:
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user