Recovered from cvs revision 2007-10-05 15:11:00

This commit is contained in:
hyung-hwan 2007-10-06 00:11:00 +00:00
parent 78ec0d59a4
commit 990332a24e
2 changed files with 37 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.hpp,v 1.30 2007/10/04 04:48:27 bacon Exp $ * $Id: Awk.hpp,v 1.32 2007/10/04 14:26:21 bacon Exp $
* *
* {License} * {License}
*/ */
@ -54,7 +54,8 @@ namespace ASE
} }
} }
bool GetIndexedLong (System::String^ idx, [System::Runtime::InteropServices::Out] long_t% v) bool GetIndexedLong (System::String^ idx,
[System::Runtime::InteropServices::Out] long_t% v)
{ {
ASE::Awk::Argument x; ASE::Awk::Argument x;
cli::pin_ptr<const char_t> ip = PtrToStringChars(idx); cli::pin_ptr<const char_t> ip = PtrToStringChars(idx);
@ -63,7 +64,8 @@ namespace ASE
return true; return true;
} }
bool GetIndexedReal (System::String^ idx, [System::Runtime::InteropServices::Out] real_t% v) bool GetIndexedReal (System::String^ idx,
[System::Runtime::InteropServices::Out] real_t% v)
{ {
ASE::Awk::Argument x; ASE::Awk::Argument x;
cli::pin_ptr<const char_t> ip = PtrToStringChars(idx); cli::pin_ptr<const char_t> ip = PtrToStringChars(idx);
@ -72,7 +74,8 @@ namespace ASE
return true; return true;
} }
bool GetIndexedString (System::String^ idx, [System::Runtime::InteropServices::Out] System::String^% v) bool GetIndexedString (System::String^ idx,
[System::Runtime::InteropServices::Out] System::String^% v)
{ {
ASE::Awk::Argument x; ASE::Awk::Argument x;
cli::pin_ptr<const char_t> ip = PtrToStringChars(idx); cli::pin_ptr<const char_t> ip = PtrToStringChars(idx);
@ -250,14 +253,29 @@ namespace ASE
ASE::Awk::Return& ret; ASE::Awk::Return& ret;
}; };
ref class Run ref class Context
{ {
public protected: public protected:
Run (ASE::Awk::Run& run): run (run) Context (Awk^ owner, ASE::Awk::Run& run): owner (owner), run (run)
{ {
} }
public: public:
property Awk^ Owner
{
Awk^ get () { return this->owner; }
}
bool Stop ()
{
return run.stop () == 0;
}
/* TODO:
* GetError
* SetError
*/
bool SetGlobal (int id, System::String^ v) bool SetGlobal (int id, System::String^ v)
{ {
cli::pin_ptr<const char_t> nptr = PtrToStringChars(v); cli::pin_ptr<const char_t> nptr = PtrToStringChars(v);
@ -314,8 +332,7 @@ namespace ASE
return run.setGlobal (id, (real_t)(double)v) == 0; return run.setGlobal (id, (real_t)(double)v) == 0;
} }
/*
/* TODO:...
bool GetGlobal (int id, [System::Runtime::InteropServices::Out] Argument^ v) bool GetGlobal (int id, [System::Runtime::InteropServices::Out] Argument^ v)
{ {
return run.getGlobal (id, v->placeHolder) == 0; return run.getGlobal (id, v->placeHolder) == 0;
@ -323,6 +340,7 @@ namespace ASE
*/ */
protected: protected:
Awk^ owner;
ASE::Awk::Run& run; ASE::Awk::Run& run;
}; };
@ -640,11 +658,17 @@ namespace ASE
/*event*/ RunReturnHandler^ OnRunReturn; /*event*/ RunReturnHandler^ OnRunReturn;
/*event*/ RunStatementHandler^ OnRunStatement; /*event*/ RunStatementHandler^ OnRunStatement;
virtual bool AddGlobal (System::String^ name, [System::Runtime::InteropServices::Out] int% id); virtual bool AddGlobal (
System::String^ name,
[System::Runtime::InteropServices::Out] int% id);
virtual bool DeleteGlobal (System::String^ name); virtual bool DeleteGlobal (System::String^ name);
delegate bool FunctionHandler (System::String^ name, cli::array<Argument^>^ args, Return^ ret); delegate bool FunctionHandler (
virtual bool AddFunction (System::String^ name, int minArgs, int maxArgs, FunctionHandler^ handler); System::String^ name, cli::array<Argument^>^ args, Return^ ret);
virtual bool AddFunction (
System::String^ name, int minArgs,
int maxArgs, FunctionHandler^ handler);
virtual bool DeleteFunction (System::String^ name); virtual bool DeleteFunction (System::String^ name);
virtual bool SetWord (System::String^ ow, System::String^ nw); virtual bool SetWord (System::String^ ow, System::String^ nw);

View File

@ -35,7 +35,7 @@ namespace ase.net
public bool Run( public bool Run(
System.Windows.Forms.TextBox consoleInput, System.Windows.Forms.TextBox consoleInput,
System.Windows.Forms.TextBox consoleOutput, System.Windows.Forms.TextBox consoleOutput,
System.String main, System.String[] args) string main, string[] args)
{ {
this.consoleInput = consoleInput; this.consoleInput = consoleInput;
this.consoleOutput = consoleOutput; this.consoleOutput = consoleOutput;