added in-place editing to sed command.
relocated files in lib/fs to lib/cmn
This commit is contained in:
parent
1f9de59543
commit
5bd21d36b2
@ -26,6 +26,7 @@
|
||||
#include <qse/cmn/sio.h>
|
||||
#include <qse/cmn/xma.h>
|
||||
#include <qse/cmn/path.h>
|
||||
#include <qse/cmn/fs.h>
|
||||
#include <qse/cmn/stdio.h>
|
||||
#include <qse/cmn/main.h>
|
||||
|
||||
@ -64,6 +65,7 @@ static qse_char_t* g_output_file = QSE_NULL;
|
||||
static int g_infile_pos = 0;
|
||||
static int g_option = 0;
|
||||
static int g_separate = 0;
|
||||
static int g_inplace = 0;
|
||||
#if defined(QSE_ENABLE_SEDTRACER)
|
||||
static int g_trace = 0;
|
||||
#endif
|
||||
@ -127,7 +129,8 @@ static void print_usage (QSE_FILE* out, int argc, qse_char_t* argv[])
|
||||
qse_fprintf (out, QSE_T(" -o file specify an output file\n"));
|
||||
qse_fprintf (out, QSE_T(" -r use the extended regular expression\n"));
|
||||
qse_fprintf (out, QSE_T(" -R enable non-standard extensions to the regular expression\n"));
|
||||
qse_fprintf (out, QSE_T(" -s processes input files separately\n"));
|
||||
qse_fprintf (out, QSE_T(" -i perform in-place editing. imply -s\n"));
|
||||
qse_fprintf (out, QSE_T(" -s process input files separately\n"));
|
||||
qse_fprintf (out, QSE_T(" -a perform strict address and label check\n"));
|
||||
qse_fprintf (out, QSE_T(" -w allow extended address formats\n"));
|
||||
qse_fprintf (out, QSE_T(" <start~step>,<start,+line>,<start,~line>,<0,/regex/>\n"));
|
||||
@ -196,9 +199,9 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
static qse_opt_t opt =
|
||||
{
|
||||
#if defined(QSE_BUILD_DEBUG)
|
||||
QSE_T("hne:f:o:rRsawxytm:X:"),
|
||||
QSE_T("hne:f:o:rRisawxytm:X:"),
|
||||
#else
|
||||
QSE_T("hne:f:o:rRsawxytm:"),
|
||||
QSE_T("hne:f:o:rRisawxytm:"),
|
||||
#endif
|
||||
QSE_NULL
|
||||
};
|
||||
@ -256,6 +259,10 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
g_option |= QSE_SED_NONSTDEXTREX;
|
||||
break;
|
||||
|
||||
case QSE_T('i'):
|
||||
/* 'i' implies 's'. */
|
||||
g_inplace = 1;
|
||||
|
||||
case QSE_T('s'):
|
||||
g_separate = 1;
|
||||
break;
|
||||
@ -327,7 +334,7 @@ void print_exec_error (qse_sed_t* sed)
|
||||
if (errloc->line > 0 || errloc->colm > 0)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("cannot execute - %s at line %lu column %lu\n"),
|
||||
QSE_T("ERROR: cannot execute - %s at line %lu column %lu\n"),
|
||||
qse_sed_geterrmsg(sed),
|
||||
(unsigned long)errloc->line,
|
||||
(unsigned long)errloc->colm
|
||||
@ -336,7 +343,7 @@ void print_exec_error (qse_sed_t* sed)
|
||||
else
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("cannot execute - %s\n"),
|
||||
QSE_T("ERROR: cannot execute - %s\n"),
|
||||
qse_sed_geterrmsg(sed)
|
||||
);
|
||||
}
|
||||
@ -500,6 +507,7 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
{
|
||||
qse_mmgr_t* mmgr = QSE_NULL;
|
||||
qse_sed_t* sed = QSE_NULL;
|
||||
qse_fs_t* fs = QSE_NULL;
|
||||
qse_size_t script_count;
|
||||
int ret = -1;
|
||||
|
||||
@ -528,10 +536,29 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
mmgr = &xma_mmgr;
|
||||
}
|
||||
|
||||
if (g_separate && g_infile_pos > 0 && g_inplace)
|
||||
{
|
||||
fs = qse_fs_open (mmgr, 0);
|
||||
if (fs == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open file system handler\n"));
|
||||
goto oops;
|
||||
}
|
||||
|
||||
if (qse_fs_chdir (fs, QSE_T(".")) <= -1)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot change direcotry in file system handler - %s\n"),
|
||||
qse_fs_geterrmsg(fs)
|
||||
);
|
||||
goto oops;
|
||||
}
|
||||
}
|
||||
|
||||
sed = qse_sed_openstdwithmmgr (mmgr, 0);
|
||||
if (sed == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("cannot open a stream editor\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
||||
goto oops;
|
||||
}
|
||||
|
||||
@ -559,7 +586,7 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
if (errloc->line > 0 || errloc->colm > 0)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("cannot compile %s - %s at line %lu column %lu\n"),
|
||||
QSE_T("ERROR: cannot compile %s - %s at line %lu column %lu\n"),
|
||||
target,
|
||||
qse_sed_geterrmsg(sed),
|
||||
(unsigned long)errloc->line,
|
||||
@ -569,7 +596,7 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
else
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("cannot compile %s - %s\n"),
|
||||
QSE_T("ERROR: cannot compile %s - %s\n"),
|
||||
target,
|
||||
qse_sed_geterrmsg(sed)
|
||||
);
|
||||
@ -583,14 +610,18 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
|
||||
if (g_separate && g_infile_pos > 0)
|
||||
{
|
||||
qse_sed_iostd_t out;
|
||||
/* '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;
|
||||
|
||||
if (g_output_file &&
|
||||
qse_strcmp (g_output_file, QSE_T("-")) != 0)
|
||||
{
|
||||
out.type = QSE_SED_IOSTD_SIO;
|
||||
out.u.sio = qse_sio_open (
|
||||
out_file.type = QSE_SED_IOSTD_SIO;
|
||||
out_file.u.sio = qse_sio_open (
|
||||
qse_sed_getmmgr(sed),
|
||||
0,
|
||||
g_output_file,
|
||||
@ -599,18 +630,20 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
QSE_SIO_TRUNCATE |
|
||||
QSE_SIO_IGNOREMBWCERR
|
||||
);
|
||||
if (out.u.sio == QSE_NULL)
|
||||
if (out_file.u.sio == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("cannot open %s\n"), g_output_file);
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), g_output_file);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
output = &out;
|
||||
output_file = &out_file;
|
||||
output = output_file;
|
||||
}
|
||||
|
||||
while (g_infile_pos < argc)
|
||||
{
|
||||
qse_sed_iostd_t in[2];
|
||||
qse_char_t* tmpl_tmpfile;
|
||||
|
||||
in[0].type = QSE_SED_IOSTD_FILE;
|
||||
in[0].u.file =
|
||||
@ -618,13 +651,70 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
QSE_NULL: argv[g_infile_pos];
|
||||
in[1].type = QSE_SED_IOSTD_NULL;
|
||||
|
||||
tmpl_tmpfile = QSE_NULL;
|
||||
if (g_inplace && in[0].u.file)
|
||||
{
|
||||
tmpl_tmpfile = qse_strdup2 (in[0].u.file, QSE_T(".XXXX"), qse_sed_getmmgr(sed));
|
||||
if (tmpl_tmpfile == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
|
||||
goto oops;
|
||||
}
|
||||
|
||||
out_inplace.type = QSE_SED_IOSTD_SIO;
|
||||
out_inplace.u.sio = qse_sio_open (
|
||||
qse_sed_getmmgr(sed),
|
||||
0,
|
||||
tmpl_tmpfile,
|
||||
QSE_SIO_WRITE |
|
||||
QSE_SIO_CREATE |
|
||||
QSE_SIO_IGNOREMBWCERR |
|
||||
QSE_SIO_EXCLUSIVE |
|
||||
QSE_SIO_TEMPORARY
|
||||
);
|
||||
if (out_inplace.u.sio == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), tmpl_tmpfile);
|
||||
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
output = &out_inplace;
|
||||
}
|
||||
|
||||
if (qse_sed_execstd (sed, in, output) <= -1)
|
||||
{
|
||||
if (output) qse_sio_close (output->u.sio);
|
||||
|
||||
if (tmpl_tmpfile)
|
||||
{
|
||||
/*
|
||||
TODO:
|
||||
qse_fs_remove (fs, tmpl_tmpfile);
|
||||
*/
|
||||
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
||||
}
|
||||
print_exec_error (sed);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
if (tmpl_tmpfile)
|
||||
{
|
||||
QSE_ASSERT (output == &out_inplace);
|
||||
qse_sio_close (output->u.sio);
|
||||
output = output_file;
|
||||
|
||||
if (qse_fs_move (fs, tmpl_tmpfile, in[0].u.file) <= -1)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot rename %s to %s. not deleting %s - %s\n"),
|
||||
tmpl_tmpfile, in[0].u.file, tmpl_tmpfile, qse_fs_geterrmsg(fs));
|
||||
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
||||
}
|
||||
|
||||
if (qse_sed_isstop (sed)) break;
|
||||
|
||||
g_infile_pos++;
|
||||
@ -642,11 +732,13 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
{
|
||||
int i, num_ins;
|
||||
|
||||
/* input files are specified on the command line */
|
||||
|
||||
num_ins = argc - g_infile_pos;
|
||||
in = QSE_MMGR_ALLOC (qse_sed_getmmgr(sed), QSE_SIZEOF(*in) * (num_ins + 1));
|
||||
if (in == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("out of memory\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
|
||||
goto oops;
|
||||
}
|
||||
|
||||
@ -688,6 +780,7 @@ int sed_main (int argc, qse_char_t* argv[])
|
||||
|
||||
oops:
|
||||
if (sed) qse_sed_close (sed);
|
||||
if (fs) qse_fs_close (fs);
|
||||
if (xma_mmgr.ctx) qse_xma_close (xma_mmgr.ctx);
|
||||
free_scripts ();
|
||||
return ret;
|
||||
|
5
qse/configure
vendored
5
qse/configure
vendored
@ -17582,7 +17582,7 @@ QSE_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
|
||||
QSE_PROJECT_URL="${PACKAGE_URL}"
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/fs/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/fs/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/fs/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile"
|
||||
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -18682,7 +18682,6 @@ do
|
||||
"include/qse/cut/Makefile") CONFIG_FILES="$CONFIG_FILES include/qse/cut/Makefile" ;;
|
||||
"include/qse/sed/Makefile") CONFIG_FILES="$CONFIG_FILES include/qse/sed/Makefile" ;;
|
||||
"include/qse/stx/Makefile") CONFIG_FILES="$CONFIG_FILES include/qse/stx/Makefile" ;;
|
||||
"include/qse/fs/Makefile") CONFIG_FILES="$CONFIG_FILES include/qse/fs/Makefile" ;;
|
||||
"include/qse/net/Makefile") CONFIG_FILES="$CONFIG_FILES include/qse/net/Makefile" ;;
|
||||
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
|
||||
"lib/cmn/Makefile") CONFIG_FILES="$CONFIG_FILES lib/cmn/Makefile" ;;
|
||||
@ -18690,7 +18689,6 @@ do
|
||||
"lib/cut/Makefile") CONFIG_FILES="$CONFIG_FILES lib/cut/Makefile" ;;
|
||||
"lib/sed/Makefile") CONFIG_FILES="$CONFIG_FILES lib/sed/Makefile" ;;
|
||||
"lib/stx/Makefile") CONFIG_FILES="$CONFIG_FILES lib/stx/Makefile" ;;
|
||||
"lib/fs/Makefile") CONFIG_FILES="$CONFIG_FILES lib/fs/Makefile" ;;
|
||||
"lib/net/Makefile") CONFIG_FILES="$CONFIG_FILES lib/net/Makefile" ;;
|
||||
"cmd/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/Makefile" ;;
|
||||
"cmd/awk/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/awk/Makefile" ;;
|
||||
@ -18702,7 +18700,6 @@ do
|
||||
"samples/awk/Makefile") CONFIG_FILES="$CONFIG_FILES samples/awk/Makefile" ;;
|
||||
"samples/cut/Makefile") CONFIG_FILES="$CONFIG_FILES samples/cut/Makefile" ;;
|
||||
"samples/sed/Makefile") CONFIG_FILES="$CONFIG_FILES samples/sed/Makefile" ;;
|
||||
"samples/fs/Makefile") CONFIG_FILES="$CONFIG_FILES samples/fs/Makefile" ;;
|
||||
"samples/net/Makefile") CONFIG_FILES="$CONFIG_FILES samples/net/Makefile" ;;
|
||||
"regress/Makefile") CONFIG_FILES="$CONFIG_FILES regress/Makefile" ;;
|
||||
"regress/awk/Makefile") CONFIG_FILES="$CONFIG_FILES regress/awk/Makefile" ;;
|
||||
|
@ -273,7 +273,6 @@ AC_CONFIG_FILES([
|
||||
include/qse/cut/Makefile
|
||||
include/qse/sed/Makefile
|
||||
include/qse/stx/Makefile
|
||||
include/qse/fs/Makefile
|
||||
include/qse/net/Makefile
|
||||
lib/Makefile
|
||||
lib/cmn/Makefile
|
||||
@ -281,7 +280,6 @@ AC_CONFIG_FILES([
|
||||
lib/cut/Makefile
|
||||
lib/sed/Makefile
|
||||
lib/stx/Makefile
|
||||
lib/fs/Makefile
|
||||
lib/net/Makefile
|
||||
cmd/Makefile
|
||||
cmd/awk/Makefile
|
||||
@ -293,7 +291,6 @@ AC_CONFIG_FILES([
|
||||
samples/awk/Makefile
|
||||
samples/cut/Makefile
|
||||
samples/sed/Makefile
|
||||
samples/fs/Makefile
|
||||
samples/net/Makefile
|
||||
regress/Makefile
|
||||
regress/awk/Makefile
|
||||
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS = cmn awk cut sed fs net stx
|
||||
SUBDIRS = cmn awk cut sed net stx
|
||||
|
||||
pkgincludedir = $(includedir)/qse
|
||||
|
||||
|
@ -259,7 +259,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = cmn awk cut sed fs net stx
|
||||
SUBDIRS = cmn awk cut sed net stx
|
||||
pkginclude_HEADERS = conf_msw.h conf_os2.h conf_dos.h conf_vms.h \
|
||||
types.h macros.h pack1.h unpack.h $(am__append_1)
|
||||
all: config.h
|
||||
|
@ -8,6 +8,7 @@ pkginclude_HEADERS = \
|
||||
fio.h \
|
||||
fma.h \
|
||||
fmt.h \
|
||||
fs.h \
|
||||
gdl.h \
|
||||
htb.h \
|
||||
lda.h \
|
||||
|
@ -52,9 +52,9 @@ CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
|
||||
fmt.h gdl.h htb.h lda.h main.h map.h mem.h oht.h opt.h path.h \
|
||||
pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h \
|
||||
tre.h utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
|
||||
fmt.h fs.h gdl.h htb.h lda.h main.h map.h mem.h oht.h opt.h \
|
||||
path.h pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h \
|
||||
time.h tio.h tre.h utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
@ -223,9 +223,9 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h gdl.h \
|
||||
htb.h lda.h main.h map.h mem.h oht.h opt.h path.h pio.h pma.h \
|
||||
rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h \
|
||||
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h fs.h \
|
||||
gdl.h htb.h lda.h main.h map.h mem.h oht.h opt.h path.h pio.h \
|
||||
pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h \
|
||||
utf8.h xma.h $(am__append_1)
|
||||
all: all-am
|
||||
|
||||
|
169
qse/include/qse/cmn/fs.h
Normal file
169
qse/include/qse/cmn/fs.h
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _QSE_CMN_FS_H_
|
||||
#define _QSE_CMN_FS_H_
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
#include <qse/cmn/time.h>
|
||||
|
||||
enum qse_fs_errnum_t
|
||||
{
|
||||
QSE_FS_ENOERR = 0,
|
||||
QSE_FS_EINTERN,
|
||||
|
||||
QSE_FS_ENOMEM,
|
||||
QSE_FS_EINVAL,
|
||||
QSE_FS_EACCES,
|
||||
QSE_FS_ENOENT,
|
||||
QSE_FS_ENODIR,
|
||||
QSE_FS_EEXIST,
|
||||
QSE_FS_ESYSTEM
|
||||
};
|
||||
typedef enum qse_fs_errnum_t qse_fs_errnum_t;
|
||||
|
||||
enum qse_fs_ent_flag_t
|
||||
{
|
||||
QSE_FS_ENT_NAME = (1 << 0),
|
||||
QSE_FS_ENT_TYPE = (1 << 1),
|
||||
QSE_FS_ENT_SIZE = (1 << 2),
|
||||
QSE_FS_ENT_TIME = (1 << 3)
|
||||
};
|
||||
|
||||
enum qse_fs_ent_type_t
|
||||
{
|
||||
QSE_FS_ENT_UNKNOWN,
|
||||
QSE_FS_ENT_SUBDIR,
|
||||
QSE_FS_ENT_REGULAR,
|
||||
QSE_FS_ENT_CHRDEV,
|
||||
QSE_FS_ENT_BLKDEV,
|
||||
QSE_FS_ENT_SYMLINK,
|
||||
QSE_FS_ENT_PIPE
|
||||
};
|
||||
|
||||
typedef enum qse_fs_ent_type_t qse_fs_ent_type_t;
|
||||
|
||||
struct qse_fs_ent_t
|
||||
{
|
||||
int flags;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_char_t* base;
|
||||
qse_char_t* path;
|
||||
} name;
|
||||
qse_fs_ent_type_t type;
|
||||
qse_foff_t size;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_ntime_t create;
|
||||
qse_ntime_t access;
|
||||
qse_ntime_t modify;
|
||||
qse_ntime_t change; /* inode status change */
|
||||
} time;
|
||||
};
|
||||
|
||||
typedef struct qse_fs_ent_t qse_fs_ent_t;
|
||||
|
||||
struct qse_fs_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (fs)
|
||||
qse_fs_errnum_t errnum;
|
||||
qse_fs_ent_t ent;
|
||||
qse_char_t* curdir;
|
||||
void* info;
|
||||
};
|
||||
|
||||
typedef struct qse_fs_t qse_fs_t;
|
||||
|
||||
enum qse_fs_option_t
|
||||
{
|
||||
/**< don't follow a symbolic link in qse_fs_chdir() */
|
||||
QSE_FS_NOFOLLOW = (1 << 1),
|
||||
|
||||
/**< check directories against file system in qse_fs_chdir() */
|
||||
QSE_FS_REALPATH = (1 << 2)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (fs)
|
||||
|
||||
qse_fs_t* qse_fs_open (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
void qse_fs_close (
|
||||
qse_fs_t* fs
|
||||
);
|
||||
|
||||
int qse_fs_init (
|
||||
qse_fs_t* fs,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
void qse_fs_fini (
|
||||
qse_fs_t* fs
|
||||
);
|
||||
|
||||
qse_fs_errnum_t qse_fs_geterrnum (
|
||||
qse_fs_t* fs
|
||||
);
|
||||
|
||||
const qse_char_t* qse_fs_geterrmsg (
|
||||
qse_fs_t* fs
|
||||
);
|
||||
|
||||
qse_fs_ent_t* qse_fs_read (
|
||||
qse_fs_t* fs,
|
||||
int flags
|
||||
);
|
||||
|
||||
int qse_fs_chdir (
|
||||
qse_fs_t* fs,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
int qse_fs_push (
|
||||
qse_fs_t* fs,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
int qse_fs_pop (
|
||||
qse_fs_t* fs,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
int qse_fs_move (
|
||||
qse_fs_t* fs,
|
||||
const qse_char_t* oldpath,
|
||||
const qse_char_t* newpath
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
pkgincludedir= $(includedir)/qse/fs
|
||||
pkginclude_HEADERS = dir.h
|
||||
|
||||
|
@ -1,480 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = include/qse/fs
|
||||
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
|
||||
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
|
||||
HEADERS = $(pkginclude_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgincludedir = $(includedir)/qse/fs
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_MODE = @BUILD_MODE@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHAR_MODE = @CHAR_MODE@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_CXX = @HAVE_CXX@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PTHREAD_CC = @PTHREAD_CC@
|
||||
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
|
||||
PTHREAD_LIBS = @PTHREAD_LIBS@
|
||||
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
|
||||
QSE_PROJECT_URL = @QSE_PROJECT_URL@
|
||||
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
|
||||
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
|
||||
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
|
||||
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
|
||||
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
|
||||
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
|
||||
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
|
||||
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
|
||||
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
|
||||
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@
|
||||
RMDIR = @RMDIR@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TRUE = @TRUE@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
ax_pthread_config = @ax_pthread_config@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkginclude_HEADERS = dir.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/qse/fs/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign include/qse/fs/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-pkgincludeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool ctags distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-pkgincludeHEADERS install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-pkgincludeHEADERS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _QSE_FS_DIR_H_
|
||||
#define _QSE_FS_DIR_H_
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
#include <qse/cmn/time.h>
|
||||
|
||||
enum qse_dir_errnum_t
|
||||
{
|
||||
QSE_DIR_ENOERR = 0,
|
||||
QSE_DIR_EINTERN,
|
||||
|
||||
QSE_DIR_ENOMEM,
|
||||
QSE_DIR_EINVAL,
|
||||
QSE_DIR_EACCES,
|
||||
QSE_DIR_ENOENT,
|
||||
QSE_DIR_ENODIR,
|
||||
QSE_DIR_ESYSTEM
|
||||
};
|
||||
typedef enum qse_dir_errnum_t qse_dir_errnum_t;
|
||||
|
||||
enum qse_dir_ent_flag_t
|
||||
{
|
||||
QSE_DIR_ENT_NAME = (1 << 0),
|
||||
QSE_DIR_ENT_TYPE = (1 << 1),
|
||||
QSE_DIR_ENT_SIZE = (1 << 2),
|
||||
QSE_DIR_ENT_TIME = (1 << 3)
|
||||
};
|
||||
|
||||
enum qse_dir_ent_type_t
|
||||
{
|
||||
QSE_DIR_ENT_UNKNOWN,
|
||||
QSE_DIR_ENT_SUBDIR,
|
||||
QSE_DIR_ENT_REGULAR,
|
||||
QSE_DIR_ENT_CHRDEV,
|
||||
QSE_DIR_ENT_BLKDEV,
|
||||
QSE_DIR_ENT_SYMLINK,
|
||||
QSE_DIR_ENT_PIPE
|
||||
};
|
||||
|
||||
typedef enum qse_dir_ent_type_t qse_dir_ent_type_t;
|
||||
|
||||
struct qse_dir_ent_t
|
||||
{
|
||||
int flags;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_char_t* base;
|
||||
qse_char_t* path;
|
||||
} name;
|
||||
qse_dir_ent_type_t type;
|
||||
qse_foff_t size;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_ntime_t create;
|
||||
qse_ntime_t access;
|
||||
qse_ntime_t modify;
|
||||
qse_ntime_t change; /* inode status change */
|
||||
} time;
|
||||
};
|
||||
|
||||
typedef struct qse_dir_ent_t qse_dir_ent_t;
|
||||
|
||||
struct qse_dir_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (dir)
|
||||
qse_dir_errnum_t errnum;
|
||||
qse_dir_ent_t ent;
|
||||
qse_char_t* curdir;
|
||||
void* info;
|
||||
};
|
||||
|
||||
typedef struct qse_dir_t qse_dir_t;
|
||||
|
||||
enum qse_dir_option_t
|
||||
{
|
||||
/**< don't follow a symbolic link in qse_dir_change() */
|
||||
QSE_DIR_NOFOLLOW = (1 << 1),
|
||||
|
||||
/**< check directories against file system in qse_dir_change() */
|
||||
QSE_DIR_REALPATH = (1 << 2)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (dir)
|
||||
|
||||
qse_dir_t* qse_dir_open (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
void qse_dir_close (
|
||||
qse_dir_t* dir
|
||||
);
|
||||
|
||||
int qse_dir_init (
|
||||
qse_dir_t* dir,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
void qse_dir_fini (
|
||||
qse_dir_t* dir
|
||||
);
|
||||
|
||||
qse_dir_errnum_t qse_dir_geterrnum (
|
||||
qse_dir_t* dir
|
||||
);
|
||||
|
||||
const qse_char_t* qse_dir_geterrmsg (
|
||||
qse_dir_t* dir
|
||||
);
|
||||
|
||||
qse_dir_ent_t* qse_dir_read (
|
||||
qse_dir_t* dir,
|
||||
int flags
|
||||
);
|
||||
|
||||
int qse_dir_change (
|
||||
qse_dir_t* dir,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
int qse_dir_push (
|
||||
qse_dir_t* dir,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
int qse_dir_pop (
|
||||
qse_dir_t* dir,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,2 +0,0 @@
|
||||
pkgincludedir= $(includedir)/qse/scm
|
||||
pkginclude_HEADERS = scm.h
|
@ -1,475 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = include/qse/scm
|
||||
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
|
||||
HEADERS = $(pkginclude_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgincludedir = $(includedir)/qse/scm
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_MODE = @BUILD_MODE@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHAR_MODE = @CHAR_MODE@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_CXX = @HAVE_CXX@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
|
||||
QSE_PROJECT_URL = @QSE_PROJECT_URL@
|
||||
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
|
||||
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
|
||||
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
|
||||
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
|
||||
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
|
||||
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
|
||||
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
|
||||
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
|
||||
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
|
||||
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@
|
||||
RMDIR = @RMDIR@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TRUE = @TRUE@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkginclude_HEADERS = scm.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/qse/scm/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign include/qse/scm/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-pkgincludeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool ctags distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-pkgincludeHEADERS install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-pkgincludeHEADERS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
@ -1,320 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _QSE_SCM_SCM_H_
|
||||
#define _QSE_SCM_SCM_H_
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
/** @file
|
||||
* The file provides interface to a scheme interpreter.
|
||||
*/
|
||||
|
||||
typedef struct qse_scm_t qse_scm_t;
|
||||
typedef struct qse_scm_ent_t qse_scm_ent_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_loc_t defines a structure to store location information.
|
||||
*/
|
||||
struct qse_scm_loc_t
|
||||
{
|
||||
const qse_char_t* file; /**< file */
|
||||
qse_size_t line; /**< line */
|
||||
qse_size_t colm; /**< column */
|
||||
};
|
||||
typedef struct qse_scm_loc_t qse_scm_loc_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_io_cmd_t type defines I/O commands.
|
||||
*/
|
||||
enum qse_scm_io_cmd_t
|
||||
{
|
||||
QSE_SCM_IO_OPEN = 0,
|
||||
QSE_SCM_IO_CLOSE = 1,
|
||||
QSE_SCM_IO_READ = 2,
|
||||
QSE_SCM_IO_WRITE = 3
|
||||
};
|
||||
typedef enum qse_scm_io_cmd_t qse_scm_io_cmd_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_io_arg_t type defines a data structure for an I/O handler.
|
||||
*/
|
||||
struct qse_scm_io_arg_t
|
||||
{
|
||||
void* handle;
|
||||
const qse_char_t* path;
|
||||
};
|
||||
typedef struct qse_scm_io_arg_t qse_scm_io_arg_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_io_fun_t type defines an I/O handler function.
|
||||
*/
|
||||
typedef qse_ssize_t (*qse_scm_io_fun_t) (
|
||||
qse_scm_t* scm,
|
||||
qse_scm_io_cmd_t cmd,
|
||||
qse_scm_io_arg_t* arg,
|
||||
qse_char_t* data,
|
||||
qse_size_t count
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_io_t type defines a I/O handler set.
|
||||
*/
|
||||
struct qse_scm_io_t
|
||||
{
|
||||
qse_scm_io_fun_t in;
|
||||
qse_scm_io_fun_t out;
|
||||
};
|
||||
typedef struct qse_scm_io_t qse_scm_io_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_errnum_t type defines error numbers.
|
||||
*/
|
||||
enum qse_scm_errnum_t
|
||||
{
|
||||
QSE_SCM_ENOERR,
|
||||
QSE_SCM_ENOMEM,
|
||||
QSE_SCM_EINTERN,
|
||||
|
||||
QSE_SCM_EEXIT,
|
||||
QSE_SCM_EEND,
|
||||
|
||||
QSE_SCM_EIO,
|
||||
QSE_SCM_EENDSTR,
|
||||
QSE_SCM_ESHARP,
|
||||
QSE_SCM_EDOT,
|
||||
QSE_SCM_ELPAREN,
|
||||
QSE_SCM_ERPAREN,
|
||||
QSE_SCM_ELSTDEEP,
|
||||
|
||||
QSE_SCM_EVARBAD,
|
||||
QSE_SCM_EARGBAD,
|
||||
QSE_SCM_EARGFEW,
|
||||
QSE_SCM_EARGMANY,
|
||||
QSE_SCM_EUNDEFFN,
|
||||
QSE_SCM_EBADFN,
|
||||
QSE_SCM_EDUPFML,
|
||||
QSE_SCM_EBADSYM,
|
||||
QSE_SCM_EUNDEFSYM,
|
||||
QSE_SCM_EEMPBDY,
|
||||
QSE_SCM_EVALBAD,
|
||||
QSE_SCM_EDIVBY0
|
||||
};
|
||||
typedef enum qse_scm_errnum_t qse_scm_errnum_t;
|
||||
|
||||
typedef const qse_char_t* (*qse_scm_errstr_t) (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errnum_t num /**< error number */
|
||||
);
|
||||
|
||||
typedef qse_scm_ent_t* (*qse_scm_prim_t) (
|
||||
qse_scm_t* scm,
|
||||
qse_scm_ent_t* obj
|
||||
);
|
||||
|
||||
#define QSE_SCM_ENT_ISNIL(scm,ent) ((ent) == (scm)->nil)
|
||||
|
||||
#define QSE_SCM_ENT_ISSMALLINT(scm,ent) ((qse_uintptr_t)(ent) & 1)
|
||||
|
||||
/* TODO: need more typecasting to something like int? how to i determine
|
||||
* the best type for the range in CAN_BE_SMALLINT()?
|
||||
#define QSE_SCM_ENT_FROMSMALLINT(x) ((int)((qse_uintptr_t)(x) >> 1))
|
||||
*/
|
||||
#define QSE_SCM_ENT_FROMSMALLINT(scm,ent) \
|
||||
((qse_uintptr_t)(ent) >> 1)
|
||||
|
||||
/* TODO: change the smallint range... */
|
||||
#define QSE_SCM_ENT_TOSMALLINT(scm,num) \
|
||||
((qse_scm_ent_t*)(qse_uintptr_t)(((num) << 1) | 1))
|
||||
|
||||
#define QSE_SCM_ENT_CANBESMALLINT(scm,num) \
|
||||
(((num) >= -16384) && ((num) <= 16383))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (scm)
|
||||
|
||||
qse_scm_t* qse_scm_open (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t xtnsize,
|
||||
qse_size_t mem_ubound,
|
||||
qse_size_t mem_ubound_inc
|
||||
);
|
||||
|
||||
void qse_scm_close (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
qse_scm_errstr_t qse_scm_geterrstr (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
void qse_scm_seterrstr (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errstr_t errstr /**< an error string getter */
|
||||
);
|
||||
|
||||
qse_scm_errnum_t qse_scm_geterrnum (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
const qse_scm_loc_t* qse_scm_geterrloc (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
const qse_char_t* qse_scm_geterrmsg (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
void qse_scm_geterror (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errnum_t* errnum, /**< error number */
|
||||
const qse_char_t** errmsg, /**< error message */
|
||||
qse_scm_loc_t* errloc /**< error location */
|
||||
);
|
||||
|
||||
void qse_scm_seterrnum (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg /**< argument for formatting error message */
|
||||
);
|
||||
|
||||
void qse_scm_seterrmsg (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errnum_t errnum, /**< error number */
|
||||
const qse_char_t* errmsg, /**< error message */
|
||||
const qse_scm_loc_t* errloc /**< error location */
|
||||
);
|
||||
|
||||
void qse_scm_seterror (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg, /**< array of arguments for formatting
|
||||
* an error message */
|
||||
const qse_scm_loc_t* errloc /**< error location */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_attachio() function attaches I/O handlers.
|
||||
* Upon attachment, it opens input and output streams by calling
|
||||
* the I/O handlers with the #QSE_SCM_IO_OPEN command.
|
||||
*/
|
||||
int qse_scm_attachio (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_io_t* io /**< I/O handler set */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_detachio() function detaches I/O handlers.
|
||||
* It closes the streams for both input and output by calling the I/O handlers
|
||||
* with the #QSE_SCM_IO_CLOSE command.
|
||||
*/
|
||||
void qse_scm_detachio (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_read() function reads a textual expression into an entity.
|
||||
*/
|
||||
qse_scm_ent_t* qse_scm_read (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_eval() function evaluates an entity.
|
||||
*/
|
||||
qse_scm_ent_t* qse_scm_eval (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_ent_t* obj /**< entity */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_print() function prints an entity.
|
||||
*/
|
||||
int qse_scm_print (
|
||||
qse_scm_t* scm, /**< scheme */
|
||||
qse_scm_ent_t* obj /**< entity */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_scm_gc() function invokes the garbage collector
|
||||
*/
|
||||
void qse_scm_gc (
|
||||
qse_scm_t* scm /**< scheme */
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makepairent (
|
||||
qse_scm_t* scm,
|
||||
qse_scm_ent_t* car,
|
||||
qse_scm_ent_t* cdr
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makenument (
|
||||
qse_scm_t* scm,
|
||||
qse_long_t val
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makerealent (
|
||||
qse_scm_t* scm,
|
||||
qse_long_t val
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makestrent (
|
||||
qse_scm_t* scm,
|
||||
const qse_char_t* str,
|
||||
qse_size_t len
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makenamentity (
|
||||
qse_scm_t* scm,
|
||||
const qse_char_t* str
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makesyment (
|
||||
qse_scm_t* scm,
|
||||
const qse_char_t* name
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makesyntent (
|
||||
qse_scm_t* scm,
|
||||
const qse_char_t* name,
|
||||
void* uptr
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makeprocent (
|
||||
qse_scm_t* scm,
|
||||
const qse_char_t* name,
|
||||
int code
|
||||
);
|
||||
|
||||
qse_scm_ent_t* qse_scm_makeclosent (
|
||||
qse_scm_t* scm,
|
||||
qse_scm_ent_t* code,
|
||||
qse_scm_ent_t* env
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,2 +1,2 @@
|
||||
SUBDIRS = cmn awk cut sed fs net stx
|
||||
SUBDIRS = cmn awk cut sed net stx
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
@ -230,7 +230,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = cmn awk cut sed fs net stx
|
||||
SUBDIRS = cmn awk cut sed net stx
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: all-recursive
|
||||
|
||||
|
@ -9,6 +9,7 @@ AM_CPPFLAGS = \
|
||||
lib_LTLIBRARIES = libqsecmn.la
|
||||
|
||||
noinst_HEADERS = \
|
||||
fs.h \
|
||||
mem.h \
|
||||
syscall.h \
|
||||
tre.h \
|
||||
@ -33,6 +34,9 @@ libqsecmn_la_SOURCES = \
|
||||
fio.c \
|
||||
fma.c \
|
||||
fmt.c \
|
||||
fs.c \
|
||||
fs-err.c \
|
||||
fs-move.c \
|
||||
main.c \
|
||||
mem.c \
|
||||
oht.c \
|
||||
|
@ -77,16 +77,16 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libqsecmn_la_DEPENDENCIES =
|
||||
am_libqsecmn_la_OBJECTS = alg-rand.lo alg-search.lo alg-sort.lo \
|
||||
assert.lo chr.lo chr-cnv.lo dll.lo env.lo gdl.lo htb.lo lda.lo \
|
||||
fio.lo fma.lo fmt.lo main.lo mem.lo oht.lo opt.lo \
|
||||
path-basename.lo path-canon.lo pio.lo pma.lo rbt.lo rex.lo \
|
||||
sio.lo sll.lo stdio.lo str-beg.lo str-cat.lo str-chr.lo \
|
||||
str-cnv.lo str-cmp.lo str-cpy.lo str-del.lo str-dup.lo \
|
||||
str-dynm.lo str-dynw.lo str-end.lo str-excl.lo str-fcpy.lo \
|
||||
str-fnmat.lo str-incl.lo str-len.lo str-pac.lo str-pbrk.lo \
|
||||
str-put.lo str-rev.lo str-rot.lo str-set.lo str-spl.lo \
|
||||
str-spn.lo str-str.lo str-subst.lo str-tok.lo str-trm.lo \
|
||||
str-word.lo time.lo tio.lo tio-get.lo tio-put.lo tre.lo \
|
||||
tre-ast.lo tre-compile.lo tre-match-backtrack.lo \
|
||||
fio.lo fma.lo fmt.lo fs.lo fs-err.lo fs-move.lo main.lo mem.lo \
|
||||
oht.lo opt.lo path-basename.lo path-canon.lo pio.lo pma.lo \
|
||||
rbt.lo rex.lo sio.lo sll.lo stdio.lo str-beg.lo str-cat.lo \
|
||||
str-chr.lo str-cnv.lo str-cmp.lo str-cpy.lo str-del.lo \
|
||||
str-dup.lo str-dynm.lo str-dynw.lo str-end.lo str-excl.lo \
|
||||
str-fcpy.lo str-fnmat.lo str-incl.lo str-len.lo str-pac.lo \
|
||||
str-pbrk.lo str-put.lo str-rev.lo str-rot.lo str-set.lo \
|
||||
str-spl.lo str-spn.lo str-str.lo str-subst.lo str-tok.lo \
|
||||
str-trm.lo str-word.lo time.lo tio.lo tio-get.lo tio-put.lo \
|
||||
tre.lo tre-ast.lo tre-compile.lo tre-match-backtrack.lo \
|
||||
tre-match-parallel.lo tre-parse.lo tre-stack.lo utf8.lo xma.lo
|
||||
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
||||
libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
@ -278,6 +278,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
lib_LTLIBRARIES = libqsecmn.la $(am__append_1)
|
||||
noinst_HEADERS = \
|
||||
fs.h \
|
||||
mem.h \
|
||||
syscall.h \
|
||||
tre.h \
|
||||
@ -302,6 +303,9 @@ libqsecmn_la_SOURCES = \
|
||||
fio.c \
|
||||
fma.c \
|
||||
fmt.c \
|
||||
fs.c \
|
||||
fs-err.c \
|
||||
fs-move.c \
|
||||
main.c \
|
||||
mem.c \
|
||||
oht.c \
|
||||
@ -453,6 +457,9 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-err.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-move.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Plo@am__quote@
|
||||
|
99
qse/lib/cmn/fs-err.c
Normal file
99
qse/lib/cmn/fs-err.c
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fs.h"
|
||||
|
||||
qse_fs_errnum_t qse_fs_geterrnum (qse_fs_t* fs)
|
||||
{
|
||||
return fs->errnum;
|
||||
}
|
||||
|
||||
const qse_char_t* qse_fs_geterrmsg (qse_fs_t* fs)
|
||||
{
|
||||
static const qse_char_t* errstr[] =
|
||||
{
|
||||
QSE_T("no error"),
|
||||
QSE_T("internal error that should never have happened"),
|
||||
|
||||
QSE_T("insufficient memory"),
|
||||
QSE_T("invalid parameter or data"),
|
||||
QSE_T("permission denied"),
|
||||
QSE_T("no such entry"),
|
||||
QSE_T("no working fsectory set"),
|
||||
QSE_T("already exists"),
|
||||
QSE_T("system error")
|
||||
};
|
||||
|
||||
return (fs->errnum >= 0 && fs->errnum < QSE_COUNTOF(errstr))?
|
||||
errstr[fs->errnum]: QSE_T("unknown error");
|
||||
}
|
||||
|
||||
qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
switch (e)
|
||||
{
|
||||
case ERROR_INVALID_NAME:
|
||||
case ERROR_DIRECTORY:
|
||||
return QSE_FS_EINVAL;
|
||||
|
||||
case ERROR_ACCESS_DENIED:
|
||||
return QSE_FS_EACCES;
|
||||
|
||||
case ERROR_FILE_NOT_FOUND:
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
return QSE_FS_ENOENT;
|
||||
|
||||
case ERROR_NOT_ENOUGH_MEMORY:
|
||||
case ERROR_OUTOFMEMORY:
|
||||
return QSE_FS_ENOMEM;
|
||||
|
||||
case ERROR_ALREADY_EXISTS:
|
||||
case ERROR_FILE_EXISTS:
|
||||
return QSE_FS_EEXIST;
|
||||
|
||||
default:
|
||||
return QSE_FS_ESYSTEM;
|
||||
}
|
||||
#else
|
||||
switch (e)
|
||||
{
|
||||
case EINVAL:
|
||||
return QSE_FS_EINVAL;
|
||||
|
||||
case EACCES:
|
||||
case EPERM:
|
||||
return QSE_FS_EACCES;
|
||||
|
||||
case ENOENT:
|
||||
case ENOTDIR:
|
||||
return QSE_FS_ENOENT;
|
||||
|
||||
case ENOMEM:
|
||||
return QSE_FS_ENOMEM;
|
||||
|
||||
case EEXIST:
|
||||
return QSE_FS_EEXIST;
|
||||
|
||||
default:
|
||||
return QSE_FS_ESYSTEM;
|
||||
}
|
||||
#endif
|
||||
}
|
123
qse/lib/cmn/fs-move.c
Normal file
123
qse/lib/cmn/fs-move.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fs.h"
|
||||
#include <qse/cmn/str.h>
|
||||
#include "mem.h"
|
||||
|
||||
int qse_fs_move (qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newpath)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/* TODO: improve it... */
|
||||
|
||||
/* TODO: support cross-volume move, move by copy/delete, etc ... */
|
||||
if (MoveFile (oldpath, newpath) == FALSE)
|
||||
{
|
||||
DWORD e = GetLastError();
|
||||
if (e == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
DeleteFile (newpath);
|
||||
if (MoveFile (oldpath, newpath) == FALSE)
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, GetLastError());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, e);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
|
||||
const qse_mchar_t* mbsoldpath;
|
||||
const qse_mchar_t* mbsnewpath;
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
mbsoldpath = oldpath;
|
||||
mbsnewpath = newpath;
|
||||
#else
|
||||
mbsoldpath = qse_wcstombsdup (oldpath, fs->mmgr);
|
||||
mbsnewpath = qse_wcstombsdup (newpath, fs->mmgr);
|
||||
|
||||
if (mbsoldpath == QSE_NULL || mbsnewpath == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
goto oops;
|
||||
}
|
||||
|
||||
/* TOOD: implement confirmatio
|
||||
if (overwrite_callback is set)
|
||||
{
|
||||
checkif the the mbsnewpat exists.
|
||||
if (it exists)
|
||||
{
|
||||
call fs->confirm_overwrite_callback (....)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* TODO: make it better to be able to move non-empty diretories
|
||||
improve it to be able to move by copy/delete across volume */
|
||||
if (QSE_RENAME (mbsoldpath, mbsnewpath) == -1)
|
||||
{
|
||||
if (errno == EXDEV)
|
||||
{
|
||||
/* TODO: move it by copy and delete intead of returnign error... */
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
goto oops;
|
||||
}
|
||||
else
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
goto oops;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
/* nothing to free */
|
||||
#else
|
||||
QSE_MMGR_FREE (fs->mmgr, mbsoldpath);
|
||||
QSE_MMGR_FREE (fs->mmgr, mbsnewpath);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
oops:
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
/* nothing to free */
|
||||
#else
|
||||
if (mbsoldpath) QSE_MMGR_FREE (fs->mmgr, mbsoldpath);
|
||||
if (mbsnewpath) QSE_MMGR_FREE (fs->mmgr, mbsnewpath);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
695
qse/lib/cmn/fs.c
Normal file
695
qse/lib/cmn/fs.c
Normal file
@ -0,0 +1,695 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fs.h"
|
||||
#include <qse/cmn/str.h>
|
||||
#include <qse/cmn/path.h>
|
||||
#include "mem.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* nothing else */
|
||||
#elif defined(__OS2__)
|
||||
/* nothing else */
|
||||
#elif defined(__DOS__)
|
||||
/* nothing else */
|
||||
#else
|
||||
# include <dirent.h>
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
typedef struct info_t info_t;
|
||||
struct info_t
|
||||
{
|
||||
qse_xstr_t name;
|
||||
|
||||
#if defined(_WIN32)
|
||||
HANDLE handle;
|
||||
WIN32_FIND_DATA wfd;
|
||||
int just_changed_fs;
|
||||
#elif defined(__OS2__)
|
||||
#elif defined(__DOS__)
|
||||
#else
|
||||
DIR* handle;
|
||||
qse_mchar_t* mcurdir;
|
||||
#endif
|
||||
};
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (fs)
|
||||
|
||||
qse_fs_t* qse_fs_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
||||
{
|
||||
qse_fs_t* fs;
|
||||
|
||||
if (mmgr == QSE_NULL)
|
||||
{
|
||||
mmgr = QSE_MMGR_GETDFL();
|
||||
|
||||
QSE_ASSERTX (mmgr != QSE_NULL,
|
||||
"Set the memory manager with QSE_MMGR_SETDFL()");
|
||||
|
||||
if (mmgr == QSE_NULL) return QSE_NULL;
|
||||
}
|
||||
|
||||
fs = QSE_MMGR_ALLOC (mmgr, QSE_SIZEOF(*fs) + xtnsize);
|
||||
if (fs == QSE_NULL) return QSE_NULL;
|
||||
|
||||
if (qse_fs_init (fs, mmgr) <= -1)
|
||||
{
|
||||
QSE_MMGR_FREE (mmgr, fs);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
void qse_fs_close (qse_fs_t* fs)
|
||||
{
|
||||
qse_fs_fini (fs);
|
||||
QSE_MMGR_FREE (fs->mmgr, fs);
|
||||
}
|
||||
|
||||
int qse_fs_init (qse_fs_t* fs, qse_mmgr_t* mmgr)
|
||||
{
|
||||
QSE_MEMSET (fs, 0, QSE_SIZEOF(*fs));
|
||||
fs->mmgr = mmgr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qse_fs_fini (qse_fs_t* fs)
|
||||
{
|
||||
info_t* info;
|
||||
|
||||
info = fs->info;
|
||||
if (info)
|
||||
{
|
||||
if (info->name.ptr)
|
||||
{
|
||||
QSE_ASSERT (info->name.len > 0);
|
||||
QSE_MMGR_FREE (fs->mmgr, info->name.ptr);
|
||||
info->name.ptr = QSE_NULL;
|
||||
info->name.len = 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
if (info->handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose (info->handle);
|
||||
info->handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
if (info->mcurdir && info->mcurdir != fs->curdir)
|
||||
QSE_MMGR_FREE (fs->mmgr, info->mcurdir);
|
||||
info->mcurdir = QSE_NULL;
|
||||
|
||||
if (info->handle)
|
||||
{
|
||||
closedir (info->handle);
|
||||
info->handle = QSE_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
QSE_MMGR_FREE (fs->mmgr, info);
|
||||
fs->info = QSE_NULL;
|
||||
}
|
||||
|
||||
if (fs->curdir)
|
||||
{
|
||||
QSE_MMGR_FREE (fs->mmgr, fs->curdir);
|
||||
fs->curdir = QSE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static QSE_INLINE info_t* get_info (qse_fs_t* fs)
|
||||
{
|
||||
info_t* info;
|
||||
|
||||
info = fs->info;
|
||||
if (info == QSE_NULL)
|
||||
{
|
||||
info = QSE_MMGR_ALLOC (fs->mmgr, QSE_SIZEOF(*info));
|
||||
if (info == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
QSE_MEMSET (info, 0, QSE_SIZEOF(*info));
|
||||
#if defined(_WIN32)
|
||||
info->handle = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
fs->info = info;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
int qse_fs_chdir (qse_fs_t* fs, const qse_char_t* name)
|
||||
{
|
||||
qse_char_t* fsname;
|
||||
info_t* info;
|
||||
|
||||
#if defined(_WIN32)
|
||||
HANDLE handle;
|
||||
WIN32_FIND_DATA wfd;
|
||||
const qse_char_t* tmp_name[4];
|
||||
qse_size_t idx;
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
DIR* handle;
|
||||
qse_mchar_t* mfsname;
|
||||
const qse_char_t* tmp_name[4];
|
||||
qse_size_t idx;
|
||||
#endif
|
||||
|
||||
if (name[0] == QSE_T('\0'))
|
||||
{
|
||||
fs->errnum = QSE_FS_EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
info = get_info (fs);
|
||||
if (info == QSE_NULL) return -1;
|
||||
|
||||
#if defined(_WIN32)
|
||||
idx = 0;
|
||||
if (!qse_isabspath(name) && fs->curdir)
|
||||
tmp_name[idx++] = fs->curdir;
|
||||
tmp_name[idx++] = name;
|
||||
|
||||
if (qse_isdrivecurpath(name))
|
||||
tmp_name[idx++] = QSE_T(" ");
|
||||
else
|
||||
tmp_name[idx++] = QSE_T("\\ ");
|
||||
|
||||
tmp_name[idx] = QSE_NULL;
|
||||
|
||||
fsname = qse_stradup (tmp_name, fs->mmgr);
|
||||
if (fsname == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
idx = qse_canonpath (fsname, fsname, 0);
|
||||
/* Put an asterisk after canonicalization to prevent side-effects.
|
||||
* otherwise, .\* would be transformed to * by qse_canonpath() */
|
||||
fsname[idx-1] = QSE_T('*');
|
||||
|
||||
/* Using FindExInfoBasic won't resolve cAlternatFileName.
|
||||
* so it can get faster a little bit. The problem is that
|
||||
* it is not supported on old windows. just stick to the
|
||||
* simple API instead. */
|
||||
#if 0
|
||||
handle = FindFirstFileEx (
|
||||
fsname, FindExInfoBasic,
|
||||
&wfd, FindExSearchNameMatch,
|
||||
NULL, 0/*FIND_FIRST_EX_CASE_SENSITIVE*/);
|
||||
#endif
|
||||
handle = FindFirstFile (fsname, &wfd);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, GetLastError());
|
||||
QSE_MMGR_FREE (fs->mmgr, fsname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (info->handle != INVALID_HANDLE_VALUE)
|
||||
FindClose (info->handle);
|
||||
|
||||
QSE_MEMSET (info, 0, QSE_SIZEOF(*info));
|
||||
info->handle = handle;
|
||||
info->wfd = wfd;
|
||||
info->just_changed_fs = 1;
|
||||
|
||||
if (fs->curdir) QSE_MMGR_FREE (fs->mmgr, fs->curdir);
|
||||
fsname[idx-1] = QSE_T('\0'); /* drop the asterisk */
|
||||
fs->curdir = fsname;
|
||||
|
||||
return 0;
|
||||
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
|
||||
idx = 0;
|
||||
if (!qse_isabspath(name) && fs->curdir)
|
||||
{
|
||||
tmp_name[idx++] = fs->curdir;
|
||||
tmp_name[idx++] = QSE_T("/");
|
||||
}
|
||||
tmp_name[idx++] = name;
|
||||
tmp_name[idx] = QSE_NULL;
|
||||
|
||||
fsname = qse_stradup (tmp_name, fs->mmgr);
|
||||
if (fsname == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
qse_canonpath (fsname, fsname, 0);
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
mfsname = fsname;
|
||||
#else
|
||||
mfsname = qse_wcstombsdup (fsname, fs->mmgr);
|
||||
if (mfsname == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
QSE_MMGR_FREE (fs->mmgr, fsname);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
handle = opendir (mfsname);
|
||||
|
||||
if (handle == QSE_NULL)
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
if (mfsname != fsname)
|
||||
QSE_MMGR_FREE (fs->mmgr, mfsname);
|
||||
QSE_MMGR_FREE (fs->mmgr, fsname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (info->handle) closedir (info->handle);
|
||||
info->handle = handle;
|
||||
|
||||
if (info->mcurdir && info->mcurdir != fs->curdir)
|
||||
QSE_MMGR_FREE (fs->mmgr, info->mcurdir);
|
||||
info->mcurdir = mfsname;
|
||||
|
||||
if (fs->curdir) QSE_MMGR_FREE (fs->mmgr, fs->curdir);
|
||||
fs->curdir = fsname;
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||
static int set_entry_name (qse_fs_t* fs, const qse_char_t* name)
|
||||
#else
|
||||
static int set_entry_name (qse_fs_t* fs, const qse_mchar_t* name)
|
||||
#endif
|
||||
{
|
||||
info_t* info;
|
||||
qse_size_t len;
|
||||
|
||||
info = fs->info;
|
||||
QSE_ASSERT (info != QSE_NULL);
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||
len = qse_strlen (name);
|
||||
#else
|
||||
{
|
||||
qse_size_t mlen;
|
||||
|
||||
/* TODO: ignore MBWCERR */
|
||||
mlen = qse_mbstowcslen (name, &len);
|
||||
if (name[mlen] != QSE_MT('\0'))
|
||||
{
|
||||
/* invalid name ??? */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (len > info->name.len)
|
||||
{
|
||||
qse_char_t* tmp;
|
||||
|
||||
/* TOOD: round up len to the nearlest multiples of something (32, 64, ??)*/
|
||||
tmp = QSE_MMGR_REALLOC (
|
||||
fs->mmgr,
|
||||
info->name.ptr,
|
||||
(len + 1) * QSE_SIZEOF(*tmp)
|
||||
);
|
||||
if (tmp == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
info->name.len = len;
|
||||
info->name.ptr = tmp;
|
||||
}
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||
qse_strcpy (info->name.ptr, name);
|
||||
#else
|
||||
len++;
|
||||
qse_mbstowcs (name, info->name.ptr, &len);
|
||||
#endif
|
||||
|
||||
fs->ent.name.base = info->name.ptr;
|
||||
fs->ent.flags |= QSE_FS_ENT_NAME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
static QSE_INLINE qse_ntime_t filetime_to_ntime (const FILETIME* ft)
|
||||
{
|
||||
/* reverse of http://support.microsoft.com/kb/167296/en-us */
|
||||
ULARGE_INTEGER li;
|
||||
li.LowPart = ft->dwLowDateTime;
|
||||
li.HighPart = ft->dwHighDateTime;
|
||||
|
||||
#if (QSE_SIZEOF_LONG_LONG>=8)
|
||||
li.QuadPart -= 116444736000000000ull;
|
||||
#elif (QSE_SIZEOF___INT64>=8)
|
||||
li.QuadPart -= 116444736000000000ui64;
|
||||
#else
|
||||
# error Unsupported 64bit integer type
|
||||
#endif
|
||||
/*li.QuadPart /= 10000000;*/
|
||||
li.QuadPart /= 10000;
|
||||
|
||||
return li.QuadPart;
|
||||
}
|
||||
#endif
|
||||
|
||||
qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
info_t* info;
|
||||
|
||||
info = fs->info;
|
||||
if (info == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENODIR;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
if (info->just_changed_fs)
|
||||
{
|
||||
info->just_changed_fs = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FindNextFile (info->handle, &info->wfd) == FALSE)
|
||||
{
|
||||
DWORD e = GetLastError();
|
||||
if (e == ERROR_NO_MORE_FILES)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOERR;
|
||||
return QSE_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, e);
|
||||
return QSE_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* call set_entry_name before changing other fields
|
||||
* in fs->ent not to pollute it in case set_entry_name fails */
|
||||
QSE_MEMSET (&fs->ent, 0, QSE_SIZEOF(fs->ent));
|
||||
if (set_entry_name (fs, info->wfd.cFileName) <= -1) return QSE_NULL;
|
||||
|
||||
if (flags & QSE_FS_ENT_TYPE)
|
||||
{
|
||||
if (info->wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
fs->ent.type = QSE_FS_ENT_SUBDIR;
|
||||
}
|
||||
else if ((info->wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
|
||||
(info->wfd.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
|
||||
{
|
||||
fs->ent.type = QSE_FS_ENT_SYMLINK;
|
||||
}
|
||||
else
|
||||
{
|
||||
HANDLE h;
|
||||
qse_char_t* tmp_name[4];
|
||||
qse_char_t* fname;
|
||||
|
||||
/* TODO: use a buffer in info... instead of allocating an deallocating every time */
|
||||
tmp_name[0] = fs->curdir;
|
||||
tmp_name[1] = QSE_T("\\");
|
||||
tmp_name[2] = info->wfd.cFileName;
|
||||
tmp_name[3] = QSE_NULL;
|
||||
fname = qse_stradup (tmp_name, fs->mmgr);
|
||||
if (fname == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
h = CreateFile (
|
||||
fname,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
QSE_NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0
|
||||
);
|
||||
|
||||
QSE_MMGR_FREE (fs->mmgr, fname);
|
||||
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD t = GetFileType (h);
|
||||
switch (t)
|
||||
{
|
||||
case FILE_TYPE_CHAR:
|
||||
fs->ent.type = QSE_FS_ENT_CHRDEV;
|
||||
break;
|
||||
case FILE_TYPE_DISK:
|
||||
fs->ent.type = QSE_FS_ENT_BLKDEV;
|
||||
break;
|
||||
case FILE_TYPE_PIPE:
|
||||
fs->ent.type = QSE_FS_ENT_PIPE;
|
||||
break;
|
||||
default:
|
||||
fs->ent.type = QSE_FS_ENT_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
CloseHandle (h);
|
||||
}
|
||||
else
|
||||
{
|
||||
fs->ent.type = QSE_FS_ENT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
fs->ent.type |= QSE_FS_ENT_TYPE;
|
||||
}
|
||||
|
||||
if (flags & QSE_FS_ENT_SIZE)
|
||||
{
|
||||
LARGE_INTEGER li;
|
||||
li.LowPart = info->wfd.nFileSizeLow;
|
||||
li.HighPart = info->wfd.nFileSizeHigh;
|
||||
fs->ent.size = li.QuadPart;
|
||||
fs->ent.type |= QSE_FS_ENT_SIZE;
|
||||
}
|
||||
|
||||
if (flags & QSE_FS_ENT_TIME)
|
||||
{
|
||||
fs->ent.time.create = filetime_to_ntime (&info->wfd.ftCreationTime);
|
||||
fs->ent.time.access = filetime_to_ntime (&info->wfd.ftLastAccessTime);
|
||||
fs->ent.time.modify = filetime_to_ntime (&info->wfd.ftLastWriteTime);
|
||||
fs->ent.type |= QSE_FS_ENT_TIME;
|
||||
}
|
||||
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
|
||||
info_t* info;
|
||||
struct dirent* ent;
|
||||
int x;
|
||||
|
||||
int stat_needed;
|
||||
#if defined(QSE_LSTAT64)
|
||||
struct stat64 st;
|
||||
#else
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
info = fs->info;
|
||||
if (info == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENODIR;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
ent = readdir (info->handle);
|
||||
if (ent == QSE_NULL)
|
||||
{
|
||||
if (errno != 0) fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
QSE_MEMSET (&fs->ent, 0, QSE_SIZEOF(fs->ent));
|
||||
if (set_entry_name (fs, ent->d_name) <= -1) return QSE_NULL;
|
||||
|
||||
stat_needed =
|
||||
#if !defined(HAVE_STRUCT_DIRENT_D_TYPE)
|
||||
(flags & QSE_FS_ENT_TYPE) ||
|
||||
#endif
|
||||
(flags & QSE_FS_ENT_SIZE) ||
|
||||
(flags & QSE_FS_ENT_TIME);
|
||||
if (stat_needed)
|
||||
{
|
||||
qse_mchar_t* tmp_name[4];
|
||||
qse_mchar_t* mfname;
|
||||
|
||||
/* TODO: use a buffer in info... instead of allocating an deallocating every time */
|
||||
tmp_name[0] = info->mcurdir;
|
||||
tmp_name[1] = QSE_MT("/");
|
||||
tmp_name[2] = ent->d_name;
|
||||
tmp_name[3] = QSE_NULL;
|
||||
mfname = qse_mbsadup (tmp_name, fs->mmgr);
|
||||
if (mfname == QSE_NULL)
|
||||
{
|
||||
fs->errnum = QSE_FS_ENOMEM;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
#if defined(QSE_LSTAT64)
|
||||
x = QSE_LSTAT64 (mfname, &st);
|
||||
#else
|
||||
x = QSE_LSTAT (mfname, &st);
|
||||
#endif
|
||||
QSE_MMGR_FREE (fs->mmgr, mfname);
|
||||
|
||||
if (x == -1)
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
return QSE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & QSE_FS_ENT_TYPE)
|
||||
{
|
||||
#if defined(HAVE_STRUCT_DIRENT_D_TYPE)
|
||||
switch (ent->d_type)
|
||||
{
|
||||
case DT_DIR:
|
||||
fs->ent.type = QSE_FS_ENT_SUBDIR;
|
||||
break;
|
||||
|
||||
case DT_REG:
|
||||
fs->ent.type = QSE_FS_ENT_REGULAR;
|
||||
break;
|
||||
|
||||
case DT_LNK:
|
||||
fs->ent.type = QSE_FS_ENT_SYMLINK;
|
||||
break;
|
||||
|
||||
case DT_BLK:
|
||||
fs->ent.type = QSE_FS_ENT_BLKDEV;
|
||||
break;
|
||||
|
||||
case DT_CHR:
|
||||
fs->ent.type = QSE_FS_ENT_CHRDEV;
|
||||
break;
|
||||
|
||||
case DT_FIFO:
|
||||
#if defined(DT_SOCK)
|
||||
case DT_SOCK:
|
||||
#endif
|
||||
fs->ent.type = QSE_FS_ENT_PIPE;
|
||||
break;
|
||||
|
||||
default:
|
||||
fs->ent.type = QSE_FS_ENT_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
#define IS_TYPE(st,type) ((st.st_mode & S_IFMT) == S_IFDIR)
|
||||
fs->ent.type = IS_TYPE(st,S_IFDIR)? QSE_FS_ENT_SUBDIR:
|
||||
IS_TYPE(st,S_IFREG)? QSE_FS_ENT_REGULAR:
|
||||
IS_TYPE(st,S_IFLNK)? QSE_FS_ENT_SYMLINK:
|
||||
IS_TYPE(st,S_IFCHR)? QSE_FS_ENT_CHRDEV:
|
||||
IS_TYPE(st,S_IFBLK)? QSE_FS_ENT_BLKDEV:
|
||||
IS_TYPE(st,S_IFIFO)? QSE_FS_ENT_PIPE:
|
||||
IS_TYPE(st,S_IFSOCK)? QSE_FS_ENT_PIPE:
|
||||
QSE_FS_ENT_UNKNOWN;
|
||||
#undef IS_TYPE
|
||||
#endif
|
||||
fs->ent.flags |= QSE_FS_ENT_TYPE;
|
||||
}
|
||||
|
||||
if (flags & QSE_FS_ENT_SIZE)
|
||||
{
|
||||
fs->ent.size = st.st_size;
|
||||
fs->ent.flags |= QSE_FS_ENT_SIZE;
|
||||
}
|
||||
|
||||
if (flags & QSE_FS_ENT_TIME)
|
||||
{
|
||||
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||
#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIME)
|
||||
fs->ent.time.create =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_birthtim.tv_sec,st.st_birthtim.tv_nsec);
|
||||
#endif
|
||||
fs->ent.time.access =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_atim.tv_sec,st.st_atim.tv_nsec);
|
||||
fs->ent.time.modify =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_mtim.tv_sec,st.st_mtim.tv_nsec);
|
||||
fs->ent.time.change =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_ctim.tv_sec,st.st_ctim.tv_nsec);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
|
||||
#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIME)
|
||||
fs->ent.time.create = st.st_birthtime;
|
||||
QSE_SECNSEC_TO_MSEC(st.st_birthtimespec.tv_sec,st.st_birthtimespec.tv_nsec);
|
||||
#endif
|
||||
fs->ent.time.access =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_atimespec.tv_sec,st.st_atimespec.tv_nsec);
|
||||
fs->ent.time.modify =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_mtimespec.tv_sec,st.st_mtimespec.tv_nsec);
|
||||
fs->ent.time.change =
|
||||
QSE_SECNSEC_TO_MSEC(st.st_ctimespec.tv_sec,st.st_ctimespec.tv_nsec);
|
||||
#else
|
||||
#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIME)
|
||||
fs->ent.time.create = st.st_birthtime * QSE_MSECS_PER_SEC;
|
||||
#endif
|
||||
fs->ent.time.access = st.st_atime * QSE_MSECS_PER_SEC;
|
||||
fs->ent.time.modify = st.st_mtime * QSE_MSECS_PER_SEC;
|
||||
fs->ent.time.change = st.st_ctime * QSE_MSECS_PER_SEC;
|
||||
#endif
|
||||
fs->ent.flags |= QSE_FS_ENT_TIME;
|
||||
}
|
||||
#endif
|
||||
|
||||
return &fs->ent;
|
||||
}
|
||||
|
||||
int qse_fs_rewind (qse_fs_t* fs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -18,28 +18,30 @@
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _QSE_FS_PATH_H_
|
||||
#define _QSE_FS_PATH_H_
|
||||
#include <qse/cmn/fs.h>
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
#if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
typedef DWORD qse_fs_syserr_t;
|
||||
#elif defined(__OS2__)
|
||||
# error NOT IMPLEMENTED
|
||||
#elif defined(__DOS__)
|
||||
# error NOT IMPLEMENTED
|
||||
#else
|
||||
# include "syscall.h"
|
||||
# include <errno.h>
|
||||
typedef int qse_fs_syserr_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
qse_size_t qse_canonpath (
|
||||
const qse_char_t* path,
|
||||
qse_char_t* canon
|
||||
);
|
||||
|
||||
qse_size_t qse_realpath (
|
||||
const qse_char_t* path,
|
||||
qse_char_t* real
|
||||
qse_fs_errnum_t qse_fs_syserrtoerrnum (
|
||||
qse_fs_t* fs,
|
||||
qse_fs_syserr_t e
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -58,25 +58,25 @@
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#ifdef SYS_open
|
||||
#if defined(SYS_open)
|
||||
# define QSE_OPEN(path,flags,mode) syscall(SYS_open,path,flags,mode)
|
||||
#else
|
||||
# define QSE_OPEN(path,flags,mode) open(path,flags,mode)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_close
|
||||
#if defined(SYS_close)
|
||||
# define QSE_CLOSE(handle) syscall(SYS_close,handle)
|
||||
#else
|
||||
# define QSE_CLOSE(handle) close(handle)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_read
|
||||
#if defined(SYS_read)
|
||||
# define QSE_READ(handle,buf,size) syscall(SYS_read,handle,buf,size)
|
||||
#else
|
||||
# define QSE_READ(handle,buf,size) read(handle,buf,size)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_write
|
||||
#if defined(SYS_write)
|
||||
# define QSE_WRITE(handle,buf,size) syscall(SYS_write,handle,buf,size)
|
||||
#else
|
||||
# define QSE_WRITE(handle,buf,size) write(handle,buf,size)
|
||||
@ -100,18 +100,6 @@
|
||||
# define QSE_LSEEK(handle,offset,whence) lseek(handle,offset,whence)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_lstat64)
|
||||
# define QSE_LSTAT64(path,stbuf) syscall(SYS_lstat64,path,stbuf)
|
||||
#elif defined(HAVE_lstat64)
|
||||
# define QSE_LSTAT64(path,stbuf) lstat64(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_lstat)
|
||||
# define QSE_LSTAT(path,stbuf) syscall(SYS_lstat,path,stbuf)
|
||||
#else
|
||||
# define QSE_LSTAT(path,stbuf) lstat(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if !defined(_LP64) && defined(SYS_ftruncate64)
|
||||
# define QSE_FTRUNCATE(handle,size) syscall(SYS_ftruncate64,handle,size)
|
||||
#elif defined(SYS_ftruncate)
|
||||
@ -128,6 +116,12 @@
|
||||
# define QSE_FCHMOD(handle,mode) fchmod(handle,mode)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_fchown)
|
||||
# define QSE_FCHOWN(handle,owner,group) syscall(SYS_fchown,handle,owner,group)
|
||||
#else
|
||||
# define QSE_FCHOWN(handle,owner,group) fchown(handle,owner,group)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_fsync)
|
||||
# define QSE_FSYNC(handle) syscall(SYS_fsync,handle)
|
||||
#else
|
||||
@ -140,118 +134,193 @@
|
||||
# define QSE_FCNTL(handle,cmd,arg) fcntl(handle,cmd,arg)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_dup2
|
||||
#if defined(SYS_dup2)
|
||||
# define QSE_DUP2(ofd,nfd) syscall(SYS_dup2,ofd,nfd)
|
||||
#else
|
||||
# define QSE_DUP2(ofd,nfd) dup2(ofd,nfd)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_pipe
|
||||
#if defined(SYS_pipe)
|
||||
# define QSE_PIPE(pfds) syscall(SYS_pipe,pfds)
|
||||
#else
|
||||
# define QSE_PIPE(pfds) pipe(pfds)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_exit
|
||||
#if defined(SYS_exit)
|
||||
# define QSE_EXIT(code) syscall(SYS_exit,code)
|
||||
#else
|
||||
# define QSE_EXIT(code) _exit(code)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_fork
|
||||
#if defined(SYS_fork)
|
||||
# define QSE_FORK() syscall(SYS_fork)
|
||||
#else
|
||||
# define QSE_FORK() fork()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_execve
|
||||
#if defined(SYS_execve)
|
||||
# define QSE_EXECVE(path,argv,envp) syscall(SYS_execve,path,argv,envp)
|
||||
#else
|
||||
# define QSE_EXECVE(path,argv,envp) execve(path,argv,envp)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_waitpid
|
||||
#if defined(SYS_waitpid)
|
||||
# define QSE_WAITPID(pid,status,options) syscall(SYS_waitpid,pid,status,options)
|
||||
#else
|
||||
# define QSE_WAITPID(pid,status,options) waitpid(pid,status,options)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_kill
|
||||
#if defined(SYS_kill)
|
||||
# define QSE_KILL(pid,sig) syscall(SYS_kill,pid,sig)
|
||||
#else
|
||||
# define QSE_KILL(pid,sig) kill(pid,sig)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_getpid
|
||||
#if defined(SYS_getpid)
|
||||
# define QSE_GETPID() syscall(SYS_getpid)
|
||||
#else
|
||||
# define QSE_GETPID() getpid()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_getuid
|
||||
#if defined(SYS_getuid)
|
||||
# define QSE_GETUID() syscall(SYS_getuid)
|
||||
#else
|
||||
# define QSE_GETUID() getuid()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_geteuid
|
||||
#if defined(SYS_geteuid)
|
||||
# define QSE_GETEUID() syscall(SYS_geteuid)
|
||||
#else
|
||||
# define QSE_GETEUID() geteuid()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_getgid
|
||||
#if defined(SYS_getgid)
|
||||
# define QSE_GETGID() syscall(SYS_getgid)
|
||||
#else
|
||||
# define QSE_GETGID() getgid()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_getegid
|
||||
#if defined(SYS_getegid)
|
||||
# define QSE_GETEGID() syscall(SYS_getegid)
|
||||
#else
|
||||
# define QSE_GETEGID() getegid()
|
||||
#endif
|
||||
|
||||
#ifdef SYS_chroot
|
||||
# define QSE_CHROOT(path) syscall(SYS_chroot,path)
|
||||
#else
|
||||
# define QSE_cHROOT(path) chroot(path)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_gettimeofday
|
||||
#if defined(SYS_gettimeofday)
|
||||
# define QSE_GETTIMEOFDAY(tv,tz) syscall(SYS_gettimeofday,tv,tz)
|
||||
#else
|
||||
# define QSE_GETTIMEOFDAY(tv,tz) gettimeofday(tv,tz)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_settimeofday
|
||||
#if defined(SYS_settimeofday)
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) syscall(SYS_settimeofday,tv,tz)
|
||||
#else
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) settimeofday(tv,tz)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_utime
|
||||
# define QSE_UTIME(file,t) syscall(SYS_utime,file,t)
|
||||
#else
|
||||
# define QSE_UTIME(file,t) utime(file,t)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_utimes
|
||||
# define QSE_UTIMES(file,t) syscall(SYS_utimes,file,t)
|
||||
#else
|
||||
# define QSE_UTIMES(file,t) utimes(file,t)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_getrlimit
|
||||
#if defined(SYS_getrlimit)
|
||||
# define QSE_GETRLIMIT(res,lim) syscall(SYS_getrlimit,res,lim)
|
||||
#else
|
||||
# define QSE_GETRLIMIT(res,lim) getrlimit(res,lim)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_setrlimit
|
||||
#if defined(SYS_setrlimit)
|
||||
# define QSE_SETRLIMIT(res,lim) syscall(SYS_setrlimit,res,lim)
|
||||
#else
|
||||
# define QSE_SETRLIMIT(res,lim) setrlimit(res,lim)
|
||||
#endif
|
||||
|
||||
|
||||
/* ===== FILE SYSTEM CALLS ===== */
|
||||
|
||||
#if defined(SYS_chmod)
|
||||
# define QSE_CHMOD(path,mode) syscall(SYS_chmod,path,mode)
|
||||
#else
|
||||
# define QSE_CHMOD(path,mode) chmod(path,mode)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_chown)
|
||||
# define QSE_CHOWN(path,owner,group) syscall(SYS_chown,path,owner,group)
|
||||
#else
|
||||
# define QSE_CHOWN(path,owner,group) chown(path,owner,group)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_chroot)
|
||||
# define QSE_CHROOT(path) syscall(SYS_chroot,path)
|
||||
#else
|
||||
# define QSE_CHROOT(path) chroot(path)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_lchown)
|
||||
# define QSE_LCHOWN(path,owner,group) syscall(SYS_lchown,path,owner,group)
|
||||
#else
|
||||
# define QSE_LCHOWN(path,owner,group) lchown(path,owner,group)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_link)
|
||||
# define QSE_LINK(oldpath,newpath) syscall(SYS_link,oldpath,newpath)
|
||||
#else
|
||||
# define QSE_LINK(oldpath,newpath) link(oldpath,newpath)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_lstat64)
|
||||
# define QSE_LSTAT64(path,stbuf) syscall(SYS_lstat64,path,stbuf)
|
||||
#elif defined(HAVE_lstat64)
|
||||
# define QSE_LSTAT64(path,stbuf) lstat64(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_lstat)
|
||||
# define QSE_LSTAT(path,stbuf) syscall(SYS_lstat,path,stbuf)
|
||||
#else
|
||||
# define QSE_LSTAT(path,stbuf) lstat(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_rename)
|
||||
# define QSE_RENAME(oldpath,newpath) syscall(SYS_rename,oldpath,newpath)
|
||||
#else
|
||||
# define QSE_RENAME(oldpath,newpath) rename(oldpath,newpath)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_rmdir)
|
||||
# define QSE_RMDIR(path) syscall(SYS_rmdir,path)
|
||||
#else
|
||||
# define QSE_RMDIR(path) rmdir(path)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_stat64)
|
||||
# define QSE_STAT64(path,stbuf) syscall(SYS_stat64,path,stbuf)
|
||||
#elif defined(HAVE_stat64)
|
||||
# define QSE_STAT64(path,stbuf) stat64(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_stat)
|
||||
# define QSE_STAT(path,stbuf) syscall(SYS_stat,path,stbuf)
|
||||
#else
|
||||
# define QSE_STAT(path,stbuf) stat(path,stbuf)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_symlink)
|
||||
# define QSE_SYMLINK(oldpath,newpath) syscall(SYS_symlink,oldpath,newpath)
|
||||
#else
|
||||
# define QSE_SYMLINK(oldpath,newpath) symlink(oldpath,newpath)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_unlink)
|
||||
# define QSE_UNLINK(path) syscall(SYS_unlink,path)
|
||||
#else
|
||||
# define QSE_UNLINK(path) unlink(path)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_utime)
|
||||
# define QSE_UTIME(path,t) syscall(SYS_utime,path,t)
|
||||
#else
|
||||
# define QSE_UTIME(path,t) utime(path,t)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_utimes)
|
||||
# define QSE_UTIMES(path,t) syscall(SYS_utimes,path,t)
|
||||
#else
|
||||
# define QSE_UTIMES(path,t) utimes(path,t)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
SUBDIRS = cmn awk cut sed fs net
|
||||
SUBDIRS = cmn awk cut sed net
|
||||
|
@ -231,7 +231,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = cmn awk cut sed fs net
|
||||
SUBDIRS = cmn awk cut sed net
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
@ -6,7 +6,7 @@ AM_CPPFLAGS = \
|
||||
-I$(includedir)
|
||||
|
||||
|
||||
bin_PROGRAMS = xma fma pma chr str sll dll lda oht htb rbt fio01 fio02 pio sio time main main2 rex01 env path01 tre01 fmt01 fmt02
|
||||
bin_PROGRAMS = xma fma pma chr str sll dll lda oht htb rbt fio01 fio02 pio sio time main main2 rex01 env path01 tre01 fmt01 fmt02 fs01
|
||||
|
||||
LDFLAGS = -L../../lib/cmn
|
||||
LDADD = -lqsecmn
|
||||
@ -35,6 +35,7 @@ path01_SOURCES = path01.c
|
||||
tre01_SOURCES = tre01.c
|
||||
fmt01_SOURCES = fmt01.c
|
||||
fmt02_SOURCES = fmt02.c
|
||||
fs01_SOURCES = fs01.c
|
||||
|
||||
if ENABLE_CXX
|
||||
|
||||
|
@ -39,7 +39,8 @@ bin_PROGRAMS = xma$(EXEEXT) fma$(EXEEXT) pma$(EXEEXT) chr$(EXEEXT) \
|
||||
oht$(EXEEXT) htb$(EXEEXT) rbt$(EXEEXT) fio01$(EXEEXT) \
|
||||
fio02$(EXEEXT) pio$(EXEEXT) sio$(EXEEXT) time$(EXEEXT) \
|
||||
main$(EXEEXT) main2$(EXEEXT) rex01$(EXEEXT) env$(EXEEXT) \
|
||||
path01$(EXEEXT) tre01$(EXEEXT) fmt01$(EXEEXT) fmt02$(EXEEXT)
|
||||
path01$(EXEEXT) tre01$(EXEEXT) fmt01$(EXEEXT) fmt02$(EXEEXT) \
|
||||
fs01$(EXEEXT)
|
||||
subdir = samples/cmn
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@ -88,6 +89,10 @@ am_fmt02_OBJECTS = fmt02.$(OBJEXT)
|
||||
fmt02_OBJECTS = $(am_fmt02_OBJECTS)
|
||||
fmt02_LDADD = $(LDADD)
|
||||
fmt02_DEPENDENCIES =
|
||||
am_fs01_OBJECTS = fs01.$(OBJEXT)
|
||||
fs01_OBJECTS = $(am_fs01_OBJECTS)
|
||||
fs01_LDADD = $(LDADD)
|
||||
fs01_DEPENDENCIES =
|
||||
am_htb_OBJECTS = htb.$(OBJEXT)
|
||||
htb_OBJECTS = $(am_htb_OBJECTS)
|
||||
htb_LDADD = $(LDADD)
|
||||
@ -167,18 +172,18 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
||||
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(htb_SOURCES) \
|
||||
$(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) $(oht_SOURCES) \
|
||||
$(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) \
|
||||
$(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) $(str_SOURCES) \
|
||||
$(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
||||
$(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) \
|
||||
$(oht_SOURCES) $(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) \
|
||||
$(rbt_SOURCES) $(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) \
|
||||
$(str_SOURCES) $(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
||||
DIST_SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
||||
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(htb_SOURCES) \
|
||||
$(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) $(oht_SOURCES) \
|
||||
$(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) \
|
||||
$(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) $(str_SOURCES) \
|
||||
$(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
||||
$(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) \
|
||||
$(oht_SOURCES) $(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) \
|
||||
$(rbt_SOURCES) $(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) \
|
||||
$(str_SOURCES) $(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@ -354,6 +359,7 @@ path01_SOURCES = path01.c
|
||||
tre01_SOURCES = tre01.c
|
||||
fmt01_SOURCES = fmt01.c
|
||||
fmt02_SOURCES = fmt02.c
|
||||
fs01_SOURCES = fs01.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -455,6 +461,9 @@ fmt01$(EXEEXT): $(fmt01_OBJECTS) $(fmt01_DEPENDENCIES)
|
||||
fmt02$(EXEEXT): $(fmt02_OBJECTS) $(fmt02_DEPENDENCIES)
|
||||
@rm -f fmt02$(EXEEXT)
|
||||
$(LINK) $(fmt02_OBJECTS) $(fmt02_LDADD) $(LIBS)
|
||||
fs01$(EXEEXT): $(fs01_OBJECTS) $(fs01_DEPENDENCIES)
|
||||
@rm -f fs01$(EXEEXT)
|
||||
$(LINK) $(fs01_OBJECTS) $(fs01_LDADD) $(LIBS)
|
||||
htb$(EXEEXT): $(htb_OBJECTS) $(htb_DEPENDENCIES)
|
||||
@rm -f htb$(EXEEXT)
|
||||
$(LINK) $(htb_OBJECTS) $(htb_LDADD) $(LIBS)
|
||||
@ -518,6 +527,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt02.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
|
73
qse/samples/cmn/fs01.c
Normal file
73
qse/samples/cmn/fs01.c
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
#include <qse/cmn/fs.h>
|
||||
#include <qse/cmn/stdio.h>
|
||||
#include <qse/cmn/main.h>
|
||||
|
||||
static void list (qse_fs_t* fs, const qse_char_t* name)
|
||||
{
|
||||
qse_fs_ent_t* ent;
|
||||
|
||||
if (qse_fs_chdir (fs, name) <= -1)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Error: Cannot change directory to %s - %s\n"), name, qse_fs_geterrmsg(fs));
|
||||
return;
|
||||
}
|
||||
|
||||
qse_printf (QSE_T("----------------------------------------------------------------\n"), fs->curdir);
|
||||
qse_printf (QSE_T("CURRENT DIRECTORY: [%s]\n"), fs->curdir);
|
||||
qse_printf (QSE_T("----------------------------------------------------------------\n"), fs->curdir);
|
||||
|
||||
do
|
||||
{
|
||||
qse_btime_t bt;
|
||||
|
||||
ent = qse_fs_read (fs, QSE_FS_ENT_SIZE | QSE_FS_ENT_TYPE | QSE_FS_ENT_TIME);
|
||||
if (ent == QSE_NULL)
|
||||
{
|
||||
qse_fs_errnum_t e = qse_fs_geterrnum(fs);
|
||||
if (e != QSE_FS_ENOERR)
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Error: Read error - %s\n"), qse_fs_geterrmsg(fs));
|
||||
break;
|
||||
}
|
||||
|
||||
qse_localtime (ent->time.modify, &bt);
|
||||
qse_printf (QSE_T("%s %16lu %04d-%02d-%02d %02d:%02d %s\n"),
|
||||
((ent->type == QSE_FS_ENT_SUBDIR)? QSE_T("<D>"): QSE_T(" ")),
|
||||
(unsigned long)ent->size,
|
||||
bt.year + 1900, bt.mon+1, bt.mday, bt.hour, bt.min,
|
||||
ent->name.base
|
||||
);
|
||||
}
|
||||
while (1);
|
||||
|
||||
}
|
||||
|
||||
int fs_main (int argc, qse_char_t* argv[])
|
||||
{
|
||||
qse_fs_t* fs;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Usage: %s <directory>\n"), argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fs = qse_fs_open (QSE_NULL, 0);
|
||||
if (fs == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Error: Cannot open directory\n"), argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
list (fs, argv[1]);
|
||||
list (fs, QSE_T(".."));
|
||||
|
||||
qse_fs_close (fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qse_main (int argc, qse_achar_t* argv[])
|
||||
{
|
||||
return qse_runmain (argc, argv, fs_main);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user