Recovered from cvs revision 2007-07-16 11:12:00

This commit is contained in:
2007-07-16 20:16:00 +00:00
parent 4373003780
commit 0f87fb5842
23 changed files with 818 additions and 84 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.2 2007/07/09 16:07:30 bacon Exp $
* $Id: Awk.cpp,v 1.3 2007/07/15 16:31:59 bacon Exp $
*/
#include "stdafx.h"
@ -12,37 +12,57 @@
#include <msclr/auto_gcroot.h>
namespace ASE
{
class StubAwk: public Awk
{
public:
StubAwk (NET::Awk^ wrapper): wrapper(wrapper)
StubAwk (Net::Awk^ wrapper): wrapper(wrapper)
{
}
int stubFunctionHandler (
Return* ret, const Argument* args, size_t nargs,
const char_t* name, size_t len)
{
System::String^ nm = gcnew System::String (name, 0, len);
return wrapper->DispatchFunction (nm);
}
int openSource (Source& io)
{
NET::Awk::Source^ nio = gcnew NET::Awk::Source ();
/*
Net::Awk::Source^ nio = gcnew Net::Awk::Source ();
int n = wrapper->OpenSource (nio);
// TODO: put nio back to io.
return n;
*/
if (io.getMode() == Source::READ)
{
//wrapper->SourceInputStream->BeginRead ();
}
else
{
//wrapper->SourceOutputStream->BeginWrite ();
}
return 1;
}
int closeSource (Source& io)
{
//System::IO::Stream^ stream = io.getHandle();
//stream->Close ();
return 0;
}
ssize_t readSource (Source& io, char_t* buf, size_t len)
{
//System::IO::Stream^ stream = io.getHandle();
return 0;
}
ssize_t writeSource (Source& io, char_t* buf, size_t len)
{
//System::IO::Stream^ stream = io.getHandle();
return 0;
}
@ -100,10 +120,10 @@ namespace ASE
}
private:
msclr::auto_gcroot<NET::Awk^> wrapper;
msclr::auto_gcroot<Net::Awk^> wrapper;
};
namespace NET
namespace Net
{
Awk::Awk ()
@ -126,14 +146,25 @@ namespace ASE
return awk->run () == 0;
}
bool Awk::AddFunction (System::String^ name, int minArgs, int maxArgs, FunctionHandler^ handler)
bool Awk::AddFunction (
System::String^ name, int minArgs, int maxArgs,
FunctionHandler^ handler)
{
return false;
cli::pin_ptr<const wchar_t> nptr = PtrToStringChars(name);
return awk->addFunction (nptr, minArgs, maxArgs,
(ASE::Awk::FunctionHandler)&StubAwk::stubFunctionHandler) == 0;
}
bool Awk::DeleteFunction (System::String^ name)
{
return false;
pin_ptr<const wchar_t> nptr = PtrToStringChars(name);
return awk->deleteFunction (nptr) == 0;
}
int Awk::DispatchFunction (System::String^ name)
{
return 0;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.1 2007/05/15 08:29:30 bacon Exp $
* $Id: Awk.hpp,v 1.2 2007/07/15 16:31:59 bacon Exp $
*/
#pragma once
@ -10,13 +10,12 @@ using namespace System;
namespace ASE
{
namespace NET
namespace Net
{
public ref class Awk abstract
{
public:
ref class Source
{
public:
@ -115,8 +114,39 @@ namespace ASE
virtual int ReadSource (Source^ io, ASE::Awk::char_t* buf, ASE::Awk::size_t len) = 0;
virtual int WriteSource (Source^ io, ASE::Awk::char_t* buf, ASE::Awk::size_t len) = 0;
private:
property System::IO::Stream^ SourceInputStream
{
System::IO::Stream^ get ()
{
return this->sourceInputStream;
}
void set (System::IO::Stream^ stream)
{
this->sourceInputStream = stream;
}
}
property System::IO::Stream^ SourceOutputStream
{
System::IO::Stream^ get ()
{
return this->sourceOutputStream;
}
void set (System::IO::Stream^ stream)
{
this->sourceOutputStream = stream;
}
}
protected:
ASE::Awk* awk;
System::IO::Stream^ sourceInputStream;
System::IO::Stream^ sourceOutputStream;
public protected:
int Awk::DispatchFunction (System::String^ name);
};
}

15
ase/net/StdAwk.cpp Normal file
View File

@ -0,0 +1,15 @@
/*
* $Id: StdAwk.cpp,v 1.1 2007/07/15 16:31:59 bacon Exp $
*/
#include "stdafx.h"
#include <ase/net/StdAwk.hpp>
namespace ASE
{
namespace Net
{
}
}

16
ase/net/StdAwk.hpp Normal file
View File

@ -0,0 +1,16 @@
/*
* $Id: StdAwk.hpp,v 1.1 2007/07/15 16:31:59 bacon Exp $
*/
#include <ase/net/Awk.hpp>
namespace ASE
{
namespace Net
{
public ref class StdAwk: Awk
{
public:
};
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: asenet.h,v 1.1 2007/05/15 08:29:30 bacon Exp $
* $Id: asenet.h,v 1.2 2007/07/15 16:31:59 bacon Exp $
*/
#pragma once
@ -8,7 +8,7 @@ using namespace System;
namespace ASE
{
namespace NET
namespace Net
{
}

View File

@ -59,7 +59,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(NoInherit)"
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="$(OutDir)"
GenerateDebugInformation="true"
@ -195,6 +195,10 @@
RelativePath=".\AssemblyInfo.cpp"
>
</File>
<File
RelativePath=".\assert.cpp"
>
</File>
<File
RelativePath=".\Awk.cpp"
>
@ -219,6 +223,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\StdAwk.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@ -241,6 +249,10 @@
RelativePath=".\Stdafx.h"
>
</File>
<File
RelativePath=".\StdAwk.hpp"
>
</File>
</Filter>
<Filter
Name="Resource Files"

40
ase/net/assert.cpp Normal file
View File

@ -0,0 +1,40 @@
/*
* $Id: assert.cpp,v 1.1 2007/07/15 16:31:59 bacon Exp $
*/
#include "stdafx.h"
#ifndef NDEBUG
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
void ase_assert_abort (void)
{
::abort ();
}
void ase_assert_printf (const ase_char_t* fmt, ...)
{
va_list ap;
#ifdef _WIN32
int n;
ase_char_t buf[1024];
#endif
va_start (ap, fmt);
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
//ase_vprintf (fmt, ap);
::MessageBox (NULL, buf,
ASE_T("ASSERTION FAILURE"), MB_OK|MB_ICONERROR);
va_end (ap);
}
#endif