*** empty log message ***
This commit is contained in:
parent
5d72a392fb
commit
d82757c8bd
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.70 2006-08-13 16:04:32 bacon Exp $
|
* $Id: awk.c,v 1.71 2006-08-31 04:21:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -11,16 +11,21 @@
|
|||||||
|
|
||||||
static void __free_afn (void* awk, void* afn);
|
static void __free_afn (void* awk, void* afn);
|
||||||
|
|
||||||
xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
xp_awk_t* xp_awk_open (xp_awk_syscas_t* syscas)
|
||||||
{
|
{
|
||||||
xp_awk_t* awk;
|
xp_awk_t* awk;
|
||||||
|
|
||||||
awk = (xp_awk_t*) xp_malloc (xp_sizeof(xp_awk_t));
|
if (syscas == XP_NULL ||
|
||||||
|
syscas->malloc == XP_NULL ||
|
||||||
|
syscas->free == XP_NULL) return XP_NULL;
|
||||||
|
|
||||||
|
awk = (xp_awk_t*) syscas->malloc (
|
||||||
|
xp_sizeof(xp_awk_t), syscas->custom_data);
|
||||||
if (awk == XP_NULL) return XP_NULL;
|
if (awk == XP_NULL) return XP_NULL;
|
||||||
|
|
||||||
if (xp_str_open (&awk->token.name, 128) == XP_NULL)
|
if (xp_str_open (&awk->token.name, 128) == XP_NULL)
|
||||||
{
|
{
|
||||||
xp_free (awk);
|
syscas->free (awk, syscas->custom_data);
|
||||||
return XP_NULL;
|
return XP_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +34,7 @@ xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
|||||||
&awk->tree.afns, awk, 256, __free_afn) == XP_NULL)
|
&awk->tree.afns, awk, 256, __free_afn) == XP_NULL)
|
||||||
{
|
{
|
||||||
xp_str_close (&awk->token.name);
|
xp_str_close (&awk->token.name);
|
||||||
xp_free (awk);
|
syscas->free (awk, syscas->custom_data);
|
||||||
return XP_NULL;
|
return XP_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +42,7 @@ xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
|||||||
{
|
{
|
||||||
xp_str_close (&awk->token.name);
|
xp_str_close (&awk->token.name);
|
||||||
xp_awk_map_close (&awk->tree.afns);
|
xp_awk_map_close (&awk->tree.afns);
|
||||||
xp_free (awk);
|
syscas->free (awk, syscas->custom_data);
|
||||||
return XP_NULL;
|
return XP_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +51,7 @@ xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
|||||||
xp_str_close (&awk->token.name);
|
xp_str_close (&awk->token.name);
|
||||||
xp_awk_map_close (&awk->tree.afns);
|
xp_awk_map_close (&awk->tree.afns);
|
||||||
xp_awk_tab_close (&awk->parse.globals);
|
xp_awk_tab_close (&awk->parse.globals);
|
||||||
xp_free (awk);
|
syscas->free (awk, syscas->custom_data);
|
||||||
return XP_NULL;
|
return XP_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +61,7 @@ xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
|||||||
xp_awk_map_close (&awk->tree.afns);
|
xp_awk_map_close (&awk->tree.afns);
|
||||||
xp_awk_tab_close (&awk->parse.globals);
|
xp_awk_tab_close (&awk->parse.globals);
|
||||||
xp_awk_tab_close (&awk->parse.locals);
|
xp_awk_tab_close (&awk->parse.locals);
|
||||||
xp_free (awk);
|
syscas->free (awk, syscas->custom_data);
|
||||||
return XP_NULL;
|
return XP_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +97,7 @@ xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks)
|
|||||||
awk->run.count = 0;
|
awk->run.count = 0;
|
||||||
awk->run.ptr = XP_NULL;
|
awk->run.ptr = XP_NULL;
|
||||||
|
|
||||||
awk->thr.lks = thrlks;
|
awk->syscas = syscas;
|
||||||
return awk;
|
return awk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +113,7 @@ int xp_awk_close (xp_awk_t* awk)
|
|||||||
xp_awk_tab_close (&awk->parse.params);
|
xp_awk_tab_close (&awk->parse.params);
|
||||||
xp_str_close (&awk->token.name);
|
xp_str_close (&awk->token.name);
|
||||||
|
|
||||||
xp_free (awk);
|
awk->syscas->free (awk, awk->syscas->custom_data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h,v 1.103 2006-08-29 15:01:44 bacon Exp $
|
* $Id: awk.h,v 1.104 2006-08-31 04:21:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_AWK_H_
|
#ifndef _XP_AWK_AWK_H_
|
||||||
@ -12,7 +12,7 @@ typedef struct xp_awk_t xp_awk_t;
|
|||||||
typedef struct xp_awk_val_t xp_awk_val_t;
|
typedef struct xp_awk_val_t xp_awk_val_t;
|
||||||
typedef struct xp_awk_extio_t xp_awk_extio_t;
|
typedef struct xp_awk_extio_t xp_awk_extio_t;
|
||||||
|
|
||||||
typedef struct xp_awk_thrlks_t xp_awk_thrlks_t;
|
typedef struct xp_awk_syscas_t xp_awk_syscas_t;
|
||||||
typedef struct xp_awk_srcios_t xp_awk_srcios_t;
|
typedef struct xp_awk_srcios_t xp_awk_srcios_t;
|
||||||
typedef struct xp_awk_runios_t xp_awk_runios_t;
|
typedef struct xp_awk_runios_t xp_awk_runios_t;
|
||||||
typedef struct xp_awk_runcbs_t xp_awk_runcbs_t;
|
typedef struct xp_awk_runcbs_t xp_awk_runcbs_t;
|
||||||
@ -40,12 +40,27 @@ struct xp_awk_extio_t
|
|||||||
xp_awk_extio_t* next;
|
xp_awk_extio_t* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
struct xp_awk_thrlks_t
|
struct xp_awk_thrlks_t
|
||||||
{
|
{
|
||||||
xp_awk_lk_t lock;
|
xp_awk_lk_t lock;
|
||||||
xp_awk_lk_t unlock;
|
xp_awk_lk_t unlock;
|
||||||
void* custom_data;
|
void* custom_data;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
struct xp_awk_syscas_t
|
||||||
|
{
|
||||||
|
/* memory */
|
||||||
|
void* (*malloc) (xp_size_t n, void* custom_data);
|
||||||
|
void* (*realloc) (void* ptr, xp_size_t n, void* custom_data);
|
||||||
|
void (*free) (void* ptr, void* custom_data);
|
||||||
|
|
||||||
|
/* thread lock */
|
||||||
|
xp_awk_lk_t lock;
|
||||||
|
xp_awk_lk_t unlock;
|
||||||
|
|
||||||
|
void* custom_data;
|
||||||
|
};
|
||||||
|
|
||||||
struct xp_awk_srcios_t
|
struct xp_awk_srcios_t
|
||||||
{
|
{
|
||||||
@ -69,6 +84,7 @@ struct xp_awk_runcbs_t
|
|||||||
void* custom_data;
|
void* custom_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* io function commands */
|
/* io function commands */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -258,7 +274,7 @@ enum
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xp_awk_t* xp_awk_open (xp_awk_thrlks_t* thrlks);
|
xp_awk_t* xp_awk_open (xp_awk_syscas_t* syscas);
|
||||||
int xp_awk_close (xp_awk_t* awk);
|
int xp_awk_close (xp_awk_t* awk);
|
||||||
int xp_awk_clear (xp_awk_t* awk);
|
int xp_awk_clear (xp_awk_t* awk);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk_i.h,v 1.47 2006-08-29 15:01:44 bacon Exp $
|
* $Id: awk_i.h,v 1.48 2006-08-31 04:21:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_AWKI_H_
|
#ifndef _XP_AWK_AWKI_H_
|
||||||
@ -127,10 +127,7 @@ struct xp_awk_t
|
|||||||
xp_awk_run_t* ptr;
|
xp_awk_run_t* ptr;
|
||||||
} run;
|
} run;
|
||||||
|
|
||||||
struct
|
xp_awk_syscas_t* syscas;
|
||||||
{
|
|
||||||
xp_awk_thrlks_t* lks;
|
|
||||||
} thr;
|
|
||||||
|
|
||||||
/* housekeeping */
|
/* housekeeping */
|
||||||
int errnum;
|
int errnum;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.185 2006-08-30 14:25:33 bacon Exp $
|
* $Id: run.c,v 1.186 2006-08-31 04:21:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -363,8 +363,8 @@ int xp_awk_stop (xp_awk_t* awk, void* run)
|
|||||||
xp_awk_run_t* r;
|
xp_awk_run_t* r;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||||
awk->thr.lks->lock (awk, awk->thr.lks->custom_data);
|
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
/* check if the run handle given is valid */
|
/* check if the run handle given is valid */
|
||||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||||
@ -385,8 +385,8 @@ int xp_awk_stop (xp_awk_t* awk, void* run)
|
|||||||
n = -1;
|
n = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||||
awk->thr.lks->unlock (awk, awk->thr.lks->custom_data);
|
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -395,16 +395,16 @@ void xp_awk_stopall (xp_awk_t* awk)
|
|||||||
{
|
{
|
||||||
xp_awk_run_t* r;
|
xp_awk_run_t* r;
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||||
awk->thr.lks->lock (awk, awk->thr.lks->custom_data);
|
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||||
{
|
{
|
||||||
r->exit_level = EXIT_ABORT;
|
r->exit_level = EXIT_ABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||||
awk->thr.lks->unlock (awk, awk->thr.lks->custom_data);
|
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
||||||
@ -412,8 +412,8 @@ int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
|||||||
xp_awk_run_t* r;
|
xp_awk_run_t* r;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||||
awk->thr.lks->lock (awk, awk->thr.lks->custom_data);
|
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||||
{
|
{
|
||||||
@ -431,8 +431,8 @@ int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
|||||||
n = -1;
|
n = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||||
awk->thr.lks->unlock (awk, awk->thr.lks->custom_data);
|
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -444,8 +444,8 @@ static void __free_namedval (void* run, void* val)
|
|||||||
|
|
||||||
static void __add_run (xp_awk_t* awk, xp_awk_run_t* run)
|
static void __add_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||||
{
|
{
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||||
awk->thr.lks->lock (awk, awk->thr.lks->custom_data);
|
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
run->awk = awk;
|
run->awk = awk;
|
||||||
run->prev = XP_NULL;
|
run->prev = XP_NULL;
|
||||||
@ -454,14 +454,14 @@ static void __add_run (xp_awk_t* awk, xp_awk_run_t* run)
|
|||||||
awk->run.ptr = run;
|
awk->run.ptr = run;
|
||||||
awk->run.count++;
|
awk->run.count++;
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||||
awk->thr.lks->unlock (awk, awk->thr.lks->custom_data);
|
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __del_run (xp_awk_t* awk, xp_awk_run_t* run)
|
static void __del_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||||
{
|
{
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||||
awk->thr.lks->lock (awk, awk->thr.lks->custom_data);
|
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||||
|
|
||||||
xp_assert (awk->run.ptr != XP_NULL);
|
xp_assert (awk->run.ptr != XP_NULL);
|
||||||
|
|
||||||
@ -479,8 +479,8 @@ static void __del_run (xp_awk_t* awk, xp_awk_run_t* run)
|
|||||||
run->awk = XP_NULL;
|
run->awk = XP_NULL;
|
||||||
awk->run.count--;
|
awk->run.count--;
|
||||||
|
|
||||||
if (awk->thr.lks != XP_NULL)
|
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||||
awk->thr.lks->unlock (awk, awk->thr.lks->custom_data);
|
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init_run (
|
static int __init_run (
|
||||||
|
10
ase/awk/sa.h
10
ase/awk/sa.h
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sa.h,v 1.33 2006-08-30 14:23:19 bacon Exp $
|
* $Id: sa.h,v 1.34 2006-08-31 04:21:04 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_SA_H_
|
#ifndef _XP_AWK_SA_H_
|
||||||
@ -26,7 +26,9 @@
|
|||||||
|
|
||||||
#define xp_memset(dst,fill,len) RtlFillMemory(dst,len,fill)
|
#define xp_memset(dst,fill,len) RtlFillMemory(dst,len,fill)
|
||||||
#define xp_memcpy(dst,src,len) RtlCopyMemory(dst,src,len)
|
#define xp_memcpy(dst,src,len) RtlCopyMemory(dst,src,len)
|
||||||
#define xp_memcmp(src1,src2,len) RtlCompareMemory(src1,src2,len);
|
#define xp_memmove(dst,src,len) RtlMoveMemory(dst,src,len)
|
||||||
|
#define xp_memcmp(src1,src2,len) RtlCompareMemory(src1,src2,len)
|
||||||
|
#define xp_memzero(dst,len) RtlZeroMemory(dst,len)
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -53,7 +55,9 @@
|
|||||||
|
|
||||||
#define xp_memset(dst,fill,len) memset(dst,fill,len)
|
#define xp_memset(dst,fill,len) memset(dst,fill,len)
|
||||||
#define xp_memcpy(dst,src,len) memcpy(dst,src,len)
|
#define xp_memcpy(dst,src,len) memcpy(dst,src,len)
|
||||||
#define xp_memcmp(src1,src2,len) memcmp(src1,src2,len);
|
#define xp_memmove(dst,src,len) memmove(dst,src,len)
|
||||||
|
#define xp_memcmp(src1,src2,len) memcmp(src1,src2,len)
|
||||||
|
#define xp_memzero(dst,len) memset(dst,0,len)
|
||||||
|
|
||||||
#ifdef XP_CHAR_IS_MCHAR
|
#ifdef XP_CHAR_IS_MCHAR
|
||||||
#define xp_isdigit isdigit
|
#define xp_isdigit isdigit
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.79 2006-08-30 07:15:14 bacon Exp $
|
* $Id: awk.c,v 1.80 2006-08-31 04:21:04 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk.h>
|
#include <xp/awk/awk.h>
|
||||||
@ -548,6 +548,39 @@ static void __on_run_end (xp_awk_t* awk, void* handle, int errnum, void* arg)
|
|||||||
app_run = NULL;
|
app_run = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct syscas_data_t syscas_data_t;
|
||||||
|
struct syscas_data_t
|
||||||
|
{
|
||||||
|
HANDLE heap;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void* __awk_malloc (xp_size_t n, void* custom_data)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
return HeapAlloc (((syscas_data_t*)custom_data)->heap, 0, n);
|
||||||
|
#else
|
||||||
|
return malloc (n);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* __awk_realloc (void* ptr, xp_size_t n, void* custom_data)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
return HeapReAlloc (((syscas_data_t*)custom_data)->heap, 0, ptr, n);
|
||||||
|
#else
|
||||||
|
return realloc (ptr, n);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __awk_free (void* ptr, void* custom_data)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
HeapFree (((syscas_data_t*)custom_data)->heap, 0, ptr);
|
||||||
|
#else
|
||||||
|
free (ptr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__STAND_ALONE) && !defined(_WIN32)
|
#if defined(__STAND_ALONE) && !defined(_WIN32)
|
||||||
static int __main (int argc, char* argv[])
|
static int __main (int argc, char* argv[])
|
||||||
#else
|
#else
|
||||||
@ -558,14 +591,12 @@ static int __main (int argc, xp_char_t* argv[])
|
|||||||
xp_awk_srcios_t srcios;
|
xp_awk_srcios_t srcios;
|
||||||
xp_awk_runcbs_t runcbs;
|
xp_awk_runcbs_t runcbs;
|
||||||
xp_awk_runios_t runios;
|
xp_awk_runios_t runios;
|
||||||
|
xp_awk_syscas_t syscas;
|
||||||
struct src_io src_io = { NULL, NULL };
|
struct src_io src_io = { NULL, NULL };
|
||||||
int opt, i, file_count = 0;
|
int opt, i, file_count = 0;
|
||||||
|
#ifdef _WIN32
|
||||||
if ((awk = xp_awk_open(XP_NULL)) == XP_NULL)
|
syscas_data_t syscas_data;
|
||||||
{
|
#endif
|
||||||
xp_printf (XP_T("Error: cannot open awk\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
opt = XP_AWK_EXPLICIT | XP_AWK_UNIQUE | XP_AWK_HASHSIGN |
|
opt = XP_AWK_EXPLICIT | XP_AWK_UNIQUE | XP_AWK_HASHSIGN |
|
||||||
/*XP_AWK_DBLSLASHES |*/
|
/*XP_AWK_DBLSLASHES |*/
|
||||||
@ -607,6 +638,33 @@ static int __main (int argc, xp_char_t* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset (&syscas, 0, sizeof(syscas));
|
||||||
|
syscas.malloc = __awk_malloc;
|
||||||
|
syscas.realloc = NULL;
|
||||||
|
syscas.free = __awk_free;
|
||||||
|
syscas.lock = NULL;
|
||||||
|
syscas.unlock = NULL;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
syscas_data.heap = HeapCreate (0, 640 * 1024, 640 * 1024);
|
||||||
|
if (syscas_data.heap == NULL)
|
||||||
|
{
|
||||||
|
xp_printf (XP_T("Error: cannot create an awk heap\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
syscas.custom_data = &syscas_data;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((awk = xp_awk_open(&syscas)) == XP_NULL)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
HeapDestroy (syscas_data.heap);
|
||||||
|
#endif
|
||||||
|
xp_printf (XP_T("Error: cannot open awk\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
xp_awk_setopt (awk, opt);
|
xp_awk_setopt (awk, opt);
|
||||||
|
|
||||||
srcios.in = process_source;
|
srcios.in = process_source;
|
||||||
@ -664,6 +722,9 @@ static int __main (int argc, xp_char_t* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
xp_awk_close (awk);
|
xp_awk_close (awk);
|
||||||
|
#ifdef _WIN32
|
||||||
|
HeapDestroy (syscas_data.heap);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user