added qse_strspn() and qse_strcspn()

This commit is contained in:
2011-03-23 20:21:14 +00:00
parent e29dea930f
commit f83c2c133a
11 changed files with 240 additions and 143 deletions

View File

@ -9,7 +9,7 @@ lib_LTLIBRARIES = libqsecmn.la
libqsecmn_la_SOURCES = \
syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_bas.c str_cnv.c str_dyn.c str_utl.c \
str_bas.c str_cnv.c str_dyn.c str_spn.c str_utl.c \
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
tio.c tio_get.c tio_put.c \
fio.c pio.c sio.c \

View File

@ -73,7 +73,7 @@ am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqsecmn_la_DEPENDENCIES =
am_libqsecmn_la_OBJECTS = mem.lo xma.lo fma.lo chr.lo chr_cnv.lo \
rex.lo str_bas.lo str_cnv.lo str_dyn.lo str_utl.lo lda.lo \
rex.lo str_bas.lo str_cnv.lo str_dyn.lo str_spn.lo str_utl.lo lda.lo \
oht.lo htb.lo rbt.lo sll.lo gdl.lo dll.lo opt.lo tio.lo \
tio_get.lo tio_put.lo fio.lo pio.lo sio.lo alg_search.lo \
alg_sort.lo time.lo misc.lo assert.lo main.lo stdio.lo
@ -264,7 +264,7 @@ lib_LTLIBRARIES = libqsecmn.la $(am__append_1)
libqsecmn_la_SOURCES = \
syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_bas.c str_cnv.c str_dyn.c str_utl.c \
str_bas.c str_cnv.c str_dyn.c str_spn.c str_utl.c \
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
tio.c tio_get.c tio_put.c \
fio.c pio.c sio.c \
@ -385,6 +385,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_bas.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cnv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dyn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_spn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_utl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tio.Plo@am__quote@

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: mem.c 407 2011-03-23 02:21:14Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -430,7 +430,7 @@ static void mmgr_free (void* data, void* ptr)
free (ptr);
}
static qse_mmgr_t mmgr =
static qse_mmgr_t builtin_mmgr =
{
mmgr_alloc,
mmgr_realloc,
@ -438,4 +438,14 @@ static qse_mmgr_t mmgr =
QSE_NULL
};
qse_mmgr_t* qse_mmgr = &mmgr;
static qse_mmgr_t* dfl_mmgr = &builtin_mmgr;
qse_mmgr_t* qse_getdflmmgr ()
{
return dfl_mmgr;
}
void qse_setdflmmgr (qse_mmgr_t* mmgr)
{
dfl_mmgr = (mmgr? mmgr: &builtin_mmgr);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: pio.c 405 2011-03-21 14:01:10Z hyunghwan.chung $
* $Id: pio.c 407 2011-03-23 02:21:14Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -308,7 +308,7 @@ qse_pio_t* qse_pio_init (
* handle[0] inherited. set the flag not to inherit handle[1]. */
if (DosSetFHState (handle[1], OPEN_FLAGS_NOINHERIT) != NO_ERROR) goto oops;
/* Need to do somthing like this to set the flag instead?
/* Need to do somthing like this to set the flag instead?
ULONG state;
DosQueryFHState (handle[1], &state);
DosSetFHState (handle[1], state | OPEN_FLAGS_NOINHERIT); */
@ -467,37 +467,37 @@ qse_pio_t* qse_pio_init (
cmd_file = QSE_MT("cmd.exe");
}
else
{
qse_mchar_t* mptr;
#ifdef QSE_CHAR_IS_MCHAR
qse_size_t mn = qse_strlen(cmd);
cmd_line = qse_strdup2 (cmd, QSE_T(" "), pio->mmgr);
{
qse_mchar_t* mptr;
#ifdef QSE_CHAR_IS_MCHAR
qse_size_t mn = qse_strlen(cmd);
cmd_line = qse_strdup2 (cmd, QSE_T(" "), pio->mmgr);
if (cmd_line == QSE_NULL) goto oops;
#else
qse_size_t n, mn;
n = qse_wcstombslen (cmd, &mn);
if (cmd[n] != QSE_T('\0')) goto oops; /* illegal sequence in cmd */
mn = mn + 1;
cmd_line = QSE_MMGR_ALLOC (pio->mmgr, mn * QSE_SIZEOF(qse_char_t));
if (cmd_line == QSE_NULL) goto oops;
#else
qse_size_t n, mn;
n = qse_wcstombslen (cmd, &mn);
if (cmd[n] != QSE_T('\0')) goto oops; /* illegal sequence in cmd */
mn = mn + 1;
cmd_line = QSE_MMGR_ALLOC (pio->mmgr, mn * QSE_SIZEOF(qse_char_t));
if (cmd_line == QSE_NULL) goto oops;
qse_wcstombs (cmd, cmd_line, &mn);
#endif
/* TODO: enhance this part by:
* supporting file names containing whitespaces.
* detecting the end of the file name better.
* doing better parsing of the command line.
*/
/* NOTE: you must separate the command name and the parameters with
* a space. "pstat.exe /c" is ok while "pstat.exe/c" is not. */
mptr = qse_mbschr (cmd_line, QSE_MT(' '));
if (mptr) *mptr = QSE_MT('\0');
cmd_line[mn+1] = QSE_MT('\0'); /* the second '\0' at the end */
cmd_file = cmd_line;
#endif
/* TODO: enhance this part by:
* supporting file names containing whitespaces.
* detecting the end of the file name better.
* doing better parsing of the command line.
*/
/* NOTE: you must separate the command name and the parameters with
* a space. "pstat.exe /c" is ok while "pstat.exe/c" is not. */
mptr = qse_mbschr (cmd_line, QSE_MT(' '));
if (mptr) *mptr = QSE_MT('\0');
cmd_line[mn+1] = QSE_MT('\0'); /* the second '\0' at the end */
cmd_file = cmd_line;
}
/* execute the command line */
@ -697,7 +697,7 @@ qse_pio_t* qse_pio_init (
/* no field or an error */
goto child_oops;
}
/* calculate the length of the string after splitting */
for (wl = 0, n = fcnt; n > 0; )
{
@ -707,8 +707,8 @@ qse_pio_t* qse_pio_init (
n = qse_wcsntombsnlen (wcmd, wl, &mn);
if (n != wl) goto child_oops;
}
/* prepare to reserve 1 more slot for the terminating '\0'
/* prepare to reserve 1 more slot for the terminating '\0'
* by incrementing mn by 1. */
mn = mn + 1;