Recovered from cvs revision 2007-05-16 03:34:00

This commit is contained in:
hyung-hwan 2007-05-17 00:14:00 +00:00
parent 99bed82ac3
commit a89fc5e2aa
7 changed files with 323 additions and 14 deletions

View File

@ -41,8 +41,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestlsp", "test\lsp\aset
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asetestcnt", "test\cnt\asetestcnt.csproj", "{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asenet", "net\asenet.vcproj", "{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asecnt", "cnt\asecnt.csproj", "{7F679165-41FB-4E1E-B3F5-23C5EE94166A}"
ProjectSection(ProjectDependencies) = postProject
{963AF7B5-12E6-42B6-8CBE-89136C1A109B} = {963AF7B5-12E6-42B6-8CBE-89136C1A109B}
@ -59,6 +57,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asetestawk++", "test\awk\as
{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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -159,16 +159,6 @@ Global
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Win32.ActiveCfg = Release|Any CPU
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Debug|Win32.ActiveCfg = Debug|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Debug|Win32.Build.0 = Debug|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Release|Any CPU.ActiveCfg = Release|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Release|Mixed Platforms.Build.0 = Release|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Release|Win32.ActiveCfg = Release|Win32
{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}.Release|Win32.Build.0 = Release|Win32
{7F679165-41FB-4E1E-B3F5-23C5EE94166A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F679165-41FB-4E1E-B3F5-23C5EE94166A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F679165-41FB-4E1E-B3F5-23C5EE94166A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -199,6 +189,16 @@ Global
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Mixed Platforms.Build.0 = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Win32.ActiveCfg = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Win32.Build.0 = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Any CPU.ActiveCfg = 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
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Win32.Build.0 = Debug|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Any CPU.ActiveCfg = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.Build.0 = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Win32.ActiveCfg = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

139
ase/net/Awk.cpp Normal file
View File

@ -0,0 +1,139 @@
/*
* $Id: Awk.cpp,v 1.1 2007/05/15 08:29:30 bacon Exp $
*/
#include "stdafx.h"
#include "Awk.hpp"
#include <ase/utl/ctype.h>
#include <ase/utl/stdio.h>
#include <stdlib.h>
#include <math.h>
#include <msclr/auto_gcroot.h>
namespace ASE
{
class StubAwk: public Awk
{
public:
StubAwk (NET::Awk^ wrapper): wrapper(wrapper)
{
}
int openSource (Source& io)
{
NET::Awk::Source^ nio = gcnew NET::Awk::Source ();
int n = wrapper->OpenSource (nio);
// TODO: put nio back to io.
return n;
}
int closeSource (Source& io)
{
return 0;
}
ssize_t readSource (Source& io, char_t* buf, size_t len)
{
return 0;
}
ssize_t writeSource (Source& io, char_t* buf, size_t len)
{
return 0;
}
int openPipe (Pipe& io) {return 0; }
int closePipe (Pipe& io) {return 0; }
ssize_t readPipe (Pipe& io, char_t* buf, size_t len) {return 0; }
ssize_t writePipe (Pipe& io, char_t* buf, size_t len) {return 0; }
int flushPipe (Pipe& io) {return 0; }
int openFile (File& io) {return 0; }
int closeFile (File& io) {return 0; }
ssize_t readFile (File& io, char_t* buf, size_t len) {return 0; }
ssize_t writeFile (File& io, char_t* buf, size_t len) {return 0; }
int flushFile (File& io) {return 0; }
int openConsole (Console& io) {return 0; }
int closeConsole (Console& io) {return 0; }
ssize_t readConsole (Console& io, char_t* buf, size_t len) {return 0; }
ssize_t writeConsole (Console& io, char_t* buf, size_t len) {return 0; }
int flushConsole (Console& io) {return 0; }
int nextConsole (Console& io) {return 0; }
// primitive operations
void* allocMem (size_t n) { return ::malloc (n); }
void* reallocMem (void* ptr, size_t n) { return ::realloc (ptr, n); }
void freeMem (void* ptr) { ::free (ptr); }
bool_t isUpper (cint_t c) { return ase_isupper (c); }
bool_t isLower (cint_t c) { return ase_islower (c); }
bool_t isAlpha (cint_t c) { return ase_isalpha (c); }
bool_t isDigit (cint_t c) { return ase_isdigit (c); }
bool_t isXdigit (cint_t c) { return ase_isxdigit (c); }
bool_t isAlnum (cint_t c) { return ase_isalnum (c); }
bool_t isSpace (cint_t c) { return ase_isspace (c); }
bool_t isPrint (cint_t c) { return ase_isprint (c); }
bool_t isGraph (cint_t c) { return ase_isgraph (c); }
bool_t isCntrl (cint_t c) { return ase_iscntrl (c); }
bool_t isPunct (cint_t c) { return ase_ispunct (c); }
cint_t toUpper (cint_t c) { return ase_toupper (c); }
cint_t toLower (cint_t c) { return ase_tolower (c); }
real_t pow (real_t x, real_t y)
{
return ::pow (x, y);
}
int vsprintf (char_t* buf, size_t size, const char_t* fmt, va_list arg)
{
return ase_vsprintf (buf, size, fmt, arg);
}
void vdprintf (const char_t* fmt, va_list arg)
{
ase_vfprintf (stderr, fmt, arg);
}
private:
msclr::auto_gcroot<NET::Awk^> wrapper;
};
namespace NET
{
Awk::Awk ()
{
awk = new ASE::StubAwk (this);
}
Awk::~Awk ()
{
delete awk;
}
bool Awk::Parse ()
{
return awk->parse () == 0;
}
bool Awk::Run ()
{
return awk->run () == 0;
}
bool Awk::AddFunction (System::String^ name, int minArgs, int maxArgs, FunctionHandler^ handler)
{
return false;
}
bool Awk::DeleteFunction (System::String^ name)
{
return false;
}
}
}

123
ase/net/Awk.hpp Normal file
View File

@ -0,0 +1,123 @@
/*
* $Id: Awk.hpp,v 1.1 2007/05/15 08:29:30 bacon Exp $
*/
#pragma once
#include <ase/awk/Awk.hpp>
using namespace System;
namespace ASE
{
namespace NET
{
public ref class Awk abstract
{
public:
ref class Source
{
public:
enum class MODE
{
READ = ASE::Awk::Source::READ,
WRITE = ASE::Awk::Source::WRITE
};
property MODE^ Mode
{
MODE^ get () { return this->mode; }
void set (MODE^ mode) { this->mode = mode; }
};
private:
MODE^ mode;
};
ref class Extio
{
};
ref class Pipe: public Extio
{
public:
enum class MODE
{
READ = ASE::Awk::Pipe::READ,
WRITE = ASE::Awk::Pipe::WRITE
};
property MODE^ Mode
{
MODE^ get () { return this->mode; }
void set (MODE^ mode) { this->mode = mode; }
};
private:
MODE^ mode;
};
ref class File: public Extio
{
public:
enum class MODE
{
READ = ASE::Awk::File::READ,
WRITE = ASE::Awk::File::WRITE,
APPEND = ASE::Awk::File::APPEND
};
property MODE^ Mode
{
MODE^ get () { return this->mode; }
void set (MODE^ mode) { this->mode = mode; }
};
private:
MODE^ mode;
};
ref class Console: public Extio
{
public:
enum class MODE
{
READ = ASE::Awk::Console::READ,
WRITE = ASE::Awk::Console::WRITE
};
property MODE^ Mode
{
MODE^ get () { return this->mode; }
void set (MODE^ mode) { this->mode = mode; }
};
private:
MODE^ mode;
};
Awk ();
virtual ~Awk ();
bool Parse ();
bool Run ();
delegate System::Object^ FunctionHandler (array<System::Object^>^ args);
bool AddFunction (System::String^ name, int minArgs, int maxArgs, FunctionHandler^ handler);
bool DeleteFunction (System::String^ name);
virtual int OpenSource (Source^ io) = 0;
virtual int CloseSource (Source^ io) = 0;
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:
ASE::Awk* awk;
};
}
}

7
ase/net/asenet.cpp Normal file
View File

@ -0,0 +1,7 @@
/*
* $Id: asenet.cpp,v 1.1 2007/05/15 08:29:30 bacon Exp $
*/
#include "stdafx.h"
#include "asenet.h"

15
ase/net/asenet.h Normal file
View File

@ -0,0 +1,15 @@
/*
* $Id: asenet.h,v 1.1 2007/05/15 08:29:30 bacon Exp $
*/
#pragma once
using namespace System;
namespace ASE
{
namespace NET
{
}
}

View File

@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="asenet"
ProjectGUID="{4CBF0E86-D018-49D7-A6B8-0CDA698203F7}"
ProjectGUID="{A63E9DF9-1D47-4D81-834C-1D40406C18C4}"
RootNamespace="asenet"
Keyword="ManagedCProj"
>
@ -41,6 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../.."
PreprocessorDefinitions="WIN32;_DEBUG"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
@ -60,6 +61,7 @@
Name="VCLinkerTool"
AdditionalDependencies="$(NoInherit)"
LinkIncremental="2"
AdditionalLibraryDirectories="$(OutDir)"
GenerateDebugInformation="true"
AssemblyDebug="1"
TargetMachine="1"
@ -115,6 +117,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../.."
PreprocessorDefinitions="WIN32;NDEBUG"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
@ -132,8 +135,9 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(NoInherit)"
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(OutDir)"
GenerateDebugInformation="true"
TargetMachine="1"
/>
@ -183,10 +187,18 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\asenet.cpp"
>
</File>
<File
RelativePath=".\AssemblyInfo.cpp"
>
</File>
<File
RelativePath=".\Awk.cpp"
>
</File>
<File
RelativePath=".\Stdafx.cpp"
>
@ -213,6 +225,14 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\asenet.h"
>
</File>
<File
RelativePath=".\Awk.hpp"
>
</File>
<File
RelativePath=".\resource.h"
>

View File

@ -18,6 +18,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -77,6 +78,10 @@
<Project>{7F679165-41FB-4E1E-B3F5-23C5EE94166A}</Project>
<Name>asecnt</Name>
</ProjectReference>
<ProjectReference Include="..\..\net\asenet.vcproj">
<Project>{A63E9DF9-1D47-4D81-834C-1D40406C18C4}</Project>
<Name>asenet</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.