touched up code and docs
This commit is contained in:
@ -22,7 +22,50 @@
|
||||
#ifndef NDEBUG
|
||||
|
||||
#include <qse/cmn/sio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include "syscall.h"
|
||||
#endif
|
||||
|
||||
#define NTOC(n) (((n) >= 10)? (((n) - 10) + QSE_T('A')): (n) + QSE_T('0'))
|
||||
#define WRITE_CHAR(c) \
|
||||
do { \
|
||||
qse_char_t __xxx_c = c; \
|
||||
if (qse_sio_putsn (QSE_SIO_ERR, &__xxx_c, 1) != 1) return -1; \
|
||||
} while (0)
|
||||
|
||||
static int write_num (qse_size_t x, int base)
|
||||
{
|
||||
qse_size_t last = x % base;
|
||||
qse_size_t y = 0;
|
||||
int dig = 0;
|
||||
|
||||
x = x / base;
|
||||
|
||||
while (x > 0)
|
||||
{
|
||||
y = y * base + (x % base);
|
||||
x = x / base;
|
||||
dig++;
|
||||
}
|
||||
|
||||
while (y > 0)
|
||||
{
|
||||
WRITE_CHAR (NTOC(y % base));
|
||||
y = y / base;
|
||||
dig--;
|
||||
}
|
||||
|
||||
while (dig > 0)
|
||||
{
|
||||
dig--;
|
||||
WRITE_CHAR (QSE_T('0'));
|
||||
}
|
||||
WRITE_CHAR (NTOC(last));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qse_assert_failed (
|
||||
const qse_char_t* expr, const qse_char_t* desc,
|
||||
@ -32,9 +75,9 @@ void qse_assert_failed (
|
||||
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("FILE "));
|
||||
qse_sio_puts (QSE_SIO_ERR, file);
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("LINE "));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" LINE "));
|
||||
|
||||
/*qse_sio_puts the number */
|
||||
write_num (line, 10);
|
||||
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(": "));
|
||||
qse_sio_puts (QSE_SIO_ERR, expr);
|
||||
@ -47,8 +90,14 @@ void qse_assert_failed (
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("\n"));
|
||||
}
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("================================================================================"));
|
||||
qse_sio_flush (QSE_SIO_ERR);
|
||||
|
||||
abort ();
|
||||
#ifdef _WIN32
|
||||
ExitProcess (1);
|
||||
#else
|
||||
QSE_KILL (QSE_GETPID(), SIGABRT);
|
||||
QSE_EXIT (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2676,7 +2676,7 @@ int qse_sed_exec (qse_sed_t* sed, qse_sed_io_fun_t inf, qse_sed_io_fun_t outf)
|
||||
if (c->negated) n = !n;
|
||||
if (n == 0)
|
||||
{
|
||||
c++;
|
||||
c = c->state.next;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user