*** empty log message ***
This commit is contained in:
parent
38d2b2348a
commit
51c8b72b8e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.100 2006-12-16 14:43:49 bacon Exp $
|
||||
* $Id: awk.c,v 1.101 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
@ -157,6 +157,17 @@ ase_awk_t* ase_awk_open (const ase_awk_sysfns_t* sysfns, int* errnum)
|
||||
return awk;
|
||||
}
|
||||
|
||||
static void __free_afn (void* owner, void* afn)
|
||||
{
|
||||
ase_awk_afn_t* f = (ase_awk_afn_t*)afn;
|
||||
|
||||
/* f->name doesn't have to be freed */
|
||||
/*ASE_AWK_FREE ((ase_awk_t*)owner, f->name);*/
|
||||
|
||||
ase_awk_clrpt ((ase_awk_t*)owner, f->body);
|
||||
ASE_AWK_FREE ((ase_awk_t*)owner, f);
|
||||
}
|
||||
|
||||
int ase_awk_close (ase_awk_t* awk)
|
||||
{
|
||||
if (ase_awk_clear (awk) == -1) return -1;
|
||||
@ -179,7 +190,6 @@ int ase_awk_close (ase_awk_t* awk)
|
||||
int ase_awk_clear (ase_awk_t* awk)
|
||||
{
|
||||
/* you should stop all running instances beforehand */
|
||||
/* TODO: can i stop all instances??? */
|
||||
if (awk->run.ptr != ASE_NULL)
|
||||
{
|
||||
awk->errnum = ASE_AWK_ERUNNING;
|
||||
@ -250,17 +260,6 @@ void ase_awk_setopt (ase_awk_t* awk, int opt)
|
||||
awk->option = opt;
|
||||
}
|
||||
|
||||
static void __free_afn (void* owner, void* afn)
|
||||
{
|
||||
ase_awk_afn_t* f = (ase_awk_afn_t*)afn;
|
||||
|
||||
/* f->name doesn't have to be freed */
|
||||
/*ASE_AWK_FREE ((ase_awk_t*)owner, f->name);*/
|
||||
|
||||
ase_awk_clrpt ((ase_awk_t*)owner, f->body);
|
||||
ASE_AWK_FREE ((ase_awk_t*)owner, f);
|
||||
}
|
||||
|
||||
ase_size_t ase_awk_getsrcline (ase_awk_t* awk)
|
||||
{
|
||||
return awk->token.line;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.167 2006-12-16 14:43:50 bacon Exp $
|
||||
* $Id: awk.h,v 1.168 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
@ -33,8 +33,8 @@ typedef int (*ase_awk_sprintf_t) (
|
||||
ase_char_t* buf, ase_size_t size, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_aprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_dprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_abort_t) (void);
|
||||
typedef void (*ase_awk_lock_t) (ase_awk_t* awk, void* custom_data);
|
||||
typedef void (*ase_awk_abort_t) (void* custom_data);
|
||||
typedef void (*ase_awk_lock_t) (void* custom_data);
|
||||
|
||||
typedef ase_ssize_t (*ase_awk_io_t) (
|
||||
int cmd, void* arg, ase_char_t* data, ase_size_t count);
|
||||
@ -208,21 +208,30 @@ enum
|
||||
ASE_AWK_STRIPSPACES = (1 << 12),
|
||||
|
||||
/* enable the nextoutfile keyword */
|
||||
ASE_AWK_NEXTOFILE = (1 << 13),
|
||||
|
||||
/* a newline terminates a statement */
|
||||
ASE_AWK_NEWLINE = (1 << 14)
|
||||
ASE_AWK_NEXTOFILE = (1 << 13)
|
||||
};
|
||||
|
||||
/* error code */
|
||||
enum
|
||||
{
|
||||
ASE_AWK_ENOERR, /* no error */
|
||||
ASE_AWK_ENOMEM, /* out of memory */
|
||||
|
||||
ASE_AWK_EINVAL, /* invalid parameter */
|
||||
ASE_AWK_EEXIST, /* existing data found */
|
||||
ASE_AWK_ENOENT, /* no such data entry found */
|
||||
ASE_AWK_EACCES, /* access denied */
|
||||
ASE_AWK_ENOMEM, /* out of memory */
|
||||
ASE_AWK_ENOSUP, /* not supported */
|
||||
ASE_AWK_ENOPER, /* operation not allowed */
|
||||
ASE_AWK_ENODEV, /* no such device */
|
||||
ASE_AWK_ENOSPC, /* no space left on device */
|
||||
ASE_AWK_ENOENT, /* no such file, directory, or data */
|
||||
ASE_AWK_EMFILE, /* too many open files */
|
||||
ASE_AWK_EMLINK, /* too many links */
|
||||
ASE_AWK_EAGAIN, /* resource temporarily unavailable */
|
||||
ASE_AWK_EEXIST, /* file or data exists */
|
||||
ASE_AWK_EFTBIG, /* file or data too big */
|
||||
ASE_AWK_EINTER, /* operation interrupted */
|
||||
ASE_AWK_ETBUSY, /* system too busy */
|
||||
ASE_AWK_EISDIR, /* is a directory */
|
||||
ASE_AWK_EIOERR, /* i/o error */
|
||||
|
||||
ASE_AWK_ERUNTIME, /* run-time error */
|
||||
ASE_AWK_ERUNNING, /* there are running instances */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_i.h,v 1.91 2006-12-16 14:43:50 bacon Exp $
|
||||
* $Id: awk_i.h,v 1.92 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWKI_H_
|
||||
@ -55,13 +55,13 @@ typedef struct ase_awk_tree_t ase_awk_tree_t;
|
||||
#define ASE_AWK_LOCK(awk) \
|
||||
do { \
|
||||
if ((awk)->sysfns.lock != ASE_NULL) \
|
||||
(awk)->sysfns.lock (awk, (awk)->sysfns.custom_data); \
|
||||
(awk)->sysfns.lock ((awk)->sysfns.custom_data); \
|
||||
} while (0)
|
||||
|
||||
#define ASE_AWK_UNLOCK(awk) \
|
||||
do { \
|
||||
if ((awk)->sysfns.unlock != ASE_NULL) \
|
||||
(awk)->sysfns.unlock (awk, (awk)->sysfns.custom_data); \
|
||||
(awk)->sysfns.unlock ((awk)->sysfns.custom_data); \
|
||||
} while (0)
|
||||
|
||||
#define ASE_AWK_ISUPPER(awk,c) (awk)->sysfns.is_upper(c)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: err.c,v 1.59 2006-12-15 14:58:14 bacon Exp $
|
||||
* $Id: err.c,v 1.60 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -14,11 +14,24 @@ const ase_char_t* ase_awk_geterrstr (int errnum)
|
||||
static const ase_char_t* __errstr[] =
|
||||
{
|
||||
ASE_T("no error"),
|
||||
ASE_T("out of memory"),
|
||||
|
||||
ASE_T("invalid parameter"),
|
||||
ASE_T("existing data found"),
|
||||
ASE_T("no such data entry found"),
|
||||
ASE_T("permission denied"),
|
||||
ASE_T("out of memory"),
|
||||
ASE_T("not supported"),
|
||||
ASE_T("operation not allowed"),
|
||||
ASE_T("no such device"),
|
||||
ASE_T("no space left on device"),
|
||||
ASE_T("no such file, directory, or data"),
|
||||
ASE_T("too many open files"),
|
||||
ASE_T("too many links"),
|
||||
ASE_T("resource temporarily unavailable"),
|
||||
ASE_T("file or data exists"),
|
||||
ASE_T("file or data too big"),
|
||||
ASE_T("operation interrupted"),
|
||||
ASE_T("system too busy"),
|
||||
ASE_T("is a directory"),
|
||||
ASE_T("i/o error"),
|
||||
|
||||
ASE_T("general run-time error"),
|
||||
ASE_T("one or more running instances"),
|
||||
ASE_T("too many running instances"),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.47 2006-12-16 14:43:50 bacon Exp $
|
||||
* $Id: misc.c,v 1.48 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -1116,7 +1116,7 @@ int ase_awk_assertfail (ase_awk_t* awk,
|
||||
file, line, expr, desc);
|
||||
|
||||
}
|
||||
awk->sysfns.abort ();
|
||||
awk->sysfns.abort (awk->sysfns.custom_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.301 2006-12-16 14:43:51 bacon Exp $
|
||||
* $Id: run.c,v 1.302 2006-12-16 16:14:40 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -587,7 +587,7 @@ int ase_awk_run (ase_awk_t* awk,
|
||||
ase_awk_map_getsize(&awk->tree.afns) == 0)
|
||||
{
|
||||
/* if not, deny the run */
|
||||
awk->errnum = ASE_AWK_EACCES;
|
||||
awk->errnum = ASE_AWK_ENOPER;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.99 2006-12-16 14:43:51 bacon Exp $
|
||||
* $Id: val.c,v 1.100 2006-12-16 16:14:40 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -35,7 +35,18 @@ static ase_awk_val_int_t __awk_int[] =
|
||||
{ ASE_AWK_VAL_INT, 0, 6, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 7, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 8, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 9, ASE_NULL }
|
||||
{ ASE_AWK_VAL_INT, 0, 9, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 10, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 11, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 12, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 13, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 14, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 15, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 16, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 17, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 18, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 19, ASE_NULL },
|
||||
{ ASE_AWK_VAL_INT, 0, 20, ASE_NULL }
|
||||
};
|
||||
|
||||
ase_awk_val_t* ase_awk_val_negone = (ase_awk_val_t*)&__awk_int[0];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.138 2006-12-16 14:45:02 bacon Exp $
|
||||
* $Id: awk.c,v 1.139 2006-12-16 16:12:07 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -151,6 +151,11 @@ static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static void awk_abort (void* custom_data)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
static FILE* popen_t (const ase_char_t* cmd, const ase_char_t* mode)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@ -796,12 +801,12 @@ static int __main (int argc, ase_char_t* argv[])
|
||||
}
|
||||
|
||||
memset (&sysfns, 0, ASE_SIZEOF(sysfns));
|
||||
|
||||
sysfns.malloc = awk_malloc;
|
||||
sysfns.realloc = awk_realloc;
|
||||
sysfns.free = awk_free;
|
||||
|
||||
sysfns.lock = NULL;
|
||||
sysfns.unlock = NULL;
|
||||
sysfns.memcpy = memcpy;
|
||||
sysfns.memset = memset;
|
||||
|
||||
sysfns.is_upper = awk_isupper;
|
||||
sysfns.is_lower = awk_islower;
|
||||
@ -817,13 +822,13 @@ static int __main (int argc, ase_char_t* argv[])
|
||||
sysfns.to_upper = awk_toupper;
|
||||
sysfns.to_lower = awk_tolower;
|
||||
|
||||
sysfns.memcpy = memcpy;
|
||||
sysfns.memset = memset;
|
||||
sysfns.pow = awk_pow;
|
||||
sysfns.sprintf = awk_sprintf;
|
||||
sysfns.aprintf = awk_aprintf;
|
||||
sysfns.dprintf = awk_dprintf;
|
||||
sysfns.abort = abort;
|
||||
sysfns.abort = awk_abort;
|
||||
sysfns.lock = NULL;
|
||||
sysfns.unlock = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
sysfns_data.heap = HeapCreate (0, 1000000, 1000000);
|
||||
|
Loading…
Reference in New Issue
Block a user