From b673e79c8c09751e8d58da5be5728fec681d5477 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 31 Aug 2012 13:00:33 +0000 Subject: [PATCH] enhanced qse_glob for win32 and os2. added input file expansion to cmd/sed/sed.c for win32 and os2 --- qse/cmd/sed/sed.c | 142 ++++++- qse/include/qse/cmn/glob.h | 17 +- qse/lib/cmn/fs-move.c | 3 +- qse/lib/cmn/glob.c | 490 ++++++++++++++++++---- qse/samples/cmn/glob01.c | 23 +- qse/watcom/debug/dos32/lib/cmn/qsecmn.tgt | 254 ++++++----- qse/watcom/debug/os2/lib/cmn/qsecmn.tgt | 254 ++++++----- qse/watcom/qse.wpj | 22 +- qse/watcom/release/os2/lib/cmn/qsecmn.tgt | 252 ++++++----- 9 files changed, 1027 insertions(+), 430 deletions(-) diff --git a/qse/cmd/sed/sed.c b/qse/cmd/sed/sed.c index 0ffdcc02..33a0420e 100644 --- a/qse/cmd/sed/sed.c +++ b/qse/cmd/sed/sed.c @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -586,7 +587,82 @@ static void trace_exec (qse_sed_t* sed, qse_sed_exec_op_t op, const qse_sed_cmd_ } #endif -int sed_main (int argc, qse_char_t* argv[]) +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + +struct xarg_t +{ + qse_mmgr_t* mmgr; + qse_char_t** ptr; + qse_size_t size; + qse_size_t capa; +}; + +typedef struct xarg_t xarg_t; + +static int collect (const qse_cstr_t* path, void* ctx) +{ + xarg_t* xarg = (xarg_t*)ctx; + + if (xarg->size <= xarg->capa) + { + qse_char_t** tmp; + + tmp = QSE_MMGR_REALLOC (xarg->mmgr, xarg->ptr, QSE_SIZEOF(*tmp) * (xarg->capa + 128)); + if (tmp == QSE_NULL) return -1; + + xarg->ptr = tmp; + xarg->capa += 128; + } + + xarg->ptr[xarg->size] = qse_strdup (path->ptr, xarg->mmgr); + if (xarg->ptr[xarg->size] == QSE_NULL) return -1; + xarg->size++; + + return 0; +} + +static void purge_xarg (xarg_t* xarg) +{ + if (xarg->ptr) + { + qse_size_t i; + + for (i = 0; i < xarg->size; i++) + QSE_MMGR_FREE (xarg->mmgr, xarg->ptr[i]); + QSE_MMGR_FREE (xarg->mmgr, xarg->ptr); + + xarg->size = 0; + xarg->capa = 0; + } +} + +static int expand (int argc, qse_char_t* argv[], xarg_t* xarg) +{ + int i; + qse_cstr_t tmp; + + for (i = 0; i < argc; i++) + { + int x; + x = qse_glob (argv[i], collect, xarg, QSE_GLOB_PERIOD, xarg->mmgr); + + if (x <= -1) return -1; + + if (x == 0) + { + /* not expanded. just use it as is */ + tmp.ptr = argv[i]; + tmp.len = qse_strlen(argv[i]); + if (collect (&tmp, xarg) <= -1) return -1; + } + } + + return 0; +} + +#endif + +static int sed_main (int argc, qse_char_t* argv[]) { qse_mmgr_t* mmgr = QSE_MMGR_GETDFL(); qse_sed_t* sed = QSE_NULL; @@ -594,6 +670,11 @@ int sed_main (int argc, qse_char_t* argv[]) qse_size_t script_count; int ret = -1; +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + xarg_t xarg; + int xarg_inited = 0; +#endif + ret = handle_args (argc, argv); if (ret <= -1) return -1; if (ret == 0) return 0; @@ -642,7 +723,7 @@ int sed_main (int argc, qse_char_t* argv[]) qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n")); goto oops; } - + qse_sed_setoption (sed, g_option); if (qse_sed_compstd (sed, g_script.io, &script_count) <= -1) @@ -689,14 +770,21 @@ int sed_main (int argc, qse_char_t* argv[]) if (g_trace) qse_sed_setexectracer (sed, trace_exec); #endif +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + qse_memset (&xarg, 0, QSE_SIZEOF(xarg)); + xarg.mmgr = qse_sed_getmmgr(sed); + xarg_inited = 1; +#endif + if (g_separate && g_infile_pos > 0) { /* 's' and input files are specified on the command line */ - qse_sed_iostd_t out_file; qse_sed_iostd_t out_inplace; qse_sed_iostd_t* output_file = QSE_NULL; qse_sed_iostd_t* output = QSE_NULL; + qse_char_t** inptr; + int inpos, num_ins; if (g_output_file && qse_strcmp (g_output_file, QSE_T("-")) != 0) @@ -721,15 +809,29 @@ int sed_main (int argc, qse_char_t* argv[]) output = output_file; } - while (g_infile_pos < argc) +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + /* perform wild-card expansions for non-unix platforms */ + if (expand (argc - g_infile_pos, &argv[g_infile_pos], &xarg) <= -1) + { + qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n")); + goto oops; + } + + num_ins = xarg.size; + inptr = xarg.ptr; +#else + num_ins = argc - g_infile_pos; + inptr = &argv[g_infile_pos]; +#endif + + for (inpos = 0; inpos < num_ins; inpos++) { qse_sed_iostd_t in[2]; qse_char_t* tmpl_tmpfile; in[0].type = QSE_SED_IOSTD_FILE; in[0].u.file.path = - (qse_strcmp (argv[g_infile_pos], QSE_T("-")) == 0)? - QSE_NULL: argv[g_infile_pos]; + (qse_strcmp (inptr[inpos], QSE_T("-")) == 0)? QSE_NULL: inptr[inpos]; in[0].u.file.cmgr = g_infile_cmgr; in[1].type = QSE_SED_IOSTD_NULL; @@ -814,8 +916,6 @@ int sed_main (int argc, qse_char_t* argv[]) } if (qse_sed_isstop (sed)) break; - - g_infile_pos++; } if (output) qse_sio_close (output->u.sio); @@ -829,10 +929,23 @@ int sed_main (int argc, qse_char_t* argv[]) if (g_infile_pos > 0) { int i, num_ins; + const qse_char_t* tmp; /* input files are specified on the command line */ +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + /* perform wild-card expansions for non-unix platforms */ + if (expand (argc - g_infile_pos, &argv[g_infile_pos], &xarg) <= -1) + { + qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n")); + goto oops; + } + + num_ins = xarg.size; +#else num_ins = argc - g_infile_pos; +#endif + in = QSE_MMGR_ALLOC (qse_sed_getmmgr(sed), QSE_SIZEOF(*in) * (num_ins + 1)); if (in == QSE_NULL) { @@ -843,11 +956,14 @@ int sed_main (int argc, qse_char_t* argv[]) for (i = 0; i < num_ins; i++) { in[i].type = QSE_SED_IOSTD_FILE; +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + tmp = xarg.ptr[i]; +#else + tmp = argv[g_infile_pos++]; +#endif in[i].u.file.path = - (qse_strcmp (argv[g_infile_pos], QSE_T("-")) == 0)? - QSE_NULL: argv[g_infile_pos]; + (qse_strcmp (tmp, QSE_T("-")) == 0)? QSE_NULL: tmp; in[i].u.file.cmgr = g_infile_cmgr; - g_infile_pos++; } in[i].type = QSE_SED_IOSTD_NULL; @@ -889,6 +1005,10 @@ int sed_main (int argc, qse_char_t* argv[]) ret = 0; oops: +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + if (xarg_inited) purge_xarg (&xarg); +#endif + if (sed) qse_sed_close (sed); if (fs) qse_fs_close (fs); if (xma_mmgr.ctx) qse_xma_close (xma_mmgr.ctx); diff --git a/qse/include/qse/cmn/glob.h b/qse/include/qse/cmn/glob.h index ddad3b67..f0d2235a 100644 --- a/qse/include/qse/cmn/glob.h +++ b/qse/include/qse/cmn/glob.h @@ -24,7 +24,16 @@ #include #include +typedef int (*qse_glob_cbfun_t) ( + const qse_cstr_t* path, + void* cbctx +); +enum qse_glob_flags_t +{ + QSE_GLOB_NOESCAPE = (1 << 0), + QSE_GLOB_PERIOD = (1 << 1) +}; #ifdef __cplusplus extern "C" { @@ -32,13 +41,19 @@ extern "C" { int qse_glob ( const qse_char_t* pattern, + qse_glob_cbfun_t cbfun, + void* cbctx, + int flags, qse_mmgr_t* mmgr ); int qse_globwithcmgr ( const qse_char_t* pattern, + qse_glob_cbfun_t cbfun, + void* cbctx, + int flags, qse_mmgr_t* mmgr, - qse_mmgr_t* cmgr + qse_cmgr_t* cmgr ); #ifdef __cplusplus diff --git a/qse/lib/cmn/fs-move.c b/qse/lib/cmn/fs-move.c index ab771fa7..b352f548 100644 --- a/qse/lib/cmn/fs-move.c +++ b/qse/lib/cmn/fs-move.c @@ -24,7 +24,6 @@ #include #include "mem.h" - /* OVERWRITE AND FORCE handled by callback??? QSE_FS_MOVE_UPDATE @@ -121,7 +120,7 @@ int qse_fs_move ( APIRET rc; rc = DosMove (fop.old_path, fop.new_path); - if (rc == ERROR_ALREADY_EXISTS) + if (rc == ERROR_ALREADY_EXISTS || rc == ERROR_ACCESS_DENIED) { DosDelete (fop.new_path); rc = DosMove (fop.old_path, fop.new_path); diff --git a/qse/lib/cmn/glob.c b/qse/lib/cmn/glob.c index 87b53c35..417f234f 100644 --- a/qse/lib/cmn/glob.c +++ b/qse/lib/cmn/glob.c @@ -21,11 +21,22 @@ #include #include #include +#include #include "mem.h" -#include -#include -#include +#if defined(_WIN32) +# include +#elif defined(__OS2__) +# define INCL_DOSFILEMGR +# define INCL_ERRORS +# include +#elif defined(__DOS__) + /* what? */ +#else +# include +# include +# include +#endif #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) # define SEPC QSE_T('\\') @@ -42,37 +53,53 @@ #define IS_NIL(c) ((c) == QSE_T('\0')) #define IS_SEP_OR_NIL(c) (IS_SEP(c) || IS_NIL(c)) +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + /* i don't support escaping in these systems */ +# define IS_ESC(c) (0) +#else +# define IS_ESC(c) ((c) == QSE_T('\\')) +#endif + +/* this macro only checks for top-level wild-cards among these. + * *, ?, [], !, - + * see str-fnmat.c for more wild-card letters + */ #define IS_WILD(c) ((c) == QSE_T('*') || (c) == QSE_T('?') || (c) == QSE_T('[')) -#define GLOB_MULTI QSE_T('*') -#define GLOB_SINGLE QSE_T('?') -#define GLOB_RANGE QSE_T("[]") -#define GLOB_NEGATE QSE_T("^!") - -#define string_has_globs(ptr) \ - (qse_strpbrk (ptr, QSE_T("*?[")) != QSE_NULL) -#define string_has_globs2(ptr,len) \ - (qse_strxpbrk (ptr, len, QSE_T("*?[")) != QSE_NULL) - - struct glob_t { + qse_glob_cbfun_t cbfun; + void* cbctx; + qse_mmgr_t* mmgr; qse_cmgr_t* cmgr; + qse_str_t path; + qse_str_t segtmp; + + int expanded; + int fnmat_flags; int depth; }; typedef struct glob_t glob_t; -static int record_a_match (const qse_char_t* x) -{ -wprintf (L"MATCH => [%.*S]\n", (int)qse_strlen(x), x); -return 0; -} - static int path_exists (glob_t* g, const qse_char_t* name) { +#if defined(_WIN32) + + return (GetFileAttributes(name) != INVALID_FILE_ATTRIBUTES)? 1: 0; + +#elif defined(__OS2__) + + return -1; + +#elif defined(__DOS__) + + return -1; + +#else + struct stat st; int x; @@ -91,28 +118,8 @@ static int path_exists (glob_t* g, const qse_char_t* name) #endif return (x == 0)? 1: 0; -} - -static int path_is_directory (glob_t* g, const qse_char_t* name) -{ - struct stat st; - int x; - -#if defined(QSE_CHAR_IS_MCHAR) - - x = lstat (name, &st); - -#else - qse_mchar_t* ptr; - - ptr = qse_wcstombsdup (name, g->mmgr); - if (ptr == QSE_NULL) return -1; - - x = lstat (ptr, &st); - QSE_MMGR_FREE (g->mmgr, ptr); #endif - return (x == 0 && S_ISDIR(st.st_mode))? 1: 0; } struct segment_t @@ -126,15 +133,19 @@ struct segment_t const qse_char_t* ptr; qse_size_t len; + qse_char_t sep; /* preceeding separator */ - unsigned int wild: 1; - unsigned int next: 1; + unsigned int wild: 1; /* indicate that it contains wildcards */ + unsigned int esc: 1; /* indicate that it contains escaped letters */ + unsigned int next: 1; /* indicate that it has the following segment */ }; typedef struct segment_t segment_t; -static int get_next_segment (segment_t* seg) +static int get_next_segment (glob_t* g, segment_t* seg) { +/* TODO: WIN32 X: drive letter segment... */ + if (seg->type == NONE) { /* seg->ptr must point to the beginning of the pattern @@ -148,15 +159,30 @@ static int get_next_segment (segment_t* seg) seg->type = ROOT; seg->len = 1; seg->next = IS_NIL(seg->ptr[1])? 0: 1; + seg->sep = QSE_T('\0'); + seg->wild = 0; + seg->esc = 0; } else { + int escaped = 0; seg->type = NORMAL; seg->sep = QSE_T('\0'); seg->wild = 0; + seg->esc = 0; do { - if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + seg->len++; } while (!IS_SEP_OR_NIL(seg->ptr[seg->len])); @@ -165,14 +191,26 @@ static int get_next_segment (segment_t* seg) } else if (seg->type == ROOT) { + int escaped = 0; seg->type = NORMAL; seg->ptr = &seg->ptr[seg->len]; seg->len = 0; seg->sep = QSE_T('\0'); seg->wild = 0; + seg->esc = 0; + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) { - if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } seg->len++; } seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; @@ -184,17 +222,29 @@ static int get_next_segment (segment_t* seg) seg->ptr = &seg->ptr[seg->len + 1]; seg->len = 0; seg->wild = 0; + seg->esc = 0; if (IS_NIL(seg->ptr[-1])) { seg->type = NONE; seg->next = 0; + seg->sep = QSE_T('\0'); } else { + int escaped = 0; seg->sep = seg->ptr[-1]; while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) { - if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } seg->len++; } seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; @@ -204,29 +254,228 @@ static int get_next_segment (segment_t* seg) return seg->type; } -DIR* xopendir (glob_t* g, const qse_char_t* path) +#if defined(_WIN32) + +struct DIR { - if (path[0] == QSE_T('\0')) path = QSE_T("."); + HANDLE h; + WIN32_FIND_DATA wfd; +}; +typedef struct DIR DIR; -#if defined(QSE_CHAR_IS_MCHAR) - return opendir (path) -#else +#elif defined(__OS2__) + +struct DIR +{ + HDIR h; + FILEFINDBUF3L ffb; + ULONG count; +}; +typedef struct DIR DIR; + +#elif defined(__DOS__) +struct DIR +{ + int xxx; +}; +typedef struct DIR DIR; + +#endif + +static DIR* xopendir (glob_t* g, const qse_cstr_t* path) +{ +#if defined(_WIN32) + + /* ------------------------------------------------------------------- */ DIR* dp; - qse_mchar_t* mptr; - mptr = qse_wcstombsdup (path, g->mmgr); - if (mptr == QSE_NULL) return QSE_NULL; + dp = QSE_MMGR_ALLOC (g->mmgr, QSE_SIZEOF(*dp)); + if (dp == QSE_NULL) return QSE_NULL; - dp = opendir (mptr); + if (path->len <= 0) + { + if (qse_str_cpy (&g->segtmp, QSE_T("*")) == (qse_size_t)-1) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } + } + else + { + if (qse_str_cpy (&g->segtmp, path->ptr) == (qse_size_t)-1 || + (!IS_SEP(path->ptr[path->len-1]) && + !qse_isdrivecurpath(path->ptr) && + qse_str_ccat (&g->segtmp, QSE_T('\\')) == (qse_size_t)-1) || + qse_str_ccat (&g->segtmp, QSE_T('*')) == (qse_size_t)-1) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } + } - QSE_MMGR_FREE (g->mmgr, mptr); + dp->h = FindFirstFile (QSE_STR_PTR(&g->segtmp), &dp->wfd); + if (dp->h == INVALID_HANDLE_VALUE) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } return dp; + /* ------------------------------------------------------------------- */ + +#elif defined(__OS2__) + + /* ------------------------------------------------------------------- */ + DIR* dp; + APIRET rc; + qse_mchar_t* mptr; + + dp = QSE_MMGR_ALLOC (g->mmgr, QSE_SIZEOF(*dp)); + if (dp == QSE_NULL) return QSE_NULL; + + if (path->len <= 0) + { + if (qse_str_cpy (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } + } + else + { + if (qse_str_cpy (&g->segtmp, path->ptr) == (qse_size_t)-1 || + (!IS_SEP(path->ptr[path->len-1]) && + !qse_isdrivecurpath(path->ptr) && + qse_str_ccat (&g->segtmp, QSE_T('\\')) == (qse_size_t)-1) || + qse_str_cat (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } + } + + dp->h = HDIR_CREATE; + dp->count = 1; + +#if defined(QSE_CHAR_IS_MCHAR) + mptr = QSE_STR_PTR(&g->segtmp); +#else + mptr = qse_wcstombsdup (QSE_STR_PTR(&g->segtmp), g->mmgr); + if (mptr == QSE_NULL) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } +#endif + + rc = DosFindFirst ( + mptr, + &dp->h, + FILE_DIRECTORY | FILE_READONLY, + &dp->ffb, + QSE_SIZEOF(dp->ffb), + &dp->count, + FIL_STANDARDL); +#if defined(QSE_CHAR_IS_MCHAR) + /* nothing to do */ +#else + QSE_MMGR_FREE (g->mmgr, mptr); +#endif + if (rc != NO_ERROR) + { + QSE_MMGR_FREE (g->mmgr, dp); + return QSE_NULL; + } + + return dp; + /* ------------------------------------------------------------------- */ + +#elif defined(__DOS__) + + /* ------------------------------------------------------------------- */ + return QSE_NULL; + /* ------------------------------------------------------------------- */ + +#else + + /* ------------------------------------------------------------------- */ + +#if defined(QSE_CHAR_IS_MCHAR) + return opendir ((path->len <= 0)? p = QSE_T("."): path->ptr); +#else + if (path->len <= 0) + { + return opendir (QSE_MT(".")); + } + else + { + DIR* dp; + qse_mchar_t* mptr; + + mptr = qse_wcstombsdup (path->ptr, g->mmgr); + if (mptr == QSE_NULL) return QSE_NULL; + + dp = opendir (mptr); + + QSE_MMGR_FREE (g->mmgr, mptr); + + return dp; + } +#endif + /* ------------------------------------------------------------------- */ + #endif } -int xreaddir (glob_t* g, DIR* dp, qse_str_t* path) +static int xreaddir (glob_t* g, DIR* dp, qse_str_t* path) { +#if defined(_WIN32) + + /* ------------------------------------------------------------------- */ + if (qse_str_cat (path, dp->wfd.cFileName) == (qse_size_t)-1) return -1; + + if (FindNextFile (dp->h, &dp->wfd) == FALSE) + return (GetLastError() == ERROR_NO_MORE_FILES)? 0: -1; + + return 1; + /* ------------------------------------------------------------------- */ + +#elif defined(__OS2__) + + /* ------------------------------------------------------------------- */ + APIRET rc; +#if defined(QSE_CHAR_IS_MCHAR) + /* nothing */ +#else + qse_size_t ml, wl, tmp; +#endif + + if (dp->count <= 0) return 0; + +#if defined(QSE_CHAR_IS_MCHAR) + if (qse_str_cat (path, dp->ffb.achName) == (qse_size_t)-1) return -1; +#else + tmp = QSE_STR_LEN(path); + if (qse_mbstowcswithcmgr (dp->ffb.achName, &ml, QSE_NULL, &wl, g->cmgr) <= -1 || + qse_str_setlen (path, tmp + wl) == (qse_size_t)-1) return -1; + qse_mbstowcswithcmgr (dp->ffb.achName, &ml, QSE_STR_CPTR(&g->path,tmp), &wl, g->cmgr); +#endif + + rc = DosFindNext (dp->h, &dp->ffb, QSE_SIZEOF(dp->ffb), &dp->count); + if (rc != NO_ERROR) return -1; + + return 1; + /* ------------------------------------------------------------------- */ + +#elif defined(__DOS__) + + /* ------------------------------------------------------------------- */ + return -1; + /* ------------------------------------------------------------------- */ + +#else + + /* ------------------------------------------------------------------- */ struct dirent* de; #if defined(QSE_CHAR_IS_MCHAR) /* nothing */ @@ -238,8 +487,10 @@ read_more: de = readdir (dp); if (de == NULL) return 0; + /* if (qse_mbscmp (de->d_name, QSE_MT(".")) == 0 || qse_mbscmp (de->d_name, QSE_MT("..")) == 0) goto read_more; + */ #if defined(QSE_CHAR_IS_MCHAR) if (qse_str_cat (path, de->d_name) == (qse_size_t)-1) return -1; @@ -251,15 +502,32 @@ read_more: #endif return 1; + /* ------------------------------------------------------------------- */ + +#endif +} + +static void xclosedir (glob_t* g, DIR* dp) +{ +#if defined(_WIN32) + FindClose (dp->h); + QSE_MMGR_FREE (g->mmgr, dp); +#elif defined(__OS2__) + DosFindClose (dp->h); + QSE_MMGR_FREE (g->mmgr, dp); +#elif defined(__DOS__) + QSE_MMGR_FREE (g->mmgr, dp); +#else + closedir (dp); +#endif } static int search (glob_t* g, segment_t* seg) { segment_t save = *seg; g->depth++; -//wprintf (L"CALL DEPTH = %d\n", (int)g->depth); - while (get_next_segment(seg) != NONE) + while (get_next_segment(g, seg) != NONE) { QSE_ASSERT (seg->type != NONE); @@ -267,15 +535,18 @@ static int search (glob_t* g, segment_t* seg) { DIR* dp; -//wprintf (L"OPENDING %.*S\n", (int)QSE_STR_LEN(&g->path), QSE_STR_PTR(&g->path)); - dp = xopendir (g, QSE_STR_PTR(&g->path)); + dp = xopendir (g, QSE_STR_CSTR(&g->path)); if (dp) { qse_size_t tmp, tmp2; tmp = QSE_STR_LEN(&g->path); - if (seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) return -1; + if (seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) + { + xclosedir (g, dp); + return -1; + } tmp2 = QSE_STR_LEN(&g->path); while (1) @@ -286,35 +557,81 @@ static int search (glob_t* g, segment_t* seg) if (seg->next) { - if (qse_strnfnmat (QSE_STR_CPTR(&g->path,tmp2), seg->ptr, seg->len, 0) > 0 && - search (g, seg) <= -1) return -1; + if (qse_strnfnmat (QSE_STR_CPTR(&g->path,tmp2), seg->ptr, seg->len, g->fnmat_flags) > 0 && + search (g, seg) <= -1) + { + xclosedir (g, dp); + return -1; + } } else { -//wprintf (L"CHECKING %S [%.*S]\n", QSE_STR_CPTR(&g->path,tmp2), (int)seg->len, seg->ptr); - if (qse_strnfnmat (QSE_STR_CPTR(&g->path,tmp2), seg->ptr, seg->len, 0) > 0) + if (qse_strnfnmat (QSE_STR_CPTR(&g->path,tmp2), seg->ptr, seg->len, g->fnmat_flags) > 0) { - record_a_match (QSE_STR_PTR(&g->path)); + if (g->cbfun (QSE_STR_CSTR(&g->path), g->cbctx) <= -1) + { + xclosedir (g, dp); + return -1; + } + g->expanded = 1; } } } - qse_str_setlen (&g->path, tmp); /* TODO: error check */ - closedir (dp); -//wprintf (L"CLOSED %S\n", QSE_STR_PTR(&g->path)); + qse_str_setlen (&g->path, tmp); + xclosedir (g, dp); } break; } else { - if ((seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) || - qse_str_ncat (&g->path, seg->ptr, seg->len) == (qse_size_t)-1) return -1; + if (seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) return -1; + + if (seg->esc) + { + /* if the segment contains escape sequences, + * strip the escape letters off the segment */ + + qse_xstr_t tmp; + qse_size_t i; + int escaped = 0; + + if (QSE_STR_CAPA(&g->segtmp) < seg->len && + qse_str_setcapa (&g->segtmp, seg->len) == (qse_size_t)-1) return -1; + + tmp.ptr = QSE_STR_PTR(&g->segtmp); + tmp.len = 0; + + /* the following loop drops the last character + * if it is the escape character */ + for (i = 0; i < seg->len; i++) + { + if (escaped) + { + escaped = 0; + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + else + { + if (IS_ESC(seg->ptr[i])) + escaped = 1; + else + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + } + + if (qse_str_ncat (&g->path, tmp.ptr, tmp.len) == (qse_size_t)-1) return -1; + } + else + { + if (qse_str_ncat (&g->path, seg->ptr, seg->len) == (qse_size_t)-1) return -1; + } -//wprintf (L">> [%.*S]\n", (int)QSE_STR_LEN(&g->path), QSE_STR_PTR(&g->path)); if (!seg->next && path_exists(g, QSE_STR_PTR(&g->path))) { - record_a_match (QSE_STR_PTR(&g->path)); + if (g->cbfun (QSE_STR_CSTR(&g->path), g->cbctx) <= -1) return -1; + g->expanded = 1; } } } @@ -324,17 +641,31 @@ static int search (glob_t* g, segment_t* seg) return 0; } -int qse_globwithcmgr (const qse_char_t* pattern, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr) +int qse_globwithcmgr (const qse_char_t* pattern, qse_glob_cbfun_t cbfun, void* cbctx, int flags, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr) { segment_t seg; glob_t g; int x; QSE_MEMSET (&g, 0, QSE_SIZEOF(g)); + g.cbfun = cbfun; + g.cbctx = cbctx; g.mmgr = mmgr; g.cmgr = cmgr; +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE | QSE_STRFNMAT_IGNORECASE; +#else + if (flags & QSE_GLOB_NOESCAPE) g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE; +#endif + if (flags & QSE_GLOB_PERIOD) g.fnmat_flags |= QSE_STRFNMAT_PERIOD; + if (qse_str_init (&g.path, mmgr, 512) <= -1) return -1; + if (qse_str_init (&g.segtmp, mmgr, 256) <= -1) + { + qse_str_fini (&g.path); + return -1; + } QSE_MEMSET (&seg, 0, QSE_SIZEOF(seg)); seg.type = NONE; @@ -343,12 +674,15 @@ int qse_globwithcmgr (const qse_char_t* pattern, qse_mmgr_t* mmgr, qse_cmgr_t* c x = search (&g, &seg); + qse_str_fini (&g.segtmp); qse_str_fini (&g.path); - return x; + + if (x <= -1) return -1; + return g.expanded; } -int qse_glob (const qse_char_t* pattern, qse_mmgr_t* mmgr) +int qse_glob (const qse_char_t* pattern, qse_glob_cbfun_t cbfun, void* cbctx, int flags, qse_mmgr_t* mmgr) { - return qse_globwithcmgr (pattern, mmgr, qse_getdflcmgr()); + return qse_globwithcmgr (pattern, cbfun, cbctx, flags, mmgr, qse_getdflcmgr()); } diff --git a/qse/samples/cmn/glob01.c b/qse/samples/cmn/glob01.c index c36fad0e..6ecffdea 100644 --- a/qse/samples/cmn/glob01.c +++ b/qse/samples/cmn/glob01.c @@ -4,15 +4,36 @@ #include #include #include +#include + #include #if defined(_WIN32) # include #endif +static int print (const qse_cstr_t* path, void* ctx) +{ + qse_printf (QSE_T("%.*s\n"), (int)path->len, path->ptr); + return 0; +} + static int glob_main (int argc, qse_char_t* argv[]) { - return qse_glob (argv[1], QSE_MMGR_GETDFL()); + int i; + + if (argc <= 1) + { + qse_fprintf (QSE_STDERR, QSE_T("Usage: %S file-pattern ...\n"), qse_basename(argv[0])); + return -1; + } + + for (i = 1; i < argc; i++) + { + if (qse_glob (argv[i], print, QSE_NULL, QSE_GLOB_PERIOD, QSE_MMGR_GETDFL()) <= -1) return -1; + } + + return 0; } int qse_main (int argc, qse_achar_t* argv[]) diff --git a/qse/watcom/debug/dos32/lib/cmn/qsecmn.tgt b/qse/watcom/debug/dos32/lib/cmn/qsecmn.tgt index 3e399865..9e345fbf 100755 --- a/qse/watcom/debug/dos32/lib/cmn/qsecmn.tgt +++ b/qse/watcom/debug/dos32/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -81 +83 11 MItem 3 @@ -383,8 +383,8 @@ WVList 0 87 MItem -28 -../../../../../lib/cmn/htb.c +29 +../../../../../lib/cmn/glob.c 88 WString 4 @@ -401,8 +401,8 @@ WVList 0 91 MItem -29 -../../../../../lib/cmn/hton.c +28 +../../../../../lib/cmn/htb.c 92 WString 4 @@ -420,7 +420,7 @@ WVList 95 MItem 29 -../../../../../lib/cmn/ipad.c +../../../../../lib/cmn/hton.c 96 WString 4 @@ -437,8 +437,8 @@ WVList 0 99 MItem -28 -../../../../../lib/cmn/lda.c +29 +../../../../../lib/cmn/ipad.c 100 WString 4 @@ -455,8 +455,8 @@ WVList 0 103 MItem -29 -../../../../../lib/cmn/main.c +28 +../../../../../lib/cmn/lda.c 104 WString 4 @@ -473,8 +473,8 @@ WVList 0 107 MItem -33 -../../../../../lib/cmn/mbwc-str.c +29 +../../../../../lib/cmn/main.c 108 WString 4 @@ -491,8 +491,8 @@ WVList 0 111 MItem -29 -../../../../../lib/cmn/mbwc.c +33 +../../../../../lib/cmn/mbwc-str.c 112 WString 4 @@ -509,8 +509,8 @@ WVList 0 115 MItem -28 -../../../../../lib/cmn/mem.c +29 +../../../../../lib/cmn/mbwc.c 116 WString 4 @@ -527,8 +527,8 @@ WVList 0 119 MItem -29 -../../../../../lib/cmn/nwad.c +28 +../../../../../lib/cmn/mem.c 120 WString 4 @@ -546,7 +546,7 @@ WVList 123 MItem 29 -../../../../../lib/cmn/nwio.c +../../../../../lib/cmn/nwad.c 124 WString 4 @@ -563,8 +563,8 @@ WVList 0 127 MItem -28 -../../../../../lib/cmn/oht.c +29 +../../../../../lib/cmn/nwio.c 128 WString 4 @@ -582,7 +582,7 @@ WVList 131 MItem 28 -../../../../../lib/cmn/opt.c +../../../../../lib/cmn/oht.c 132 WString 4 @@ -599,8 +599,8 @@ WVList 0 135 MItem -38 -../../../../../lib/cmn/path-basename.c +28 +../../../../../lib/cmn/opt.c 136 WString 4 @@ -617,8 +617,8 @@ WVList 0 139 MItem -35 -../../../../../lib/cmn/path-canon.c +38 +../../../../../lib/cmn/path-basename.c 140 WString 4 @@ -635,8 +635,8 @@ WVList 0 143 MItem -28 -../../../../../lib/cmn/pio.c +35 +../../../../../lib/cmn/path-canon.c 144 WString 4 @@ -654,7 +654,7 @@ WVList 147 MItem 28 -../../../../../lib/cmn/pma.c +../../../../../lib/cmn/pio.c 148 WString 4 @@ -672,7 +672,7 @@ WVList 151 MItem 28 -../../../../../lib/cmn/rbt.c +../../../../../lib/cmn/pma.c 152 WString 4 @@ -690,7 +690,7 @@ WVList 155 MItem 28 -../../../../../lib/cmn/rex.c +../../../../../lib/cmn/rbt.c 156 WString 4 @@ -708,7 +708,7 @@ WVList 159 MItem 28 -../../../../../lib/cmn/sio.c +../../../../../lib/cmn/rex.c 160 WString 4 @@ -726,7 +726,7 @@ WVList 163 MItem 28 -../../../../../lib/cmn/sll.c +../../../../../lib/cmn/sio.c 164 WString 4 @@ -743,8 +743,8 @@ WVList 0 167 MItem -29 -../../../../../lib/cmn/slmb.c +28 +../../../../../lib/cmn/sll.c 168 WString 4 @@ -761,8 +761,8 @@ WVList 0 171 MItem -30 -../../../../../lib/cmn/stdio.c +29 +../../../../../lib/cmn/slmb.c 172 WString 4 @@ -779,8 +779,8 @@ WVList 0 175 MItem -32 -../../../../../lib/cmn/str-beg.c +30 +../../../../../lib/cmn/stdio.c 176 WString 4 @@ -798,7 +798,7 @@ WVList 179 MItem 32 -../../../../../lib/cmn/str-cat.c +../../../../../lib/cmn/str-beg.c 180 WString 4 @@ -816,7 +816,7 @@ WVList 183 MItem 32 -../../../../../lib/cmn/str-chr.c +../../../../../lib/cmn/str-cat.c 184 WString 4 @@ -834,7 +834,7 @@ WVList 187 MItem 32 -../../../../../lib/cmn/str-cmp.c +../../../../../lib/cmn/str-chr.c 188 WString 4 @@ -852,7 +852,7 @@ WVList 191 MItem 32 -../../../../../lib/cmn/str-cnv.c +../../../../../lib/cmn/str-cmp.c 192 WString 4 @@ -870,7 +870,7 @@ WVList 195 MItem 32 -../../../../../lib/cmn/str-cpy.c +../../../../../lib/cmn/str-cnv.c 196 WString 4 @@ -888,7 +888,7 @@ WVList 199 MItem 32 -../../../../../lib/cmn/str-del.c +../../../../../lib/cmn/str-cpy.c 200 WString 4 @@ -906,7 +906,7 @@ WVList 203 MItem 32 -../../../../../lib/cmn/str-dup.c +../../../../../lib/cmn/str-del.c 204 WString 4 @@ -923,8 +923,8 @@ WVList 0 207 MItem -33 -../../../../../lib/cmn/str-dynm.c +32 +../../../../../lib/cmn/str-dup.c 208 WString 4 @@ -942,7 +942,7 @@ WVList 211 MItem 33 -../../../../../lib/cmn/str-dynw.c +../../../../../lib/cmn/str-dynm.c 212 WString 4 @@ -959,8 +959,8 @@ WVList 0 215 MItem -32 -../../../../../lib/cmn/str-end.c +33 +../../../../../lib/cmn/str-dynw.c 216 WString 4 @@ -977,8 +977,8 @@ WVList 0 219 MItem -33 -../../../../../lib/cmn/str-excl.c +32 +../../../../../lib/cmn/str-end.c 220 WString 4 @@ -996,7 +996,7 @@ WVList 223 MItem 33 -../../../../../lib/cmn/str-fcpy.c +../../../../../lib/cmn/str-excl.c 224 WString 4 @@ -1014,7 +1014,7 @@ WVList 227 MItem 33 -../../../../../lib/cmn/str-incl.c +../../../../../lib/cmn/str-fcpy.c 228 WString 4 @@ -1031,8 +1031,8 @@ WVList 0 231 MItem -32 -../../../../../lib/cmn/str-len.c +34 +../../../../../lib/cmn/str-fnmat.c 232 WString 4 @@ -1049,8 +1049,8 @@ WVList 0 235 MItem -32 -../../../../../lib/cmn/str-pac.c +33 +../../../../../lib/cmn/str-incl.c 236 WString 4 @@ -1067,8 +1067,8 @@ WVList 0 239 MItem -33 -../../../../../lib/cmn/str-pbrk.c +32 +../../../../../lib/cmn/str-len.c 240 WString 4 @@ -1086,7 +1086,7 @@ WVList 243 MItem 32 -../../../../../lib/cmn/str-put.c +../../../../../lib/cmn/str-pac.c 244 WString 4 @@ -1103,8 +1103,8 @@ WVList 0 247 MItem -32 -../../../../../lib/cmn/str-rev.c +33 +../../../../../lib/cmn/str-pbrk.c 248 WString 4 @@ -1122,7 +1122,7 @@ WVList 251 MItem 32 -../../../../../lib/cmn/str-rot.c +../../../../../lib/cmn/str-put.c 252 WString 4 @@ -1140,7 +1140,7 @@ WVList 255 MItem 32 -../../../../../lib/cmn/str-set.c +../../../../../lib/cmn/str-rev.c 256 WString 4 @@ -1158,7 +1158,7 @@ WVList 259 MItem 32 -../../../../../lib/cmn/str-spl.c +../../../../../lib/cmn/str-rot.c 260 WString 4 @@ -1176,7 +1176,7 @@ WVList 263 MItem 32 -../../../../../lib/cmn/str-spn.c +../../../../../lib/cmn/str-set.c 264 WString 4 @@ -1194,7 +1194,7 @@ WVList 267 MItem 32 -../../../../../lib/cmn/str-str.c +../../../../../lib/cmn/str-spl.c 268 WString 4 @@ -1211,8 +1211,8 @@ WVList 0 271 MItem -34 -../../../../../lib/cmn/str-subst.c +32 +../../../../../lib/cmn/str-spn.c 272 WString 4 @@ -1230,7 +1230,7 @@ WVList 275 MItem 32 -../../../../../lib/cmn/str-tok.c +../../../../../lib/cmn/str-str.c 276 WString 4 @@ -1247,8 +1247,8 @@ WVList 0 279 MItem -32 -../../../../../lib/cmn/str-trm.c +34 +../../../../../lib/cmn/str-subst.c 280 WString 4 @@ -1265,8 +1265,8 @@ WVList 0 283 MItem -33 -../../../../../lib/cmn/str-word.c +32 +../../../../../lib/cmn/str-tok.c 284 WString 4 @@ -1283,8 +1283,8 @@ WVList 0 287 MItem -29 -../../../../../lib/cmn/time.c +32 +../../../../../lib/cmn/str-trm.c 288 WString 4 @@ -1301,8 +1301,8 @@ WVList 0 291 MItem -28 -../../../../../lib/cmn/tio.c +33 +../../../../../lib/cmn/str-word.c 292 WString 4 @@ -1319,8 +1319,8 @@ WVList 0 295 MItem -32 -../../../../../lib/cmn/tre-ast.c +29 +../../../../../lib/cmn/time.c 296 WString 4 @@ -1337,8 +1337,8 @@ WVList 0 299 MItem -36 -../../../../../lib/cmn/tre-compile.c +28 +../../../../../lib/cmn/tio.c 300 WString 4 @@ -1355,8 +1355,8 @@ WVList 0 303 MItem -44 -../../../../../lib/cmn/tre-match-backtrack.c +32 +../../../../../lib/cmn/tre-ast.c 304 WString 4 @@ -1373,8 +1373,8 @@ WVList 0 307 MItem -43 -../../../../../lib/cmn/tre-match-parallel.c +36 +../../../../../lib/cmn/tre-compile.c 308 WString 4 @@ -1391,8 +1391,8 @@ WVList 0 311 MItem -34 -../../../../../lib/cmn/tre-parse.c +44 +../../../../../lib/cmn/tre-match-backtrack.c 312 WString 4 @@ -1409,8 +1409,8 @@ WVList 0 315 MItem -34 -../../../../../lib/cmn/tre-stack.c +43 +../../../../../lib/cmn/tre-match-parallel.c 316 WString 4 @@ -1427,8 +1427,8 @@ WVList 0 319 MItem -28 -../../../../../lib/cmn/tre.c +34 +../../../../../lib/cmn/tre-parse.c 320 WString 4 @@ -1445,8 +1445,8 @@ WVList 0 323 MItem -29 -../../../../../lib/cmn/utf8.c +34 +../../../../../lib/cmn/tre-stack.c 324 WString 4 @@ -1464,7 +1464,7 @@ WVList 327 MItem 28 -../../../../../lib/cmn/xma.c +../../../../../lib/cmn/tre.c 328 WString 4 @@ -1481,44 +1481,44 @@ WVList 0 331 MItem -3 -*.h +29 +../../../../../lib/cmn/utf8.c 332 WString -3 -NIL +4 +COBJ 333 WVList 0 334 WVList 0 --1 +11 1 1 0 335 MItem 28 -../../../../../lib/cmn/mem.h +../../../../../lib/cmn/xma.c 336 WString -3 -NIL +4 +COBJ 337 WVList 0 338 WVList 0 -331 +11 1 1 0 339 MItem -32 -../../../../../lib/cmn/syscall.h +3 +*.h 340 WString 3 @@ -1529,7 +1529,43 @@ WVList 342 WVList 0 -331 +-1 +1 +1 +0 +343 +MItem +28 +../../../../../lib/cmn/mem.h +344 +WString +3 +NIL +345 +WVList +0 +346 +WVList +0 +339 +1 +1 +0 +347 +MItem +32 +../../../../../lib/cmn/syscall.h +348 +WString +3 +NIL +349 +WVList +0 +350 +WVList +0 +339 1 1 0 diff --git a/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt b/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt index 7de2f7a6..12274d8f 100755 --- a/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt +++ b/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -81 +83 11 MItem 3 @@ -395,8 +395,8 @@ WVList 0 90 MItem -28 -../../../../../lib/cmn/htb.c +29 +../../../../../lib/cmn/glob.c 91 WString 4 @@ -413,8 +413,8 @@ WVList 0 94 MItem -29 -../../../../../lib/cmn/hton.c +28 +../../../../../lib/cmn/htb.c 95 WString 4 @@ -432,7 +432,7 @@ WVList 98 MItem 29 -../../../../../lib/cmn/ipad.c +../../../../../lib/cmn/hton.c 99 WString 4 @@ -449,8 +449,8 @@ WVList 0 102 MItem -28 -../../../../../lib/cmn/lda.c +29 +../../../../../lib/cmn/ipad.c 103 WString 4 @@ -467,8 +467,8 @@ WVList 0 106 MItem -29 -../../../../../lib/cmn/main.c +28 +../../../../../lib/cmn/lda.c 107 WString 4 @@ -485,8 +485,8 @@ WVList 0 110 MItem -33 -../../../../../lib/cmn/mbwc-str.c +29 +../../../../../lib/cmn/main.c 111 WString 4 @@ -503,8 +503,8 @@ WVList 0 114 MItem -29 -../../../../../lib/cmn/mbwc.c +33 +../../../../../lib/cmn/mbwc-str.c 115 WString 4 @@ -521,8 +521,8 @@ WVList 0 118 MItem -28 -../../../../../lib/cmn/mem.c +29 +../../../../../lib/cmn/mbwc.c 119 WString 4 @@ -539,8 +539,8 @@ WVList 0 122 MItem -29 -../../../../../lib/cmn/nwad.c +28 +../../../../../lib/cmn/mem.c 123 WString 4 @@ -558,7 +558,7 @@ WVList 126 MItem 29 -../../../../../lib/cmn/nwio.c +../../../../../lib/cmn/nwad.c 127 WString 4 @@ -575,8 +575,8 @@ WVList 0 130 MItem -28 -../../../../../lib/cmn/oht.c +29 +../../../../../lib/cmn/nwio.c 131 WString 4 @@ -594,7 +594,7 @@ WVList 134 MItem 28 -../../../../../lib/cmn/opt.c +../../../../../lib/cmn/oht.c 135 WString 4 @@ -611,8 +611,8 @@ WVList 0 138 MItem -38 -../../../../../lib/cmn/path-basename.c +28 +../../../../../lib/cmn/opt.c 139 WString 4 @@ -629,8 +629,8 @@ WVList 0 142 MItem -35 -../../../../../lib/cmn/path-canon.c +38 +../../../../../lib/cmn/path-basename.c 143 WString 4 @@ -647,8 +647,8 @@ WVList 0 146 MItem -28 -../../../../../lib/cmn/pio.c +35 +../../../../../lib/cmn/path-canon.c 147 WString 4 @@ -666,7 +666,7 @@ WVList 150 MItem 28 -../../../../../lib/cmn/pma.c +../../../../../lib/cmn/pio.c 151 WString 4 @@ -684,7 +684,7 @@ WVList 154 MItem 28 -../../../../../lib/cmn/rbt.c +../../../../../lib/cmn/pma.c 155 WString 4 @@ -702,7 +702,7 @@ WVList 158 MItem 28 -../../../../../lib/cmn/rex.c +../../../../../lib/cmn/rbt.c 159 WString 4 @@ -720,7 +720,7 @@ WVList 162 MItem 28 -../../../../../lib/cmn/sio.c +../../../../../lib/cmn/rex.c 163 WString 4 @@ -738,7 +738,7 @@ WVList 166 MItem 28 -../../../../../lib/cmn/sll.c +../../../../../lib/cmn/sio.c 167 WString 4 @@ -755,8 +755,8 @@ WVList 0 170 MItem -29 -../../../../../lib/cmn/slmb.c +28 +../../../../../lib/cmn/sll.c 171 WString 4 @@ -773,8 +773,8 @@ WVList 0 174 MItem -30 -../../../../../lib/cmn/stdio.c +29 +../../../../../lib/cmn/slmb.c 175 WString 4 @@ -791,8 +791,8 @@ WVList 0 178 MItem -32 -../../../../../lib/cmn/str-beg.c +30 +../../../../../lib/cmn/stdio.c 179 WString 4 @@ -810,7 +810,7 @@ WVList 182 MItem 32 -../../../../../lib/cmn/str-cat.c +../../../../../lib/cmn/str-beg.c 183 WString 4 @@ -828,7 +828,7 @@ WVList 186 MItem 32 -../../../../../lib/cmn/str-chr.c +../../../../../lib/cmn/str-cat.c 187 WString 4 @@ -846,7 +846,7 @@ WVList 190 MItem 32 -../../../../../lib/cmn/str-cmp.c +../../../../../lib/cmn/str-chr.c 191 WString 4 @@ -864,7 +864,7 @@ WVList 194 MItem 32 -../../../../../lib/cmn/str-cnv.c +../../../../../lib/cmn/str-cmp.c 195 WString 4 @@ -882,7 +882,7 @@ WVList 198 MItem 32 -../../../../../lib/cmn/str-cpy.c +../../../../../lib/cmn/str-cnv.c 199 WString 4 @@ -900,7 +900,7 @@ WVList 202 MItem 32 -../../../../../lib/cmn/str-del.c +../../../../../lib/cmn/str-cpy.c 203 WString 4 @@ -918,7 +918,7 @@ WVList 206 MItem 32 -../../../../../lib/cmn/str-dup.c +../../../../../lib/cmn/str-del.c 207 WString 4 @@ -935,8 +935,8 @@ WVList 0 210 MItem -33 -../../../../../lib/cmn/str-dynm.c +32 +../../../../../lib/cmn/str-dup.c 211 WString 4 @@ -954,7 +954,7 @@ WVList 214 MItem 33 -../../../../../lib/cmn/str-dynw.c +../../../../../lib/cmn/str-dynm.c 215 WString 4 @@ -971,8 +971,8 @@ WVList 0 218 MItem -32 -../../../../../lib/cmn/str-end.c +33 +../../../../../lib/cmn/str-dynw.c 219 WString 4 @@ -989,8 +989,8 @@ WVList 0 222 MItem -33 -../../../../../lib/cmn/str-excl.c +32 +../../../../../lib/cmn/str-end.c 223 WString 4 @@ -1008,7 +1008,7 @@ WVList 226 MItem 33 -../../../../../lib/cmn/str-fcpy.c +../../../../../lib/cmn/str-excl.c 227 WString 4 @@ -1026,7 +1026,7 @@ WVList 230 MItem 33 -../../../../../lib/cmn/str-incl.c +../../../../../lib/cmn/str-fcpy.c 231 WString 4 @@ -1043,8 +1043,8 @@ WVList 0 234 MItem -32 -../../../../../lib/cmn/str-len.c +34 +../../../../../lib/cmn/str-fnmat.c 235 WString 4 @@ -1061,8 +1061,8 @@ WVList 0 238 MItem -32 -../../../../../lib/cmn/str-pac.c +33 +../../../../../lib/cmn/str-incl.c 239 WString 4 @@ -1079,8 +1079,8 @@ WVList 0 242 MItem -33 -../../../../../lib/cmn/str-pbrk.c +32 +../../../../../lib/cmn/str-len.c 243 WString 4 @@ -1098,7 +1098,7 @@ WVList 246 MItem 32 -../../../../../lib/cmn/str-put.c +../../../../../lib/cmn/str-pac.c 247 WString 4 @@ -1115,8 +1115,8 @@ WVList 0 250 MItem -32 -../../../../../lib/cmn/str-rev.c +33 +../../../../../lib/cmn/str-pbrk.c 251 WString 4 @@ -1134,7 +1134,7 @@ WVList 254 MItem 32 -../../../../../lib/cmn/str-rot.c +../../../../../lib/cmn/str-put.c 255 WString 4 @@ -1152,7 +1152,7 @@ WVList 258 MItem 32 -../../../../../lib/cmn/str-set.c +../../../../../lib/cmn/str-rev.c 259 WString 4 @@ -1170,7 +1170,7 @@ WVList 262 MItem 32 -../../../../../lib/cmn/str-spl.c +../../../../../lib/cmn/str-rot.c 263 WString 4 @@ -1188,7 +1188,7 @@ WVList 266 MItem 32 -../../../../../lib/cmn/str-spn.c +../../../../../lib/cmn/str-set.c 267 WString 4 @@ -1206,7 +1206,7 @@ WVList 270 MItem 32 -../../../../../lib/cmn/str-str.c +../../../../../lib/cmn/str-spl.c 271 WString 4 @@ -1223,8 +1223,8 @@ WVList 0 274 MItem -34 -../../../../../lib/cmn/str-subst.c +32 +../../../../../lib/cmn/str-spn.c 275 WString 4 @@ -1242,7 +1242,7 @@ WVList 278 MItem 32 -../../../../../lib/cmn/str-tok.c +../../../../../lib/cmn/str-str.c 279 WString 4 @@ -1259,8 +1259,8 @@ WVList 0 282 MItem -32 -../../../../../lib/cmn/str-trm.c +34 +../../../../../lib/cmn/str-subst.c 283 WString 4 @@ -1277,8 +1277,8 @@ WVList 0 286 MItem -33 -../../../../../lib/cmn/str-word.c +32 +../../../../../lib/cmn/str-tok.c 287 WString 4 @@ -1295,8 +1295,8 @@ WVList 0 290 MItem -29 -../../../../../lib/cmn/time.c +32 +../../../../../lib/cmn/str-trm.c 291 WString 4 @@ -1313,8 +1313,8 @@ WVList 0 294 MItem -28 -../../../../../lib/cmn/tio.c +33 +../../../../../lib/cmn/str-word.c 295 WString 4 @@ -1331,8 +1331,8 @@ WVList 0 298 MItem -32 -../../../../../lib/cmn/tre-ast.c +29 +../../../../../lib/cmn/time.c 299 WString 4 @@ -1349,8 +1349,8 @@ WVList 0 302 MItem -36 -../../../../../lib/cmn/tre-compile.c +28 +../../../../../lib/cmn/tio.c 303 WString 4 @@ -1367,8 +1367,8 @@ WVList 0 306 MItem -44 -../../../../../lib/cmn/tre-match-backtrack.c +32 +../../../../../lib/cmn/tre-ast.c 307 WString 4 @@ -1385,8 +1385,8 @@ WVList 0 310 MItem -43 -../../../../../lib/cmn/tre-match-parallel.c +36 +../../../../../lib/cmn/tre-compile.c 311 WString 4 @@ -1403,8 +1403,8 @@ WVList 0 314 MItem -34 -../../../../../lib/cmn/tre-parse.c +44 +../../../../../lib/cmn/tre-match-backtrack.c 315 WString 4 @@ -1421,8 +1421,8 @@ WVList 0 318 MItem -34 -../../../../../lib/cmn/tre-stack.c +43 +../../../../../lib/cmn/tre-match-parallel.c 319 WString 4 @@ -1439,8 +1439,8 @@ WVList 0 322 MItem -28 -../../../../../lib/cmn/tre.c +34 +../../../../../lib/cmn/tre-parse.c 323 WString 4 @@ -1457,8 +1457,8 @@ WVList 0 326 MItem -29 -../../../../../lib/cmn/utf8.c +34 +../../../../../lib/cmn/tre-stack.c 327 WString 4 @@ -1476,7 +1476,7 @@ WVList 330 MItem 28 -../../../../../lib/cmn/xma.c +../../../../../lib/cmn/tre.c 331 WString 4 @@ -1493,44 +1493,44 @@ WVList 0 334 MItem -3 -*.h +29 +../../../../../lib/cmn/utf8.c 335 WString -3 -NIL +4 +COBJ 336 WVList 0 337 WVList 0 --1 +11 1 1 0 338 MItem 28 -../../../../../lib/cmn/mem.h +../../../../../lib/cmn/xma.c 339 WString -3 -NIL +4 +COBJ 340 WVList 0 341 WVList 0 -334 +11 1 1 0 342 MItem -32 -../../../../../lib/cmn/syscall.h +3 +*.h 343 WString 3 @@ -1541,7 +1541,43 @@ WVList 345 WVList 0 -334 +-1 +1 +1 +0 +346 +MItem +28 +../../../../../lib/cmn/mem.h +347 +WString +3 +NIL +348 +WVList +0 +349 +WVList +0 +342 +1 +1 +0 +350 +MItem +32 +../../../../../lib/cmn/syscall.h +351 +WString +3 +NIL +352 +WVList +0 +353 +WVList +0 +342 1 1 0 diff --git a/qse/watcom/qse.wpj b/qse/watcom/qse.wpj index e7abe982..b9806763 100755 --- a/qse/watcom/qse.wpj +++ b/qse/watcom/qse.wpj @@ -5,7 +5,7 @@ VpeMain 1 WRect 440 -173 +160 9320 9680 2 @@ -80,7 +80,7 @@ WRect 2520 5700 4240 -1 +0 0 21 WFileName @@ -134,8 +134,8 @@ WRect WFileName 28 debug/os2/lib/cmn/qsecmn.tgt -10 -13 +45 +45 31 VComponent 32 @@ -188,18 +188,18 @@ debug/os2/cmd/awk/qseawk.tgt VComponent 41 WRect -2700 -1893 +2660 +66 5700 4240 -1 +0 0 42 WFileName 30 debug/dos32/lib/cmn/qsecmn.tgt 18 -23 +25 43 VComponent 44 @@ -272,12 +272,12 @@ WRect 0 5700 4240 -1 +0 0 57 WFileName 28 debug/os2/cmd/sed/qsesed.tgt 0 -0 -28 +1 +55 diff --git a/qse/watcom/release/os2/lib/cmn/qsecmn.tgt b/qse/watcom/release/os2/lib/cmn/qsecmn.tgt index d9d3e1cf..a864fe6c 100755 --- a/qse/watcom/release/os2/lib/cmn/qsecmn.tgt +++ b/qse/watcom/release/os2/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -79 +81 11 MItem 3 @@ -413,8 +413,8 @@ WVList 0 95 MItem -28 -../../../../../lib/cmn/htb.c +29 +../../../../../lib/cmn/glob.c 96 WString 4 @@ -431,8 +431,8 @@ WVList 0 99 MItem -29 -../../../../../lib/cmn/ipad.c +28 +../../../../../lib/cmn/htb.c 100 WString 4 @@ -449,8 +449,8 @@ WVList 0 103 MItem -28 -../../../../../lib/cmn/lda.c +29 +../../../../../lib/cmn/ipad.c 104 WString 4 @@ -467,8 +467,8 @@ WVList 0 107 MItem -29 -../../../../../lib/cmn/main.c +28 +../../../../../lib/cmn/lda.c 108 WString 4 @@ -485,8 +485,8 @@ WVList 0 111 MItem -33 -../../../../../lib/cmn/mbwc-str.c +29 +../../../../../lib/cmn/main.c 112 WString 4 @@ -503,8 +503,8 @@ WVList 0 115 MItem -29 -../../../../../lib/cmn/mbwc.c +33 +../../../../../lib/cmn/mbwc-str.c 116 WString 4 @@ -521,8 +521,8 @@ WVList 0 119 MItem -28 -../../../../../lib/cmn/mem.c +29 +../../../../../lib/cmn/mbwc.c 120 WString 4 @@ -539,8 +539,8 @@ WVList 0 123 MItem -29 -../../../../../lib/cmn/nwad.c +28 +../../../../../lib/cmn/mem.c 124 WString 4 @@ -558,7 +558,7 @@ WVList 127 MItem 29 -../../../../../lib/cmn/nwio.c +../../../../../lib/cmn/nwad.c 128 WString 4 @@ -575,8 +575,8 @@ WVList 0 131 MItem -28 -../../../../../lib/cmn/oht.c +29 +../../../../../lib/cmn/nwio.c 132 WString 4 @@ -594,7 +594,7 @@ WVList 135 MItem 28 -../../../../../lib/cmn/opt.c +../../../../../lib/cmn/oht.c 136 WString 4 @@ -611,8 +611,8 @@ WVList 0 139 MItem -38 -../../../../../lib/cmn/path-basename.c +28 +../../../../../lib/cmn/opt.c 140 WString 4 @@ -629,8 +629,8 @@ WVList 0 143 MItem -35 -../../../../../lib/cmn/path-canon.c +38 +../../../../../lib/cmn/path-basename.c 144 WString 4 @@ -647,8 +647,8 @@ WVList 0 147 MItem -28 -../../../../../lib/cmn/pio.c +35 +../../../../../lib/cmn/path-canon.c 148 WString 4 @@ -666,7 +666,7 @@ WVList 151 MItem 28 -../../../../../lib/cmn/pma.c +../../../../../lib/cmn/pio.c 152 WString 4 @@ -684,7 +684,7 @@ WVList 155 MItem 28 -../../../../../lib/cmn/rbt.c +../../../../../lib/cmn/pma.c 156 WString 4 @@ -702,7 +702,7 @@ WVList 159 MItem 28 -../../../../../lib/cmn/rex.c +../../../../../lib/cmn/rbt.c 160 WString 4 @@ -720,7 +720,7 @@ WVList 163 MItem 28 -../../../../../lib/cmn/sio.c +../../../../../lib/cmn/rex.c 164 WString 4 @@ -738,7 +738,7 @@ WVList 167 MItem 28 -../../../../../lib/cmn/sll.c +../../../../../lib/cmn/sio.c 168 WString 4 @@ -755,8 +755,8 @@ WVList 0 171 MItem -29 -../../../../../lib/cmn/slmb.c +28 +../../../../../lib/cmn/sll.c 172 WString 4 @@ -773,8 +773,8 @@ WVList 0 175 MItem -30 -../../../../../lib/cmn/stdio.c +29 +../../../../../lib/cmn/slmb.c 176 WString 4 @@ -791,8 +791,8 @@ WVList 0 179 MItem -32 -../../../../../lib/cmn/str-beg.c +30 +../../../../../lib/cmn/stdio.c 180 WString 4 @@ -810,7 +810,7 @@ WVList 183 MItem 32 -../../../../../lib/cmn/str-cat.c +../../../../../lib/cmn/str-beg.c 184 WString 4 @@ -828,7 +828,7 @@ WVList 187 MItem 32 -../../../../../lib/cmn/str-chr.c +../../../../../lib/cmn/str-cat.c 188 WString 4 @@ -846,7 +846,7 @@ WVList 191 MItem 32 -../../../../../lib/cmn/str-cmp.c +../../../../../lib/cmn/str-chr.c 192 WString 4 @@ -864,7 +864,7 @@ WVList 195 MItem 32 -../../../../../lib/cmn/str-cnv.c +../../../../../lib/cmn/str-cmp.c 196 WString 4 @@ -882,7 +882,7 @@ WVList 199 MItem 32 -../../../../../lib/cmn/str-cpy.c +../../../../../lib/cmn/str-cnv.c 200 WString 4 @@ -900,7 +900,7 @@ WVList 203 MItem 32 -../../../../../lib/cmn/str-del.c +../../../../../lib/cmn/str-cpy.c 204 WString 4 @@ -918,7 +918,7 @@ WVList 207 MItem 32 -../../../../../lib/cmn/str-dup.c +../../../../../lib/cmn/str-del.c 208 WString 4 @@ -935,8 +935,8 @@ WVList 0 211 MItem -33 -../../../../../lib/cmn/str-dynm.c +32 +../../../../../lib/cmn/str-dup.c 212 WString 4 @@ -954,7 +954,7 @@ WVList 215 MItem 33 -../../../../../lib/cmn/str-dynw.c +../../../../../lib/cmn/str-dynm.c 216 WString 4 @@ -971,8 +971,8 @@ WVList 0 219 MItem -32 -../../../../../lib/cmn/str-end.c +33 +../../../../../lib/cmn/str-dynw.c 220 WString 4 @@ -989,8 +989,8 @@ WVList 0 223 MItem -33 -../../../../../lib/cmn/str-excl.c +32 +../../../../../lib/cmn/str-end.c 224 WString 4 @@ -1008,7 +1008,7 @@ WVList 227 MItem 33 -../../../../../lib/cmn/str-fcpy.c +../../../../../lib/cmn/str-excl.c 228 WString 4 @@ -1026,7 +1026,7 @@ WVList 231 MItem 33 -../../../../../lib/cmn/str-incl.c +../../../../../lib/cmn/str-fcpy.c 232 WString 4 @@ -1043,8 +1043,8 @@ WVList 0 235 MItem -32 -../../../../../lib/cmn/str-len.c +34 +../../../../../lib/cmn/str-fnmat.c 236 WString 4 @@ -1061,8 +1061,8 @@ WVList 0 239 MItem -32 -../../../../../lib/cmn/str-pac.c +33 +../../../../../lib/cmn/str-incl.c 240 WString 4 @@ -1079,8 +1079,8 @@ WVList 0 243 MItem -33 -../../../../../lib/cmn/str-pbrk.c +32 +../../../../../lib/cmn/str-len.c 244 WString 4 @@ -1098,7 +1098,7 @@ WVList 247 MItem 32 -../../../../../lib/cmn/str-put.c +../../../../../lib/cmn/str-pac.c 248 WString 4 @@ -1115,8 +1115,8 @@ WVList 0 251 MItem -32 -../../../../../lib/cmn/str-rev.c +33 +../../../../../lib/cmn/str-pbrk.c 252 WString 4 @@ -1134,7 +1134,7 @@ WVList 255 MItem 32 -../../../../../lib/cmn/str-rot.c +../../../../../lib/cmn/str-put.c 256 WString 4 @@ -1152,7 +1152,7 @@ WVList 259 MItem 32 -../../../../../lib/cmn/str-set.c +../../../../../lib/cmn/str-rev.c 260 WString 4 @@ -1170,7 +1170,7 @@ WVList 263 MItem 32 -../../../../../lib/cmn/str-spl.c +../../../../../lib/cmn/str-rot.c 264 WString 4 @@ -1188,7 +1188,7 @@ WVList 267 MItem 32 -../../../../../lib/cmn/str-spn.c +../../../../../lib/cmn/str-set.c 268 WString 4 @@ -1206,7 +1206,7 @@ WVList 271 MItem 32 -../../../../../lib/cmn/str-str.c +../../../../../lib/cmn/str-spl.c 272 WString 4 @@ -1223,8 +1223,8 @@ WVList 0 275 MItem -34 -../../../../../lib/cmn/str-subst.c +32 +../../../../../lib/cmn/str-spn.c 276 WString 4 @@ -1242,7 +1242,7 @@ WVList 279 MItem 32 -../../../../../lib/cmn/str-tok.c +../../../../../lib/cmn/str-str.c 280 WString 4 @@ -1259,8 +1259,8 @@ WVList 0 283 MItem -32 -../../../../../lib/cmn/str-trm.c +34 +../../../../../lib/cmn/str-subst.c 284 WString 4 @@ -1277,8 +1277,8 @@ WVList 0 287 MItem -33 -../../../../../lib/cmn/str-word.c +32 +../../../../../lib/cmn/str-tok.c 288 WString 4 @@ -1295,8 +1295,8 @@ WVList 0 291 MItem -29 -../../../../../lib/cmn/time.c +32 +../../../../../lib/cmn/str-trm.c 292 WString 4 @@ -1313,8 +1313,8 @@ WVList 0 295 MItem -28 -../../../../../lib/cmn/tio.c +33 +../../../../../lib/cmn/str-word.c 296 WString 4 @@ -1331,8 +1331,8 @@ WVList 0 299 MItem -32 -../../../../../lib/cmn/tre-ast.c +29 +../../../../../lib/cmn/time.c 300 WString 4 @@ -1349,8 +1349,8 @@ WVList 0 303 MItem -36 -../../../../../lib/cmn/tre-compile.c +28 +../../../../../lib/cmn/tio.c 304 WString 4 @@ -1367,8 +1367,8 @@ WVList 0 307 MItem -44 -../../../../../lib/cmn/tre-match-backtrack.c +32 +../../../../../lib/cmn/tre-ast.c 308 WString 4 @@ -1385,8 +1385,8 @@ WVList 0 311 MItem -43 -../../../../../lib/cmn/tre-match-parallel.c +36 +../../../../../lib/cmn/tre-compile.c 312 WString 4 @@ -1403,8 +1403,8 @@ WVList 0 315 MItem -34 -../../../../../lib/cmn/tre-parse.c +44 +../../../../../lib/cmn/tre-match-backtrack.c 316 WString 4 @@ -1421,8 +1421,8 @@ WVList 0 319 MItem -34 -../../../../../lib/cmn/tre-stack.c +43 +../../../../../lib/cmn/tre-match-parallel.c 320 WString 4 @@ -1439,8 +1439,8 @@ WVList 0 323 MItem -28 -../../../../../lib/cmn/tre.c +34 +../../../../../lib/cmn/tre-parse.c 324 WString 4 @@ -1457,8 +1457,8 @@ WVList 0 327 MItem -29 -../../../../../lib/cmn/utf8.c +34 +../../../../../lib/cmn/tre-stack.c 328 WString 4 @@ -1476,7 +1476,7 @@ WVList 331 MItem 28 -../../../../../lib/cmn/xma.c +../../../../../lib/cmn/tre.c 332 WString 4 @@ -1493,44 +1493,44 @@ WVList 0 335 MItem -3 -*.h +29 +../../../../../lib/cmn/utf8.c 336 WString -3 -NIL +4 +COBJ 337 WVList 0 338 WVList 0 --1 +11 1 1 0 339 MItem 28 -../../../../../lib/cmn/mem.h +../../../../../lib/cmn/xma.c 340 WString -3 -NIL +4 +COBJ 341 WVList 0 342 WVList 0 -335 +11 1 1 0 343 MItem -32 -../../../../../lib/cmn/syscall.h +3 +*.h 344 WString 3 @@ -1541,7 +1541,43 @@ WVList 346 WVList 0 -335 +-1 +1 +1 +0 +347 +MItem +28 +../../../../../lib/cmn/mem.h +348 +WString +3 +NIL +349 +WVList +0 +350 +WVList +0 +343 +1 +1 +0 +351 +MItem +32 +../../../../../lib/cmn/syscall.h +352 +WString +3 +NIL +353 +WVList +0 +354 +WVList +0 +343 1 1 0