Recovered from cvs revision 2007-09-01 15:43:00

This commit is contained in:
2007-09-02 00:43:00 +00:00
parent 6bd702fccf
commit c8b439dd91
20 changed files with 213 additions and 45 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.19 2007/08/24 13:17:59 bacon Exp $
* $Id: Awk.hpp,v 1.20 2007/08/26 14:33:38 bacon Exp $
*/
#pragma once
@ -310,7 +310,7 @@ namespace ASE
EXTIO = ASE::Awk::OPT_EXTIO,
COPROC = ASE::Awk::OPT_COPROC,
BLOCKLESS = ASE::Awk::OPT_BLOCKLESS,
STRBASEONE = ASE::Awk::OPT_STRBASEONE,
STRBASEONE = ASE::Awk::OPT_BASEONE,
STRIPSPACES = ASE::Awk::OPT_STRIPSPACES,
NEXTOFILE = ASE::Awk::OPT_NEXTOFILE,
CRLF = ASE::Awk::OPT_CRLF,

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.cpp,v 1.7 2007/08/24 16:02:49 bacon Exp $
* $Id: StdAwk.cpp,v 1.8 2007/08/26 14:33:38 bacon Exp $
*/
#include "stdafx.h"
@ -18,10 +18,23 @@ namespace ASE
StdAwk::StdAwk ()
{
/*
seed = System::DateTime
random = gcnew System::Random ();
*/
// TODO: exception/error handling....
AddFunction ("sin", 1, 1, gcnew FunctionHandler (this, &StdAwk::Sin));
AddFunction ("cos", 1, 1, gcnew FunctionHandler (this, &StdAwk::Cos));
AddFunction ("tan", 1, 1, gcnew FunctionHandler (this, &StdAwk::Tan));
AddFunction ("atan", 1, 1, gcnew FunctionHandler (this, &StdAwk::Atan));
AddFunction ("atan2", 2, 2, gcnew FunctionHandler (this, &StdAwk::Atan2));
AddFunction ("log", 1, 1, gcnew FunctionHandler (this, &StdAwk::Log));
AddFunction ("exp", 1, 1, gcnew FunctionHandler (this, &StdAwk::Exp));
AddFunction ("sqrt", 1, 1, gcnew FunctionHandler (this, &StdAwk::Sqrt));
AddFunction ("int", 1, 1, gcnew FunctionHandler (this, &StdAwk::Int));
//AddFunction ("rand", 0, 0, gcnew FunctionHandler (this, &StdAwk::Int));
//AddFunction ("srand", 1, 1, gcnew FunctionHandler (this, &StdAwk::Int));
}
StdAwk::~StdAwk ()
@ -46,6 +59,55 @@ namespace ASE
return true;
}
bool StdAwk::Atan (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->RealValue = System::Math::Atan (args[0]->RealValue);
return true;
}
bool StdAwk::Atan2 (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->RealValue = System::Math::Atan2 (args[0]->RealValue, args[1]->RealValue);
return true;
}
bool StdAwk::Log (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->RealValue = System::Math::Log (args[0]->RealValue);
return true;
}
bool StdAwk::Exp (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->RealValue = System::Math::Exp (args[0]->RealValue);
return true;
}
bool StdAwk::Sqrt (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->RealValue = System::Math::Sqrt (args[0]->RealValue);
return true;
}
bool StdAwk::Int (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->LongValue = args[0]->LongValue;
return true;
}
/*
bool StdAwk::Rand (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->LongValue = random->Next ();
return true;
}
bool StdAwk::Srand (System::String^ name, array<Argument^>^ args, Return^ ret)
{
ret->LongValue = args[0]->LongValue;
return true;
}*/
int StdAwk::OpenFile (File^ file)
{
System::IO::FileMode mode;

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.hpp,v 1.5 2007/08/20 14:19:58 bacon Exp $
* $Id: StdAwk.hpp,v 1.6 2007/08/26 14:33:38 bacon Exp $
*/
#include <ase/net/Awk.hpp>
@ -16,9 +16,19 @@ namespace ASE
~StdAwk ();
protected:
System::Random^ random;
bool Sin (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Cos (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Tan (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Atan (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Atan2 (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Log (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Exp (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Sqrt (System::String^ name, array<Argument^>^ args, Return^ ret);
bool Int (System::String^ name, array<Argument^>^ args, Return^ ret);
//bool Rand (System::String^ name, array<Argument^>^ args, Return^ ret);
//bool Srand (System::String^ name, array<Argument^>^ args, Return^ ret);
public protected:
// File