Recovered from cvs revision 2007-06-23 17:07:00
This commit is contained in:
parent
7e233c06b1
commit
6c73b9f606
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.cpp,v 1.27 2007/06/20 04:22:21 bacon Exp $
|
* $Id: Awk.cpp,v 1.28 2007/06/21 13:59:24 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/awk/StdAwk.hpp>
|
#include <ase/awk/StdAwk.hpp>
|
||||||
@ -40,12 +40,21 @@ public:
|
|||||||
if (heap == ASE_NULL) return -1;
|
if (heap == ASE_NULL) return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
int n = StdAwk::open ();
|
||||||
|
#else
|
||||||
int n = ASE::StdAwk::open ();
|
int n = ASE::StdAwk::open ();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (addFunction (ASE_T("sleep"), 1, 1,
|
if (addFunction (ASE_T("sleep"), 1, 1,
|
||||||
(FunctionHandler)&TestAwk::sleep) == -1)
|
(FunctionHandler)&TestAwk::sleep) == -1)
|
||||||
{
|
{
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
StdAwk::close ();
|
||||||
|
#else
|
||||||
ASE::StdAwk::close ();
|
ASE::StdAwk::close ();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HeapDestroy (heap);
|
HeapDestroy (heap);
|
||||||
heap = ASE_NULL;
|
heap = ASE_NULL;
|
||||||
@ -58,7 +67,11 @@ public:
|
|||||||
|
|
||||||
void close ()
|
void close ()
|
||||||
{
|
{
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
StdAwk::close ();
|
||||||
|
#else
|
||||||
ASE::StdAwk::close ();
|
ASE::StdAwk::close ();
|
||||||
|
#endif
|
||||||
|
|
||||||
numConInFiles = 0;
|
numConInFiles = 0;
|
||||||
numConOutFiles = 0;
|
numConOutFiles = 0;
|
||||||
@ -105,7 +118,11 @@ public:
|
|||||||
{
|
{
|
||||||
srcInName = in;
|
srcInName = in;
|
||||||
srcOutName = out;
|
srcOutName = out;
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
return StdAwk::parse ();
|
||||||
|
#else
|
||||||
return ASE::StdAwk::parse ();
|
return ASE::StdAwk::parse ();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -221,13 +238,21 @@ protected:
|
|||||||
// console io handlers
|
// console io handlers
|
||||||
int openConsole (Console& io)
|
int openConsole (Console& io)
|
||||||
{
|
{
|
||||||
ASE::Awk::Console::Mode mode = io.getMode();
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
StdAwk::Console::Mode mode = io.getMode();
|
||||||
|
#else
|
||||||
|
ASE::StdAwk::Console::Mode mode = io.getMode();
|
||||||
|
#endif
|
||||||
FILE* fp = ASE_NULL;
|
FILE* fp = ASE_NULL;
|
||||||
const char_t* fn = ASE_NULL;
|
const char_t* fn = ASE_NULL;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case ASE::Awk::Console::READ:
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
case StdAwk::Console::READ:
|
||||||
|
#else
|
||||||
|
case ASE::StdAwk::Console::READ:
|
||||||
|
#endif
|
||||||
if (numConInFiles == 0) fp = stdin;
|
if (numConInFiles == 0) fp = stdin;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -236,7 +261,11 @@ protected:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASE::Awk::Console::WRITE:
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
case StdAwk::Console::WRITE:
|
||||||
|
#else
|
||||||
|
case ASE::StdAwk::Console::WRITE:
|
||||||
|
#endif
|
||||||
if (numConOutFiles == 0) fp = stdout;
|
if (numConOutFiles == 0) fp = stdout;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -248,7 +277,8 @@ protected:
|
|||||||
|
|
||||||
if (fp == NULL) return -1;
|
if (fp == NULL) return -1;
|
||||||
|
|
||||||
ConTrack* t = (ConTrack*) ase_awk_malloc (awk, ASE_SIZEOF(ConTrack));
|
ConTrack* t = (ConTrack*)
|
||||||
|
ase_awk_malloc (awk, ASE_SIZEOF(ConTrack));
|
||||||
if (t == ASE_NULL)
|
if (t == ASE_NULL)
|
||||||
{
|
{
|
||||||
if (fp != stdin && fp != stdout) fclose (fp);
|
if (fp != stdin && fp != stdout) fclose (fp);
|
||||||
@ -335,7 +365,11 @@ protected:
|
|||||||
|
|
||||||
int nextConsole (Console& io)
|
int nextConsole (Console& io)
|
||||||
{
|
{
|
||||||
ASE::Awk::Console::Mode mode = io.getMode();
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
StdAwk::Console::Mode mode = io.getMode();
|
||||||
|
#else
|
||||||
|
ASE::StdAwk::Console::Mode mode = io.getMode();
|
||||||
|
#endif
|
||||||
ConTrack* t = (ConTrack*)io.getHandle();
|
ConTrack* t = (ConTrack*)io.getHandle();
|
||||||
FILE* ofp = t->handle;
|
FILE* ofp = t->handle;
|
||||||
FILE* nfp = ASE_NULL;
|
FILE* nfp = ASE_NULL;
|
||||||
@ -343,13 +377,21 @@ protected:
|
|||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case ASE::Awk::Console::READ:
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
case StdAwk::Console::READ:
|
||||||
|
#else
|
||||||
|
case ASE::StdAwk::Console::READ:
|
||||||
|
#endif
|
||||||
if (t->nextConIdx >= numConInFiles) return 0;
|
if (t->nextConIdx >= numConInFiles) return 0;
|
||||||
fn = conInFile[t->nextConIdx];
|
fn = conInFile[t->nextConIdx];
|
||||||
nfp = ase_fopen (fn, ASE_T("r"));
|
nfp = ase_fopen (fn, ASE_T("r"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASE::Awk::Console::WRITE:
|
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||||
|
case StdAwk::Console::WRITE:
|
||||||
|
#else
|
||||||
|
case ASE::StdAwk::Console::WRITE:
|
||||||
|
#endif
|
||||||
if (t->nextConIdx >= numConOutFiles) return 0;
|
if (t->nextConIdx >= numConOutFiles) return 0;
|
||||||
fn = conOutFile[t->nextConIdx];
|
fn = conOutFile[t->nextConIdx];
|
||||||
nfp = ase_fopen (fn, ASE_T("w"));
|
nfp = ase_fopen (fn, ASE_T("w"));
|
||||||
|
Loading…
Reference in New Issue
Block a user