removed stdio.h stdio.c
This commit is contained in:
@ -116,38 +116,38 @@ static qse_mmgr_t xma_mmgr =
|
||||
|
||||
static void print_version (void)
|
||||
{
|
||||
qse_putstrf (QSE_T("QSEXLI version %hs\n"), QSE_PACKAGE_VERSION);
|
||||
qse_printf (QSE_T("QSEXLI version %hs\n"), QSE_PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
static void print_usage (qse_sio_t* out, int argc, qse_char_t* argv[])
|
||||
{
|
||||
const qse_char_t* b = qse_basename (argv[0]);
|
||||
|
||||
qse_sio_putstrf (out, QSE_T("USAGE: %s [options] -i input-file [key]\n"), b);
|
||||
qse_fprintf (out, QSE_T("USAGE: %s [options] -i input-file [key]\n"), b);
|
||||
|
||||
qse_sio_putstrf (out, QSE_T("options as follows:\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -h/--help show this message\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" --version show version\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -i file specify an input file\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -o file specify an output file\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -u disallow duplicate keys\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -a allow a key alias\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -f keep file inclusion info\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -t keep comment text\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -s allow multi-segmented strings\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -d allow a leading digit in identifiers\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -n disallow nil\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -l disallow lists\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -K allow key tags\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -S allow string tags\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -v perform validation\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
|
||||
qse_fprintf (out, QSE_T("options as follows:\n"));
|
||||
qse_fprintf (out, QSE_T(" -h/--help show this message\n"));
|
||||
qse_fprintf (out, QSE_T(" --version show version\n"));
|
||||
qse_fprintf (out, QSE_T(" -i file specify an input file\n"));
|
||||
qse_fprintf (out, QSE_T(" -o file specify an output file\n"));
|
||||
qse_fprintf (out, QSE_T(" -u disallow duplicate keys\n"));
|
||||
qse_fprintf (out, QSE_T(" -a allow a key alias\n"));
|
||||
qse_fprintf (out, QSE_T(" -f keep file inclusion info\n"));
|
||||
qse_fprintf (out, QSE_T(" -t keep comment text\n"));
|
||||
qse_fprintf (out, QSE_T(" -s allow multi-segmented strings\n"));
|
||||
qse_fprintf (out, QSE_T(" -d allow a leading digit in identifiers\n"));
|
||||
qse_fprintf (out, QSE_T(" -n disallow nil\n"));
|
||||
qse_fprintf (out, QSE_T(" -l disallow lists\n"));
|
||||
qse_fprintf (out, QSE_T(" -K allow key tags\n"));
|
||||
qse_fprintf (out, QSE_T(" -S allow string tags\n"));
|
||||
qse_fprintf (out, QSE_T(" -v perform validation\n"));
|
||||
qse_fprintf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
|
||||
#if defined(QSE_BUILD_DEBUG)
|
||||
qse_sio_putstrf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
|
||||
qse_fprintf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
|
||||
#endif
|
||||
#if defined(QSE_CHAR_IS_WCHAR)
|
||||
qse_sio_putstrf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
|
||||
qse_sio_putstrf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
|
||||
qse_fprintf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
|
||||
qse_fprintf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -180,27 +180,27 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
switch (c)
|
||||
{
|
||||
default:
|
||||
print_usage (qse_getstderr(), argc, argv);
|
||||
print_usage (QSE_STDERR, argc, argv);
|
||||
goto oops;
|
||||
|
||||
case QSE_T('?'):
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: bad option - %c\n"),
|
||||
opt.opt
|
||||
);
|
||||
print_usage (qse_getstderr(), argc, argv);
|
||||
print_usage (QSE_STDERR, argc, argv);
|
||||
goto oops;
|
||||
|
||||
case QSE_T(':'):
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: bad parameter for %c\n"),
|
||||
opt.opt
|
||||
);
|
||||
print_usage (qse_getstderr(), argc, argv);
|
||||
print_usage (QSE_STDERR, argc, argv);
|
||||
goto oops;
|
||||
|
||||
case QSE_T('h'):
|
||||
print_usage (qse_getstdout(), argc, argv);
|
||||
print_usage (QSE_STDOUT, argc, argv);
|
||||
goto done;
|
||||
|
||||
case QSE_T('i'):
|
||||
@ -277,7 +277,7 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
g_infile_cmgr = qse_findcmgr (opt.arg);
|
||||
if (g_infile_cmgr == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
|
||||
goto oops;
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
g_outfile_cmgr = qse_findcmgr (opt.arg);
|
||||
if (g_outfile_cmgr == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
|
||||
goto oops;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
|
||||
if (!g_input_file)
|
||||
{
|
||||
print_usage (qse_getstderr(), argc, argv);
|
||||
print_usage (QSE_STDERR, argc, argv);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
|
||||
if (opt.ind < argc)
|
||||
{
|
||||
print_usage (qse_getstderr(), argc, argv);
|
||||
print_usage (QSE_STDERR, argc, argv);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ void print_exec_error (qse_xli_t* xli)
|
||||
const qse_xli_loc_t* errloc = qse_xli_geterrloc(xli);
|
||||
if (errloc->line > 0 || errloc->colm > 0)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot execute - %s at line %lu column %lu\n"),
|
||||
qse_xli_geterrmsg(xli),
|
||||
(unsigned long)errloc->line,
|
||||
@ -334,7 +334,7 @@ void print_exec_error (qse_xli_t* xli)
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot execute - %s\n"),
|
||||
qse_xli_geterrmsg(xli)
|
||||
);
|
||||
@ -368,7 +368,7 @@ static int xli_main (int argc, qse_char_t* argv[])
|
||||
xma_mmgr.ctx = qse_xma_open (QSE_MMGR_GETDFL(), 0, g_memlimit);
|
||||
if (xma_mmgr.ctx == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: cannot open memory heap\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open memory heap\n"));
|
||||
goto oops;
|
||||
}
|
||||
mmgr = &xma_mmgr;
|
||||
@ -377,7 +377,7 @@ static int xli_main (int argc, qse_char_t* argv[])
|
||||
xli = qse_xli_openstdwithmmgr (mmgr, 0, 0);
|
||||
if (xli == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: cannot open stream editor\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
||||
goto oops;
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
|
||||
if (errloc->line > 0 || errloc->colm > 0)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot read %s - %s at line %lu column %lu%s%s\n"),
|
||||
g_input_file,
|
||||
qse_xli_geterrmsg(xli),
|
||||
@ -506,7 +506,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot read %s - %s\n"),
|
||||
g_input_file,
|
||||
qse_xli_geterrmsg(xli)
|
||||
@ -525,7 +525,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
|
||||
if (qse_xli_insertpairwithstrs (xli, qse_xli_getroot(xli), QSE_NULL, QSE_T("test-key"), QSE_NULL, QSE_NULL, strs, QSE_COUNTOF(strs)) == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot insert a string pair - %s \n"),
|
||||
qse_xli_geterrmsg(xli)
|
||||
);
|
||||
@ -538,12 +538,12 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
qse_size_t count;
|
||||
|
||||
count = qse_xli_countpairs (xli, QSE_NULL, g_lookup_key);
|
||||
qse_putstrf (QSE_T("COUNT: %lu\n"), (unsigned long)count);
|
||||
qse_printf (QSE_T("COUNT: %lu\n"), (unsigned long)count);
|
||||
|
||||
pair = qse_xli_findpair (xli, QSE_NULL, g_lookup_key);
|
||||
if (pair == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(),
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot find %s - %s \n"),
|
||||
g_lookup_key,
|
||||
qse_xli_geterrmsg(xli)
|
||||
@ -555,15 +555,15 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
if (pair->val->type == QSE_XLI_STR)
|
||||
{
|
||||
qse_xli_str_t* str = (qse_xli_str_t*)pair->val;
|
||||
qse_putstrf (QSE_T("[%.*s]\n"), (int)str->len, str->ptr);
|
||||
qse_printf (QSE_T("[%.*s]\n"), (int)str->len, str->ptr);
|
||||
}
|
||||
else if (pair->val->type == QSE_XLI_NIL)
|
||||
{
|
||||
qse_putstrf (QSE_T("#NIL\n"));
|
||||
qse_printf (QSE_T("#NIL\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_putstrf (QSE_T("#LIST\n"));
|
||||
qse_printf (QSE_T("#LIST\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -581,13 +581,13 @@ oops:
|
||||
#if defined(QSE_BUILD_DEBUG)
|
||||
if (g_failmalloc > 0)
|
||||
{
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("\n"));
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
|
||||
qse_fprintf (QSE_STDERR, QSE_T("\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
|
||||
(unsigned long)debug_mmgr_alloc_count,
|
||||
(unsigned long)debug_mmgr_free_count,
|
||||
(unsigned long)debug_mmgr_realloc_count);
|
||||
qse_sio_putstrf (qse_getstderr(), QSE_T("-------------------------------------------------------\n"));
|
||||
qse_fprintf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user