Recovered from cvs revision 2007-05-07 08:23:00
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.9 2007/05/06 06:55:05 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.11 2007/05/06 10:38:22 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/Awk.hpp>
|
||||
@ -81,7 +81,6 @@ namespace ASE
|
||||
|
||||
Awk::~Awk ()
|
||||
{
|
||||
close ();
|
||||
}
|
||||
|
||||
int Awk::parse ()
|
||||
@ -105,10 +104,8 @@ namespace ASE
|
||||
|
||||
runios.pipe = pipeHandler;
|
||||
runios.coproc = ASE_NULL;
|
||||
/*
|
||||
runios.file = fileHandler;
|
||||
runios.console = consoleHandler;
|
||||
*/
|
||||
runios.custom_data = this;
|
||||
|
||||
return ase_awk_run (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp,v 1.8 2007/05/06 06:55:05 bacon Exp $
|
||||
* $Id: Awk.hpp,v 1.10 2007/05/06 10:38:22 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_HPP_
|
||||
@ -9,6 +9,16 @@
|
||||
#include <ase/awk/map.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef malloc
|
||||
#undef malloc
|
||||
#endif
|
||||
#ifdef realloc
|
||||
#undef realloc
|
||||
#endif
|
||||
#ifdef free
|
||||
#undef free
|
||||
#endif
|
||||
|
||||
namespace ASE
|
||||
{
|
||||
|
||||
@ -108,7 +118,6 @@ namespace ASE
|
||||
Mode mode;
|
||||
};
|
||||
|
||||
|
||||
Awk ();
|
||||
virtual ~Awk ();
|
||||
|
||||
@ -231,7 +240,7 @@ namespace ASE
|
||||
const char_t* fmt, ...);
|
||||
static void dprintf (void* custom, const char_t* fmt, ...);
|
||||
|
||||
private:
|
||||
protected:
|
||||
ase_awk_t* awk;
|
||||
ase_awk_map_t* functionMap;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: StdAwk.cpp,v 1.3 2007/05/06 06:55:05 bacon Exp $
|
||||
* $Id: StdAwk.cpp,v 1.4 2007/05/06 10:38:22 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/StdAwk.hpp>
|
||||
@ -16,11 +16,23 @@ namespace ASE
|
||||
int n = Awk::open ();
|
||||
if (n == 0)
|
||||
{
|
||||
/*
|
||||
int opt = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEFN |
|
||||
ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
ASE_AWK_SHIFT |
|
||||
ASE_AWK_EXTIO |
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_STRBASEONE |
|
||||
ASE_AWK_STRIPSPACES |
|
||||
ASE_AWK_NEXTOFILE /*|
|
||||
ASE_AWK_ARGSTOMAIN*/;
|
||||
ase_awk_setoption (awk, opt);
|
||||
|
||||
addFunction (ASE_T("sin"), 1, 1, (FunctionHandler)&StdAwk::sin);
|
||||
addFunction (ASE_T("cos"), 1, 1, (FunctionHandler)&StdAwk::cos);
|
||||
addFunction (ASE_T("tan"), 1, 1, (FunctionHandler)&StdAwk::tan);
|
||||
*/
|
||||
}
|
||||
|
||||
return n;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.4 2007/05/05 16:32:46 bacon Exp $
|
||||
* $Id: awk.c,v 1.5 2007/05/06 10:38:22 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -40,12 +40,9 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
|
||||
prmfns->misc.sprintf != ASE_NULL &&
|
||||
prmfns->misc.dprintf != ASE_NULL);
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
awk = (ase_awk_t*) malloc (ASE_SIZEOF(ase_awk_t));
|
||||
#else
|
||||
awk = (ase_awk_t*) prmfns->mmgr.malloc (
|
||||
prmfns->mmgr.custom_data, ASE_SIZEOF(ase_awk_t));
|
||||
#endif
|
||||
/* use ASE_MALLOC instead of ASE_AWK_MALLOC because
|
||||
* the awk object has not been initialized yet */
|
||||
awk = ASE_MALLOC (&prmfns->mmgr, ASE_SIZEOF(ase_awk_t));
|
||||
if (awk == ASE_NULL) return ASE_NULL;
|
||||
|
||||
/* it uses the built-in ase_awk_memset because awk is not
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_i.h,v 1.4 2007/05/05 16:32:46 bacon Exp $
|
||||
* $Id: awk_i.h,v 1.5 2007/05/06 10:08:54 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -34,18 +34,9 @@ typedef struct ase_awk_tree_t ase_awk_tree_t;
|
||||
#define ASE_AWK_MAX_LOCALS 9999
|
||||
#define ASE_AWK_MAX_PARAMS 9999
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
|
||||
#define ASE_AWK_MALLOC(awk,size) malloc (size)
|
||||
#define ASE_AWK_REALLOC(awk,ptr,size) realloc (ptr, size)
|
||||
#define ASE_AWK_FREE(awk,ptr) free (ptr)
|
||||
#else
|
||||
#define ASE_AWK_MALLOC(awk,size) ASE_MALLOC(&(awk)->prmfns.mmgr,size)
|
||||
#define ASE_AWK_REALLOC(awk,ptr,size) ASE_REALLOC(&(awk)->prmfns.mmgr,ptr,size)
|
||||
#define ASE_AWK_FREE(awk,ptr) ASE_FREE(&(awk)->prmfns.mmgr,ptr)
|
||||
#endif
|
||||
#define ASE_AWK_MALLOC(awk,size) ASE_MALLOC(&(awk)->prmfns.mmgr,size)
|
||||
#define ASE_AWK_REALLOC(awk,ptr,size) ASE_REALLOC(&(awk)->prmfns.mmgr,ptr,size)
|
||||
#define ASE_AWK_FREE(awk,ptr) ASE_FREE(&(awk)->prmfns.mmgr,ptr)
|
||||
|
||||
#define ASE_AWK_ISUPPER(awk,c) ASE_ISUPPER(&(awk)->prmfns.ccls,c)
|
||||
#define ASE_AWK_ISLOWER(awk,c) ASE_ISLOWER(&(awk)->prmfns.ccls,c)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.c,v 1.5 2007/05/06 06:55:05 bacon Exp $
|
||||
* $Id: map.c,v 1.6 2007/05/06 08:52:18 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -36,7 +36,7 @@ ase_awk_map_t* ase_awk_map_open (
|
||||
ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_pair_t*) * capa);
|
||||
if (map->buck == ASE_NULL)
|
||||
{
|
||||
if (map->__dynamic) ASE_AWK_FREE (awk, map);
|
||||
ASE_AWK_FREE (awk, map);
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.h,v 1.5 2007/05/06 06:55:05 bacon Exp $
|
||||
* $Id: map.h,v 1.6 2007/05/06 08:52:18 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -34,7 +34,6 @@ struct ase_awk_map_t
|
||||
ase_awk_pair_t** buck;
|
||||
void (*freeval) (void*,void*);
|
||||
ase_awk_t* awk;
|
||||
ase_bool_t __dynamic;
|
||||
};
|
||||
|
||||
#define ASE_AWK_PAIR_KEYPTR(p) ((p)->key.ptr)
|
||||
|
Reference in New Issue
Block a user