* renamed udd to ctx in qse_mmgr_t
* fixed problems in build and test scripts
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h 518 2011-07-24 14:24:13Z hyunghwan.chung $
|
||||
* $Id: awk.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -678,7 +678,7 @@ typedef struct qse_awk_rio_t qse_awk_rio_t;
|
||||
typedef void (*qse_awk_rcb_stm_t) (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_nde_t* nde, /**< node */
|
||||
void* udd /**< user-defined data */
|
||||
void* ctx /**< user-defined data */
|
||||
);
|
||||
|
||||
/**
|
||||
@ -698,7 +698,7 @@ struct qse_awk_rcb_t
|
||||
* A caller may store a user-defined data pointer into this field. This
|
||||
* is passed to the actual callback.
|
||||
*/
|
||||
void* udd;
|
||||
void* ctx;
|
||||
};
|
||||
typedef struct qse_awk_rcb_t qse_awk_rcb_t;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
this->alloc = alloc_mem;
|
||||
this->realloc = realloc_mem;
|
||||
this->free = free_mem;
|
||||
this->udd = this;
|
||||
this->ctx = this;
|
||||
}
|
||||
|
||||
///
|
||||
@ -90,17 +90,17 @@ protected:
|
||||
///
|
||||
/// bridge function from the #qse_mmgr_t type the allocMem() function.
|
||||
///
|
||||
static void* alloc_mem (void* udd, size_t n);
|
||||
static void* alloc_mem (void* ctx, size_t n);
|
||||
|
||||
///
|
||||
/// bridge function from the #qse_mmgr_t type the reallocMem() function.
|
||||
///
|
||||
static void* realloc_mem (void* udd, void* ptr, size_t n);
|
||||
static void* realloc_mem (void* ctx, void* ptr, size_t n);
|
||||
|
||||
///
|
||||
/// bridge function from the #qse_mmgr_t type the freeMem() function.
|
||||
///
|
||||
static void free_mem (void* udd, void* ptr);
|
||||
static void free_mem (void* ctx, void* ptr);
|
||||
};
|
||||
|
||||
/////////////////////////////////
|
||||
|
@ -118,7 +118,7 @@
|
||||
* }
|
||||
*
|
||||
* // complete the qse_mmgr_t interface by providing the allocator.
|
||||
* mmgr.udd = fma;
|
||||
* mmgr.ctx = fma;
|
||||
*
|
||||
* // initializes the statically declared red-black tree.
|
||||
* // can not call qse_rbt_open() which allocates the qse_rbt_t object.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mem.h 441 2011-04-22 14:28:43Z hyunghwan.chung $
|
||||
* $Id: mem.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -42,22 +42,18 @@
|
||||
* The QSE_MMGR_ALLOC() macro allocates a memory block of the @a size bytes
|
||||
* using the @a mmgr memory manager.
|
||||
*/
|
||||
#define QSE_MMGR_ALLOC(mmgr,size) \
|
||||
((mmgr)->alloc((mmgr)->udd,size))
|
||||
#define QSE_MMGR_ALLOC(mmgr,size) ((mmgr)->alloc((mmgr)->ctx,size))
|
||||
|
||||
/**
|
||||
* The QSE_MMGR_REALLOC() macro resizes a memory block pointed to by @a ptr
|
||||
* to the @a size bytes using the @a mmgr memory manager.
|
||||
*/
|
||||
#define QSE_MMGR_REALLOC(mmgr,ptr,size) \
|
||||
((mmgr)->realloc((mmgr)->udd,ptr,size))
|
||||
#define QSE_MMGR_REALLOC(mmgr,ptr,size) ((mmgr)->realloc((mmgr)->ctx,ptr,size))
|
||||
|
||||
/**
|
||||
* The QSE_MMGR_FREE() macro deallocates the memory block pointed to by @a ptr.
|
||||
*/
|
||||
#define QSE_MMGR_FREE(mmgr,ptr) \
|
||||
((mmgr)->free((mmgr)->udd,ptr))
|
||||
|
||||
#define QSE_MMGR_FREE(mmgr,ptr) ((mmgr)->free((mmgr)->ctx,ptr))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str.h 536 2011-08-06 03:25:08Z hyunghwan.chung $
|
||||
* $Id: str.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -2236,6 +2236,9 @@ qse_mchar_t* qse_wcstombsdup (
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (mbs)
|
||||
|
||||
/**
|
||||
* The qse_mbs_open() function creates a dynamically resizable multibyte string.
|
||||
*/
|
||||
qse_mbs_t* qse_mbs_open (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t ext,
|
||||
@ -2405,6 +2408,11 @@ qse_size_t qse_mbs_pac (
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (wcs)
|
||||
|
||||
|
||||
/**
|
||||
* The qse_wcs_open() function creates a dynamically resizable wide-character
|
||||
* string.
|
||||
*/
|
||||
qse_wcs_t* qse_wcs_open (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t ext,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h 524 2011-07-26 15:41:20Z hyunghwan.chung $
|
||||
* $Id: types.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -555,22 +555,22 @@ typedef struct qse_xptl_t qse_xptl_t;
|
||||
* allocate a memory chunk of the size @a n.
|
||||
* @return pointer to a memory chunk on success, QSE_NULL on failure.
|
||||
*/
|
||||
typedef void* (*qse_mmgr_alloc_t) (void* udd, qse_size_t n);
|
||||
typedef void* (*qse_mmgr_alloc_t) (void* ctx, qse_size_t n);
|
||||
/**
|
||||
* resize a memory chunk pointed to by @a ptr to the size @a n.
|
||||
* @return pointer to a memory chunk on success, QSE_NULL on failure.
|
||||
*/
|
||||
typedef void* (*qse_mmgr_realloc_t) (void* udd, void* ptr, qse_size_t n);
|
||||
typedef void* (*qse_mmgr_realloc_t) (void* ctx, void* ptr, qse_size_t n);
|
||||
/**
|
||||
* free a memory chunk pointed to by @a ptr.
|
||||
*/
|
||||
typedef void (*qse_mmgr_free_t) (void* udd, void* ptr);
|
||||
typedef void (*qse_mmgr_free_t) (void* ctx, void* ptr);
|
||||
|
||||
/**
|
||||
* The qse_mmgr_t type defines a set of functions for memory management.
|
||||
* As the type is merely a structure, it is just used as a single container
|
||||
* for memory management functions with a pointer to user-defined data.
|
||||
* The user-defined data pointer @a udd is passed to each memory management
|
||||
* The user-defined data pointer @a ctx is passed to each memory management
|
||||
* function whenever it is called. You can allocate, reallocate, and free
|
||||
* a memory chunk.
|
||||
*
|
||||
@ -582,7 +582,7 @@ struct qse_mmgr_t
|
||||
qse_mmgr_alloc_t alloc; /**< allocation function */
|
||||
qse_mmgr_realloc_t realloc; /**< resizing function */
|
||||
qse_mmgr_free_t free; /**< disposal function */
|
||||
void* udd; /**< user-defined data pointer */
|
||||
void* ctx; /**< user-defined data pointer */
|
||||
};
|
||||
typedef struct qse_mmgr_t qse_mmgr_t;
|
||||
|
||||
|
Reference in New Issue
Block a user