*** empty log message ***
This commit is contained in:
parent
758bebd0d3
commit
a4833392b7
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.75 2006-09-01 03:44:15 bacon Exp $
|
||||
* $Id: awk.c,v 1.76 2006-09-01 04:03:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/awk/awk_i.h>
|
||||
@ -19,8 +19,12 @@ xp_awk_t* xp_awk_open (xp_awk_syscas_t* syscas)
|
||||
syscas->malloc == XP_NULL ||
|
||||
syscas->free == XP_NULL) return XP_NULL;
|
||||
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
awk = (xp_awk_t*) malloc (xp_sizeof(xp_awk_t));
|
||||
#else
|
||||
awk = (xp_awk_t*) syscas->malloc (
|
||||
xp_sizeof(xp_awk_t), syscas->custom_data);
|
||||
#endif
|
||||
if (awk == XP_NULL) return XP_NULL;
|
||||
|
||||
awk->syscas = syscas;
|
||||
@ -114,7 +118,7 @@ int xp_awk_close (xp_awk_t* awk)
|
||||
xp_awk_tab_close (&awk->parse.params);
|
||||
xp_awk_str_close (&awk->token.name);
|
||||
|
||||
/* XP_AWK_MALLOC, XP_AWK_FREE, etc can not be used
|
||||
/* XP_AWK_ALLOC, XP_AWK_FREE, etc can not be used
|
||||
* from the next line onwards */
|
||||
XP_AWK_FREE (awk, awk);
|
||||
return 0;
|
||||
|
@ -235,6 +235,10 @@ SOURCE=.\sa.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tab.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -283,6 +287,10 @@ SOURCE=.\sa.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_i.h,v 1.51 2006-08-31 16:00:18 bacon Exp $
|
||||
* $Id: awk_i.h,v 1.52 2006-09-01 04:03:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_AWK_AWKI_H_
|
||||
@ -39,12 +39,30 @@ typedef struct xp_awk_tree_t xp_awk_tree_t;
|
||||
#define XP_AWK_MAX_LOCALS 9999
|
||||
#define XP_AWK_MAX_PARAMS 9999
|
||||
|
||||
#define XP_AWK_MALLOC(awk,size) \
|
||||
(awk)->syscas->malloc (size, (awk)->syscas->custom_data)
|
||||
#define XP_AWK_REALLOC(awk,ptr,size) \
|
||||
(awk)->syscas->realloc (ptr, size, (awk)->syscas->custom_data)
|
||||
#define XP_AWK_FREE(awk,ptr) \
|
||||
(awk)->syscas->free (ptr, (awk)->syscas->custom_data)
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
#define XP_AWK_MALLOC(awk,size) malloc (size)
|
||||
#define XP_AWK_REALLOC(awk,ptr,size) realloc (ptr, size)
|
||||
#define XP_AWK_FREE(awk,ptr) free (ptr)
|
||||
#else
|
||||
#define XP_AWK_MALLOC(awk,size) \
|
||||
(awk)->syscas->malloc (size, (awk)->syscas->custom_data)
|
||||
#define XP_AWK_REALLOC(awk,ptr,size) \
|
||||
(awk)->syscas->realloc (ptr, size, (awk)->syscas->custom_data)
|
||||
#define XP_AWK_FREE(awk,ptr) \
|
||||
(awk)->syscas->free (ptr, (awk)->syscas->custom_data)
|
||||
#endif
|
||||
|
||||
#define XP_AWK_LOCK(awk) \
|
||||
do { \
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL) \
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data); \
|
||||
} while (0)
|
||||
|
||||
#define XP_AWK_UNLOCK(awk) \
|
||||
do { \
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL) \
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data); \
|
||||
} while (0)
|
||||
|
||||
struct xp_awk_tree_t
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.191 2006-09-01 03:44:16 bacon Exp $
|
||||
* $Id: run.c,v 1.192 2006-09-01 04:03:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/awk/awk_i.h>
|
||||
@ -329,7 +329,7 @@ int xp_awk_run (xp_awk_t* awk, xp_awk_runios_t* runios, xp_awk_runcbs_t* runcbs)
|
||||
{
|
||||
awk->errnum = errnum;
|
||||
__del_run (awk, run);
|
||||
awk->syscas->free (run, awk->syscas->custom_data);
|
||||
XP_AWK_FREE (awk, run);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ int xp_awk_run (xp_awk_t* awk, xp_awk_runios_t* runios, xp_awk_runcbs_t* runcbs)
|
||||
__deinit_run (run);
|
||||
|
||||
__del_run (awk, run);
|
||||
awk->syscas->free (run, awk->syscas->custom_data);
|
||||
XP_AWK_FREE (awk, run);
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -370,8 +370,7 @@ int xp_awk_stop (xp_awk_t* awk, void* run)
|
||||
xp_awk_run_t* r;
|
||||
int n = 0;
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_LOCK (awk);
|
||||
|
||||
/* check if the run handle given is valid */
|
||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||
@ -392,8 +391,7 @@ int xp_awk_stop (xp_awk_t* awk, void* run)
|
||||
n = -1;
|
||||
}
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_UNLOCK (awk);
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -402,16 +400,14 @@ void xp_awk_stopall (xp_awk_t* awk)
|
||||
{
|
||||
xp_awk_run_t* r;
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_LOCK (awk);
|
||||
|
||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||
{
|
||||
r->exit_level = EXIT_ABORT;
|
||||
}
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_UNLOCK (awk);
|
||||
}
|
||||
|
||||
int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
||||
@ -419,8 +415,7 @@ int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
||||
xp_awk_run_t* r;
|
||||
int n = 0;
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_LOCK (awk);
|
||||
|
||||
for (r = awk->run.ptr; r != XP_NULL; r = r->next)
|
||||
{
|
||||
@ -438,8 +433,7 @@ int xp_awk_getrunerrnum (xp_awk_t* awk, void* run, int* errnum)
|
||||
n = -1;
|
||||
}
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_UNLOCK (awk);
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -451,8 +445,7 @@ static void __free_namedval (void* run, void* val)
|
||||
|
||||
static void __add_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||
{
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_LOCK (awk);
|
||||
|
||||
run->awk = awk;
|
||||
run->prev = XP_NULL;
|
||||
@ -461,14 +454,12 @@ static void __add_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||
awk->run.ptr = run;
|
||||
awk->run.count++;
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_UNLOCK (awk);
|
||||
}
|
||||
|
||||
static void __del_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||
{
|
||||
if (awk->syscas != XP_NULL && awk->syscas->lock != XP_NULL)
|
||||
awk->syscas->lock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_LOCK (awk);
|
||||
|
||||
xp_assert (awk->run.ptr != XP_NULL);
|
||||
|
||||
@ -486,8 +477,7 @@ static void __del_run (xp_awk_t* awk, xp_awk_run_t* run)
|
||||
run->awk = XP_NULL;
|
||||
awk->run.count--;
|
||||
|
||||
if (awk->syscas != XP_NULL && awk->syscas->unlock != XP_NULL)
|
||||
awk->syscas->unlock (awk, awk->syscas->custom_data);
|
||||
XP_AWK_UNLOCK (awk);
|
||||
}
|
||||
|
||||
static int __init_run (
|
||||
@ -4887,9 +4877,7 @@ static int __recomp_record_fields (
|
||||
{
|
||||
xp_memcpy (tmp, run->inrec.flds,
|
||||
xp_sizeof(*run->inrec.flds) * run->inrec.maxflds);
|
||||
run->awk->syscas->free (
|
||||
run->inrec.flds,
|
||||
run->awk->syscas->custom_data);
|
||||
XP_AWK_FREE (run->awk, run->inrec.flds);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.82 2006-09-01 03:44:51 bacon Exp $
|
||||
* $Id: awk.c,v 1.83 2006-09-01 04:03:13 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/awk/awk.h>
|
||||
@ -47,7 +47,7 @@
|
||||
#define xp_free free
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(__STAND_ALONE) && defined(_DEBUG)
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
@ -741,7 +741,7 @@ int xp_main (int argc, xp_char_t* argv[])
|
||||
#if defined(__linux) && defined(_DEBUG)
|
||||
mtrace ();
|
||||
#endif
|
||||
/*#if defined(_WIN32) && defined(__STAND_ALONE) && defined(_DEBUG)
|
||||
/*#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
_CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF);
|
||||
#endif*/
|
||||
|
||||
@ -750,7 +750,7 @@ int xp_main (int argc, xp_char_t* argv[])
|
||||
#if defined(__linux) && defined(_DEBUG)
|
||||
muntrace ();
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(__STAND_ALONE) && defined(_DEBUG)
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
_CrtDumpMemoryLeaks ();
|
||||
wprintf (L"Press ENTER to quit\n");
|
||||
getchar ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user