touched up code

This commit is contained in:
hyung-hwan 2009-09-22 07:28:18 +00:00
parent bc43362962
commit 225b1c5ec1
11 changed files with 244 additions and 128 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: awk.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -708,7 +708,7 @@ static int awk_main (int argc, qse_char_t* argv[])
qse_awk_parsestd_in_t psin;
qse_awk_parsestd_out_t psout;
qse_memset (&arg, 0, QSE_SIZEOF(arg));
memset (&arg, 0, QSE_SIZEOF(arg));
i = comparg (argc, argv, &arg);
if (i <= 0)

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 288 2009-09-15 14:03:15Z hyunghwan.chung $
* $Id: awk.h 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -31,9 +31,8 @@
*
* @todo
* - make enhancement to treat a function as a value
* - add RQ (right quote), LQ (left quote), ES (escaper) for more powerful
* record splitting
* - improve performance of qse_awk_rtx_readio() if RS is logner than 2 chars.
* - consider something like ${1:3,5} => $1, $2, $3, and $5 concatenated
*/
/**

View File

@ -1,5 +1,5 @@
/*
* $Id: tio.h 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: tio.h 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -66,10 +66,8 @@ enum
typedef struct qse_tio_t qse_tio_t;
/****t* Common/qse_tio_io_t
* NAME
* qse_tio_io_t - define a text IO handler type
* SYNOPSIS
/**
* The qse_tio_io_t types define a text I/O handler.
*/
typedef qse_ssize_t (*qse_tio_io_t) (
int cmd,
@ -77,16 +75,11 @@ typedef qse_ssize_t (*qse_tio_io_t) (
void* data,
qse_size_t size
);
/******/
/****s* Common/qse_tio_t
* NAME
* qse_tio_t - define a text IO type
* DESCRIPTION
* The qse_tio_t type defines a generic type for text IO. When qse_char_t is
* qse_mchar_t, it handles any byte streams. When qse_char_t is qse_wchar_t,
* it handles a multi-byte stream converted to a wide character stream.
* SYNOPSIS
/**
* The qse_tio_t type defines a generic type for text IO. If #qse_char_t is
* #qse_mchar_t, it handles any byte streams. If qse_char_t is #qse_wchar_t,
* it handles a multi-byte stream converted to a wide character stream.
*/
struct qse_tio_t
{
@ -108,7 +101,6 @@ struct qse_tio_t
qse_mchar_t inbuf[QSE_TIO_MAX_INBUF_LEN];
qse_mchar_t outbuf[QSE_TIO_MAX_OUTBUF_LEN];
};
/******/
#ifdef __cplusplus
extern "C" {
@ -116,26 +108,20 @@ extern "C" {
QSE_DEFINE_COMMON_FUNCTIONS (tio)
/****f* Common/qse_tio_open
* NAME
* qse_tio_open - create an text IO processor
* SYNOPSIS
/**
* The qse_tio_open() function creates an text stream processoor.
*/
qse_tio_t* qse_tio_open (
qse_mmgr_t* mmgr,
qse_size_t ext
);
/******/
/****f* Common/qse_tio_close
* NAME
* qse_tio_close - destroy an text IO processor
* SYNOPSIS
/**
* The qse_tio_close() function destroys an text stream processor.
*/
int qse_tio_close (
qse_tio_t* tio
);
/******/
/****f* Common/qse_tio_init
* NAME

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 290 2009-09-19 04:28:49Z hyunghwan.chung $
* $Id: awk.h 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -21,6 +21,7 @@
#ifndef _QSE_LIB_AWK_AWK_H_
#define _QSE_LIB_AWK_AWK_H_
#define USE_STDC
#include "../cmn/mem.h"
#include <qse/cmn/chr.h>
#include <qse/cmn/str.h>
@ -287,7 +288,9 @@ struct qse_awk_rtx_t
qse_size_t buf_len;
qse_bool_t eof;
qse_str_t line;
qse_str_t line; /* entire line */
qse_str_t linew; /* line for manipulation, if necessary */
qse_awk_val_t* d0; /* $0 */
qse_size_t maxflds;

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: misc.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -796,7 +796,8 @@ qse_char_t* qse_awk_rtx_strxntok (
}
for (d = delim; d < delim_end; d++)
{
if (c == QSE_AWK_TOUPPER(rtx->awk,*d)) goto exit_loop;
if (c == QSE_AWK_TOUPPER(rtx->awk,*d))
goto exit_loop;
}
if (sp == QSE_NULL) sp = p;
ep = p++;
@ -834,7 +835,7 @@ exit_loop:
*tok_len = ep - sp + 1;
}
/* if QSE_NULL is returned, this function should not be called anymore */
/* if QSE_NULL is returned, this function should not be called again */
if (p >= end) return QSE_NULL;
if (delim_mode == __DELIM_EMPTY ||
delim_mode == __DELIM_SPACES) return (qse_char_t*)p;
@ -937,6 +938,15 @@ exit_loop:
}
}
qse_char_t* qse_awk_rtx_strxnfld (
qse_awk_rtx_t* rtx, qse_char_t* str, qse_size_t len,
qse_char_t fs, qse_char_t lq, qse_char_t rq, qse_char_t ec,
qse_char_t** tok, qse_size_t* tok_len)
{
/* TODO: */
return QSE_NULL;
}
#define QSE_AWK_REXERRTOERR(err) \
((err == QSE_REX_ENOERR)? QSE_AWK_ENOERR: \
(err == QSE_REX_ENOMEM)? QSE_AWK_ENOMEM: \

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.h 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: misc.h 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -55,6 +55,18 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
qse_awk_errnum_t* errnum
);
qse_char_t* qse_awk_rtx_strxnfld (
qse_awk_rtx_t* rtx,
qse_char_t* str,
qse_size_t len,
qse_char_t fs,
qse_char_t lq,
qse_char_t rq,
qse_char_t ec,
qse_char_t** tok,
qse_size_t* tok_len
);
void* qse_awk_buildrex (
qse_awk_t* awk,
const qse_char_t* ptn,

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: parse.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -326,6 +326,7 @@ static global_t gtab[] =
{ QSE_T("RLENGTH"), 7, 0 },
{ QSE_T("RS"), 2, 0 },
{ QSE_T("RSTART"), 6, 0 },
{ QSE_T("SUBSEP"), 6, 0 }
};

View File

@ -1,5 +1,5 @@
/*
* $Id: rec.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: rec.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -96,7 +96,7 @@ int qse_awk_rtx_setrec (
return 0;
}
static int split_record (qse_awk_rtx_t* run)
static int split_record (qse_awk_rtx_t* rtx)
{
qse_char_t* p, * tok;
qse_size_t len, tok_len, nflds;
@ -104,12 +104,13 @@ static int split_record (qse_awk_rtx_t* run)
qse_char_t* fs_ptr, * fs_free;
qse_size_t fs_len;
qse_awk_errnum_t errnum;
int how;
/* inrec should be cleared before split_record is called */
QSE_ASSERT (run->inrec.nflds == 0);
QSE_ASSERT (rtx->inrec.nflds == 0);
/* get FS */
fs = qse_awk_rtx_getgbl (run, QSE_AWK_GBL_FS);
fs = qse_awk_rtx_getgbl (rtx, QSE_AWK_GBL_FS);
if (fs->type == QSE_AWK_VAL_NIL)
{
fs_ptr = QSE_T(" ");
@ -127,7 +128,7 @@ static int split_record (qse_awk_rtx_t* run)
qse_awk_rtx_valtostr_out_t out;
out.type = QSE_AWK_RTX_VALTOSTR_CPLDUP;
if (qse_awk_rtx_valtostr (run, fs, &out) == QSE_NULL) return -1;
if (qse_awk_rtx_valtostr (rtx, fs, &out) == QSE_NULL) return -1;
fs_ptr = out.u.cpldup.ptr;
fs_len = out.u.cpldup.len;
@ -135,135 +136,226 @@ static int split_record (qse_awk_rtx_t* run)
}
/* scan the input record to count the fields */
p = QSE_STR_PTR(&run->inrec.line);
len = QSE_STR_LEN(&run->inrec.line);
len = QSE_STR_LEN(&rtx->inrec.line);
if (fs_len == 5 && fs_ptr[0] == QSE_T('?'))
{
if (qse_str_ncpy (
&rtx->inrec.linew,
QSE_STR_PTR(&rtx->inrec.line),
QSE_STR_LEN(&rtx->inrec.line)) == (qse_size_t)-1)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
p = QSE_STR_PTR(&rtx->inrec.linew);
how = 1;
}
else
{
p = QSE_STR_PTR(&rtx->inrec.line);
how = (fs_len <= 1)? 0: 2;
}
#if 0
nflds = 0;
while (p != QSE_NULL)
{
if (fs_len <= 1)
switch (how)
{
p = qse_awk_rtx_strxntok (run,
p, len, fs_ptr, fs_len, &tok, &tok_len);
}
else
{
p = qse_awk_rtx_strxntokbyrex (
run,
QSE_STR_PTR(&run->inrec.line),
QSE_STR_LEN(&run->inrec.line),
p, len,
run->gbl.fs, &tok, &tok_len, &errnum
);
if (p == QSE_NULL && errnum != QSE_AWK_ENOERR)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (run->awk, fs_free);
qse_awk_rtx_seterrnum (run, errnum, QSE_NULL);
return -1;
}
case 0:
p = qse_awk_rtx_strxntok (rtx,
p, len, fs_ptr, fs_len, &tok, &tok_len);
break;
case 1:
break;
default:
p = qse_awk_rtx_strxntokbyrex (
rtx,
QSE_STR_PTR(&rtx->inrec.line),
QSE_STR_LEN(&rtx->inrec.line),
p, len,
rtx->gbl.fs, &tok, &tok_len, &errnum
);
if (p == QSE_NULL && errnum != QSE_AWK_ENOERR)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, errnum, QSE_NULL);
return -1;
}
}
if (nflds == 0 && p == QSE_NULL && tok_len == 0)
{
/* there are no fields. it can just return here
* as qse_awk_rtx_clrrec has been called before this */
if (fs_free != QSE_NULL) QSE_AWK_FREE (run->awk, fs_free);
if (fs_free != QSE_NULL) QSE_AWK_FREE (rtx->awk, fs_free);
return 0;
}
QSE_ASSERT ((tok != QSE_NULL && tok_len > 0) || tok_len == 0);
nflds++;
len = QSE_STR_LEN(&run->inrec.line) -
(p - QSE_STR_PTR(&run->inrec.line));
len = QSE_STR_LEN(&rtx->inrec.line) -
(p - QSE_STR_PTR(&rtx->inrec.line));
}
/* allocate space */
if (nflds > run->inrec.maxflds)
if (nflds > rtx->inrec.maxflds)
{
void* tmp = QSE_AWK_ALLOC (
run->awk, QSE_SIZEOF(*run->inrec.flds) * nflds);
rtx->awk, QSE_SIZEOF(*rtx->inrec.flds) * nflds);
if (tmp == QSE_NULL)
{
if (fs_free != QSE_NULL) QSE_AWK_FREE (run->awk, fs_free);
qse_awk_rtx_seterrnum (run, QSE_AWK_ENOMEM, QSE_NULL);
if (fs_free != QSE_NULL) QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
if (run->inrec.flds != QSE_NULL)
QSE_AWK_FREE (run->awk, run->inrec.flds);
run->inrec.flds = tmp;
run->inrec.maxflds = nflds;
if (rtx->inrec.flds != QSE_NULL)
QSE_AWK_FREE (rtx->awk, rtx->inrec.flds);
rtx->inrec.flds = tmp;
rtx->inrec.maxflds = nflds;
}
/* scan again and split it */
p = QSE_STR_PTR(&run->inrec.line);
len = QSE_STR_LEN(&run->inrec.line);
if (how == 1)
{
if (qse_str_ncpy (
&rtx->inrec.linew,
QSE_STR_PTR(&rtx->inrec.line),
QSE_STR_LEN(&rtx->inrec.line)) == (qse_size_t)-1)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
p = QSE_STR_PTR(&rtx->inrec.linew):
}
else
{
p = QSE_STR_PTR(&rtx->inrec.line);
}
len = QSE_STR_LEN(&rtx->inrec.line);
#endif
while (p != QSE_NULL)
{
if (fs_len <= 1)
switch (how)
{
p = qse_awk_rtx_strxntok (
run, p, len, fs_ptr, fs_len, &tok, &tok_len);
case 0:
p = qse_awk_rtx_strxntok (
rtx, p, len, fs_ptr, fs_len,
&tok, &tok_len);
break;
case 1:
p = qse_awk_rtx_strxnfld (
rtx, p, len,
fs_ptr[1], fs_ptr[2],
fs_ptr[3], fs_ptr[4],
&tok, &tok_len);
break;
default:
p = qse_awk_rtx_strxntokbyrex (
rtx,
QSE_STR_PTR(&rtx->inrec.line),
QSE_STR_LEN(&rtx->inrec.line),
p, len,
rtx->gbl.fs, &tok, &tok_len, &errnum
);
if (p == QSE_NULL && errnum != QSE_AWK_ENOERR)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, errnum, QSE_NULL);
return -1;
}
}
else
#if 1
if (rtx->inrec.nflds == 0 && p == QSE_NULL && tok_len == 0)
{
p = qse_awk_rtx_strxntokbyrex (
run,
QSE_STR_PTR(&run->inrec.line),
QSE_STR_LEN(&run->inrec.line),
p, len,
run->gbl.fs, &tok, &tok_len, &errnum
);
if (p == QSE_NULL && errnum != QSE_AWK_ENOERR)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (run->awk, fs_free);
qse_awk_rtx_seterrnum (run, errnum, QSE_NULL);
return -1;
}
/* there are no fields. it can just return here
* as qse_awk_rtx_clrrec has been called before this */
if (fs_free != QSE_NULL) QSE_AWK_FREE (rtx->awk, fs_free);
return 0;
}
#endif
QSE_ASSERT ((tok != QSE_NULL && tok_len > 0) || tok_len == 0);
run->inrec.flds[run->inrec.nflds].ptr = tok;
run->inrec.flds[run->inrec.nflds].len = tok_len;
#if 1
if (rtx->inrec.nflds >= rtx->inrec.maxflds)
{
if (rtx->inrec.nflds < 16) nflds = 32;
else nflds = rtx->inrec.nflds * 2;
run->inrec.flds[run->inrec.nflds].val =
qse_awk_rtx_makenstrval (run, tok, tok_len);
void* tmp = QSE_AWK_ALLOC (
rtx->awk, QSE_SIZEOF(*rtx->inrec.flds) * nflds);
if (tmp == QSE_NULL)
{
if (fs_free != QSE_NULL) QSE_AWK_FREE (rtx->awk, fs_free);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
if (run->inrec.flds[run->inrec.nflds].val == QSE_NULL)
if (rtx->inrec.flds != QSE_NULL)
{
QSE_MEMCPY (tmp, rtx->inrec.flds,
QSE_SIZEOF(*rtx->inrec.flds) * rtx->inrec.nflds);
QSE_AWK_FREE (rtx->awk, rtx->inrec.flds);
}
rtx->inrec.flds = tmp;
rtx->inrec.maxflds = nflds;
}
#endif
rtx->inrec.flds[rtx->inrec.nflds].ptr = tok;
rtx->inrec.flds[rtx->inrec.nflds].len = tok_len;
rtx->inrec.flds[rtx->inrec.nflds].val =
qse_awk_rtx_makenstrval (rtx, tok, tok_len);
if (rtx->inrec.flds[rtx->inrec.nflds].val == QSE_NULL)
{
if (fs_free != QSE_NULL)
QSE_AWK_FREE (run->awk, fs_free);
QSE_AWK_FREE (rtx->awk, fs_free);
return -1;
}
qse_awk_rtx_refupval (
run, run->inrec.flds[run->inrec.nflds].val);
run->inrec.nflds++;
rtx, rtx->inrec.flds[rtx->inrec.nflds].val);
rtx->inrec.nflds++;
len = QSE_STR_LEN(&run->inrec.line) -
(p - QSE_STR_PTR(&run->inrec.line));
len = QSE_STR_LEN(&rtx->inrec.line) -
(p - QSE_STR_PTR(&rtx->inrec.line));
}
if (fs_free != QSE_NULL) QSE_AWK_FREE (run->awk, fs_free);
if (fs_free != QSE_NULL) QSE_AWK_FREE (rtx->awk, fs_free);
/* set the number of fields */
v = qse_awk_rtx_makeintval (run, (qse_long_t)nflds);
v = qse_awk_rtx_makeintval (rtx, (qse_long_t)rtx->inrec.nflds);
if (v == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, v);
if (qse_awk_rtx_setgbl (run, QSE_AWK_GBL_NF, v) == -1)
qse_awk_rtx_refupval (rtx, v);
if (qse_awk_rtx_setgbl (rtx, QSE_AWK_GBL_NF, v) == -1)
{
qse_awk_rtx_refdownval (run, v);
qse_awk_rtx_refdownval (rtx, v);
return -1;
}
qse_awk_rtx_refdownval (run, v);
QSE_ASSERT (nflds == run->inrec.nflds);
qse_awk_rtx_refdownval (rtx, v);
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 290 2009-09-19 04:28:49Z hyunghwan.chung $
* $Id: run.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -819,8 +819,17 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
return -1;
}
if (qse_str_init (
&rtx->inrec.linew, MMGR(rtx), DEF_BUF_CAPA) == QSE_NULL)
{
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
if (qse_str_init (&rtx->format.out, MMGR(rtx), 256) == QSE_NULL)
{
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
@ -829,6 +838,7 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
if (qse_str_init (&rtx->format.fmt, MMGR(rtx), 256) == QSE_NULL)
{
qse_str_fini (&rtx->format.out);
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
@ -840,6 +850,7 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
{
qse_str_fini (&rtx->format.fmt);
qse_str_fini (&rtx->format.out);
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
@ -857,6 +868,7 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
qse_map_close (rtx->named);
qse_str_fini (&rtx->format.fmt);
qse_str_fini (&rtx->format.out);
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
@ -874,6 +886,7 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
qse_map_close (rtx->named);
qse_str_fini (&rtx->format.fmt);
qse_str_fini (&rtx->format.out);
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
@ -907,7 +920,6 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
static void fini_rtx (qse_awk_rtx_t* rtx, int fini_globals)
{
if (rtx->pattern_range_state != QSE_NULL)
QSE_AWK_FREE (rtx->awk, rtx->pattern_range_state);
@ -984,6 +996,7 @@ static void fini_rtx (qse_awk_rtx_t* rtx, int fini_globals)
rtx->inrec.flds = QSE_NULL;
rtx->inrec.maxflds = 0;
}
qse_str_fini (&rtx->inrec.linew);
qse_str_fini (&rtx->inrec.line);
if (fini_globals) refdown_globals (rtx, 1);

View File

@ -1,5 +1,5 @@
/*
* $Id: std.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: std.c 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -66,7 +66,7 @@ typedef struct xtn_t
qse_char_t* end;
} cpl;
} u;
qse_sio_t* handle;
qse_sio_t* handle;
} out;
} s;

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.h 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: mem.h 291 2009-09-21 13:28:18Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -23,7 +23,17 @@
#include <qse/cmn/mem.h>
#ifdef USE_STDC
#ifdef MINIMIZE_PLATFORM_DEPENDENCY
#define QSE_MEMCPY(dst,src,len) qse_memcpy(dst,src,len)
#define QSE_MEMCMP(p1,p2,len) qse_memcmp(p1,p2,len)
#define QSE_MEMSET(dst,val,len) qse_memset(dst,val,len)
#define QSE_MEMBYTE(s,val,len) qse_membyte(s,val,len)
#define QSE_MEMRBYTE(s,val,len) qse_memrbyte(s,val,len)
#define QSE_MEMMEM(hs,hl,nd,nl) qse_memmem(hs,hl,nd,nl)
#define QSE_MEMRMEM(hs,hl,nd,nl) qse_memrmem(hs,hl,nd,nl)
#else
#include <string.h>
#define QSE_MEMCPY(dst,src,len) memcpy(dst,src,len)
@ -34,16 +44,6 @@
#define QSE_MEMMEM(hs,hl,nd,nl) memmem(hs,hl,nd,nl)
#define QSE_MEMRMEM(hs,hl,nd,nl) memrmem(hs,hl,nd,nl)
#else
#define QSE_MEMCPY(dst,src,len) qse_memcpy(dst,src,len)
#define QSE_MEMCMP(p1,p2,len) qse_memcmp(p1,p2,len)
#define QSE_MEMSET(dst,val,len) qse_memset(dst,val,len)
#define QSE_MEMBYTE(s,val,len) qse_membyte(s,val,len)
#define QSE_MEMRBYTE(s,val,len) qse_memrbyte(s,val,len)
#define QSE_MEMMEM(hs,hl,nd,nl) qse_memmem(hs,hl,nd,nl)
#define QSE_MEMRMEM(hs,hl,nd,nl) qse_memrmem(hs,hl,nd,nl)
#endif
#define QSE_MALLOC(mmgr,size) QSE_MMGR_ALLOC(mmgr,size)