cleaned up code
This commit is contained in:
parent
0dcee7baac
commit
eac1febfad
@ -9355,9 +9355,3 @@ int moo_compile (moo_t* moo, moo_ioimpl_t io)
|
|||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moo_getsynerr (moo_t* moo, moo_synerr_t* synerr)
|
|
||||||
{
|
|
||||||
MOO_ASSERT (moo, moo->c != MOO_NULL);
|
|
||||||
if (synerr) *synerr = moo->c->synerr;
|
|
||||||
}
|
|
||||||
|
129
moo/lib/err.c
129
moo/lib/err.c
@ -26,10 +26,6 @@
|
|||||||
|
|
||||||
#include "moo-prv.h"
|
#include "moo-prv.h"
|
||||||
|
|
||||||
#if defined(MOO_ENABLE_LIBUNWIND)
|
|
||||||
# include <libunwind.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* BEGIN: GENERATED WITH generr.moo */
|
/* BEGIN: GENERATED WITH generr.moo */
|
||||||
|
|
||||||
static moo_ooch_t errstr_0[] = {'n','o',' ','e','r','r','o','r','\0'};
|
static moo_ooch_t errstr_0[] = {'n','o',' ','e','r','r','o','r','\0'};
|
||||||
@ -184,52 +180,9 @@ static const moo_ooch_t* synerr_to_errstr (moo_synerrnum_t errnum)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
|
||||||
* SYSTEM DEPENDENT FUNCTIONS
|
|
||||||
* -------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#if defined(HAVE_EXECINFO_H)
|
|
||||||
# include <execinfo.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
# include <windows.h>
|
|
||||||
# include <errno.h>
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
# define INCL_DOSPROCESS
|
|
||||||
# define INCL_DOSFILEMGR
|
|
||||||
# define INCL_DOSERRORS
|
|
||||||
# include <os2.h>
|
|
||||||
#elif defined(__DOS__)
|
|
||||||
# include <dos.h>
|
|
||||||
# if defined(_INTELC32_)
|
|
||||||
# define DOS_EXIT 0x4C
|
|
||||||
# else
|
|
||||||
# include <dosfunc.h>
|
|
||||||
# endif
|
|
||||||
# include <errno.h>
|
|
||||||
#elif defined(vms) || defined(__vms)
|
|
||||||
# define __NEW_STARLET 1
|
|
||||||
# include <starlet.h> /* (SYS$...) */
|
|
||||||
# include <ssdef.h> /* (SS$...) */
|
|
||||||
# include <lib$routines.h> /* (lib$...) */
|
|
||||||
#elif defined(macintosh)
|
|
||||||
# include <MacErrors.h>
|
|
||||||
# include <Process.h>
|
|
||||||
# include <Dialogs.h>
|
|
||||||
# include <TextUtils.h>
|
|
||||||
#else
|
|
||||||
# include <sys/types.h>
|
|
||||||
# include <unistd.h>
|
|
||||||
# include <signal.h>
|
|
||||||
# include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
* ERROR NUMBER/MESSAGE HANDLING
|
* ERROR NUMBER/MESSAGE HANDLING
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
const moo_ooch_t* moo_geterrstr (moo_t* moo)
|
const moo_ooch_t* moo_geterrstr (moo_t* moo)
|
||||||
{
|
{
|
||||||
return moo_errnum_to_errstr (moo->errnum);
|
return moo_errnum_to_errstr (moo->errnum);
|
||||||
@ -262,13 +215,13 @@ void moo_seterrwithsyserr (moo_t* moo, int syserr_type, int syserr_code)
|
|||||||
|
|
||||||
if (moo->vmprim.syserrstrb)
|
if (moo->vmprim.syserrstrb)
|
||||||
{
|
{
|
||||||
errnum = moo->vmprim.syserrstrb (moo, syserr_type, syserr_code, moo->errmsg.tmpbuf.bch, MOO_COUNTOF(moo->errmsg.tmpbuf.bch));
|
errnum = moo->vmprim.syserrstrb(moo, syserr_type, syserr_code, moo->errmsg.tmpbuf.bch, MOO_COUNTOF(moo->errmsg.tmpbuf.bch));
|
||||||
moo_seterrbfmt (moo, errnum, "%hs", moo->errmsg.tmpbuf.bch);
|
moo_seterrbfmt (moo, errnum, "%hs", moo->errmsg.tmpbuf.bch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MOO_ASSERT (moo, moo->vmprim.syserrstru != MOO_NULL);
|
MOO_ASSERT (moo, moo->vmprim.syserrstru != MOO_NULL);
|
||||||
errnum = moo->vmprim.syserrstru (moo, syserr_type, syserr_code, moo->errmsg.tmpbuf.uch, MOO_COUNTOF(moo->errmsg.tmpbuf.uch));
|
errnum = moo->vmprim.syserrstru(moo, syserr_type, syserr_code, moo->errmsg.tmpbuf.uch, MOO_COUNTOF(moo->errmsg.tmpbuf.uch));
|
||||||
moo_seterrbfmt (moo, errnum, "%ls", moo->errmsg.tmpbuf.uch);
|
moo_seterrbfmt (moo, errnum, "%ls", moo->errmsg.tmpbuf.uch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,13 +358,69 @@ void moo_setsynerr (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, con
|
|||||||
{
|
{
|
||||||
moo_setsynerrbfmt (moo, num, loc, tgt, MOO_NULL);
|
moo_setsynerrbfmt (moo, num, loc, tgt, MOO_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void moo_getsynerr (moo_t* moo, moo_synerr_t* synerr)
|
||||||
|
{
|
||||||
|
MOO_ASSERT (moo, moo->c != MOO_NULL);
|
||||||
|
if (synerr) *synerr = moo->c->synerr;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
* STACK FRAME BACKTRACE
|
* ASSERTION SUPPORT
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#if defined(MOO_BUILD_RELEASE)
|
||||||
|
|
||||||
|
void moo_assertfailed (moo_t* moo, const moo_bch_t* expr, const moo_bch_t* file, moo_oow_t line)
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* defined(MOO_BUILD_RELEASE) */
|
||||||
|
|
||||||
#if defined(MOO_ENABLE_LIBUNWIND)
|
#if defined(MOO_ENABLE_LIBUNWIND)
|
||||||
void moo_backtrace (moo_t* moo)
|
# include <libunwind.h>
|
||||||
|
#elif defined(HAVE_EXECINFO_H)
|
||||||
|
# include <execinfo.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
# include <errno.h>
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
# define INCL_DOSPROCESS
|
||||||
|
# define INCL_DOSFILEMGR
|
||||||
|
# define INCL_DOSERRORS
|
||||||
|
# include <os2.h>
|
||||||
|
#elif defined(__DOS__)
|
||||||
|
# include <dos.h>
|
||||||
|
# if defined(_INTELC32_)
|
||||||
|
# define DOS_EXIT 0x4C
|
||||||
|
# else
|
||||||
|
# include <dosfunc.h>
|
||||||
|
# endif
|
||||||
|
# include <errno.h>
|
||||||
|
#elif defined(vms) || defined(__vms)
|
||||||
|
# define __NEW_STARLET 1
|
||||||
|
# include <starlet.h> /* (SYS$...) */
|
||||||
|
# include <ssdef.h> /* (SS$...) */
|
||||||
|
# include <lib$routines.h> /* (lib$...) */
|
||||||
|
#elif defined(macintosh)
|
||||||
|
# include <MacErrors.h>
|
||||||
|
# include <Process.h>
|
||||||
|
# include <Dialogs.h>
|
||||||
|
# include <TextUtils.h>
|
||||||
|
#else
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <signal.h>
|
||||||
|
# include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MOO_ENABLE_LIBUNWIND)
|
||||||
|
static void backtrace_stack_frames (moo_t* moo)
|
||||||
{
|
{
|
||||||
unw_cursor_t cursor;
|
unw_cursor_t cursor;
|
||||||
unw_context_t context;
|
unw_context_t context;
|
||||||
@ -440,7 +449,7 @@ void moo_backtrace (moo_t* moo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_BACKTRACE)
|
#elif defined(HAVE_BACKTRACE)
|
||||||
void moo_backtrace (moo_t* moo)
|
static void backtrace_stack_frames (moo_t* moo)
|
||||||
{
|
{
|
||||||
void* btarray[128];
|
void* btarray[128];
|
||||||
moo_oow_t btsize;
|
moo_oow_t btsize;
|
||||||
@ -461,24 +470,16 @@ void moo_backtrace (moo_t* moo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void moo_backtrace (moo_t* moo)
|
static void backtrace_stack_frames (moo_t* moo)
|
||||||
{
|
{
|
||||||
/* do nothing. not supported */
|
/* do nothing. not supported */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
|
||||||
* ASSERTION FAILURE HANDLER
|
|
||||||
* -------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
void moo_assertfailed (moo_t* moo, const moo_bch_t* expr, const moo_bch_t* file, moo_oow_t line)
|
void moo_assertfailed (moo_t* moo, const moo_bch_t* expr, const moo_bch_t* file, moo_oow_t line)
|
||||||
{
|
{
|
||||||
#if defined(MOO_BUILD_RELEASE)
|
|
||||||
/* do nothing */
|
|
||||||
#else
|
|
||||||
moo_logbfmt (moo, MOO_LOG_UNTYPED | MOO_LOG_FATAL, "ASSERTION FAILURE: %s at %s:%zu\n", expr, file, line);
|
moo_logbfmt (moo, MOO_LOG_UNTYPED | MOO_LOG_FATAL, "ASSERTION FAILURE: %s at %s:%zu\n", expr, file, line);
|
||||||
moo_backtrace (moo);
|
backtrace_stack_frames (moo);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ExitProcess (249);
|
ExitProcess (249);
|
||||||
@ -505,6 +506,6 @@ void moo_assertfailed (moo_t* moo, const moo_bch_t* expr, const moo_bch_t* file,
|
|||||||
kill (getpid(), SIGABRT);
|
kill (getpid(), SIGABRT);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MOO_BUILD_RELEASE) */
|
||||||
|
119
moo/lib/main.c
119
moo/lib/main.c
@ -43,16 +43,12 @@
|
|||||||
# include <time.h>
|
# include <time.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
# include <errno.h>
|
||||||
# if defined(MOO_HAVE_CFG_H) && defined(MOO_ENABLE_LIBLTDL)
|
# if defined(MOO_HAVE_CFG_H) && defined(MOO_ENABLE_LIBLTDL)
|
||||||
# include <ltdl.h>
|
# include <ltdl.h>
|
||||||
# define USE_LTDL
|
# define USE_LTDL
|
||||||
# else
|
# else
|
||||||
# define USE_WIN_DLL
|
# define USE_WIN_DLL
|
||||||
# define sys_dl_error() win_dlerror()
|
|
||||||
# define sys_dl_open(x) LoadLibraryExA(x, MOO_NULL, 0)
|
|
||||||
# define sys_dl_openext(x) LoadLibraryExA(x, MOO_NULL, 0)
|
|
||||||
# define sys_dl_close(x) FreeLibrary(x)
|
|
||||||
# define sys_dl_getsym(x,n) GetProcAddress(x,n)
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# include "poll-msw.h"
|
# include "poll-msw.h"
|
||||||
@ -103,27 +99,12 @@
|
|||||||
# if defined(MOO_ENABLE_LIBLTDL)
|
# if defined(MOO_ENABLE_LIBLTDL)
|
||||||
# include <ltdl.h>
|
# include <ltdl.h>
|
||||||
# define USE_LTDL
|
# define USE_LTDL
|
||||||
# define sys_dl_error() lt_dlerror()
|
|
||||||
# define sys_dl_open(x) lt_dlopen(x)
|
|
||||||
# define sys_dl_openext(x) lt_dlopenext(x)
|
|
||||||
# define sys_dl_close(x) lt_dlclose(x)
|
|
||||||
# define sys_dl_getsym(x,n) lt_dlsym(x,n)
|
|
||||||
# elif defined(HAVE_DLFCN_H)
|
# elif defined(HAVE_DLFCN_H)
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# define USE_DLFCN
|
# define USE_DLFCN
|
||||||
# define sys_dl_error() dlerror()
|
|
||||||
# define sys_dl_open(x) dlopen(x,RTLD_NOW)
|
|
||||||
# define sys_dl_openext(x) dlopen(x,RTLD_NOW)
|
|
||||||
# define sys_dl_close(x) dlclose(x)
|
|
||||||
# define sys_dl_getsym(x,n) dlsym(x,n)
|
|
||||||
# elif defined(__APPLE__) || defined(__MACOSX__)
|
# elif defined(__APPLE__) || defined(__MACOSX__)
|
||||||
# define USE_MACH_O_DYLD
|
# define USE_MACH_O_DYLD
|
||||||
# include <mach-o/dyld.h>
|
# include <mach-o/dyld.h>
|
||||||
# define sys_dl_error() mach_dlerror()
|
|
||||||
# define sys_dl_open(x) mach_dlopen(x)
|
|
||||||
# define sys_dl_openext(x) mach_dlopen(x)
|
|
||||||
# define sys_dl_close(x) mach_dlclose(x)
|
|
||||||
# define sys_dl_getsym(x,n) mach_dlsym(x,n)
|
|
||||||
# else
|
# else
|
||||||
# error UNSUPPORTED DYNAMIC LINKER
|
# error UNSUPPORTED DYNAMIC LINKER
|
||||||
# endif
|
# endif
|
||||||
@ -880,7 +861,37 @@ static moo_errnum_t errno_to_errnum (int errcode)
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static moo_errnum_t winerr_to_errnum (DWORD errcode)
|
static moo_errnum_t winerr_to_errnum (DWORD errcode)
|
||||||
{
|
{
|
||||||
|
switch (errcode)
|
||||||
|
{
|
||||||
|
case ERROR_NOT_ENOUGH_MEMORY:
|
||||||
|
case ERROR_OUTOFMEMORY:
|
||||||
|
return MOO_ESYSMEM;
|
||||||
|
|
||||||
|
case ERROR_INVALID_PARAMETER:
|
||||||
|
case ERROR_INVALID_NAME:
|
||||||
|
return MOO_EINVAL;
|
||||||
|
|
||||||
|
case ERROR_INVALID_HANDLE:
|
||||||
|
return MOO_EBADHND;
|
||||||
|
|
||||||
|
case ERROR_ACCESS_DENIED:
|
||||||
|
case ERROR_SHARING_VIOLATION:
|
||||||
|
return MOO_EACCES;
|
||||||
|
|
||||||
|
case ERROR_FILE_NOT_FOUND:
|
||||||
|
case ERROR_PATH_NOT_FOUND:
|
||||||
|
return MOO_ENOENT;
|
||||||
|
|
||||||
|
case ERROR_ALREADY_EXISTS:
|
||||||
|
case ERROR_FILE_EXISTS:
|
||||||
|
return MOO_EEXIST;
|
||||||
|
|
||||||
|
case ERROR_BROKEN_PIPE:
|
||||||
|
return MOO_EPIPE;
|
||||||
|
|
||||||
|
default:
|
||||||
return MOO_ESYSERR;
|
return MOO_ESYSERR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -894,10 +905,12 @@ static moo_errnum_t os2err_to_errnum (APIRET errcode)
|
|||||||
return MOO_ESYSMEM;
|
return MOO_ESYSMEM;
|
||||||
|
|
||||||
case ERROR_INVALID_PARAMETER:
|
case ERROR_INVALID_PARAMETER:
|
||||||
case ERROR_INVALID_HANDLE:
|
|
||||||
case ERROR_INVALID_NAME:
|
case ERROR_INVALID_NAME:
|
||||||
return MOO_EINVAL;
|
return MOO_EINVAL;
|
||||||
|
|
||||||
|
case ERROR_INVALID_HANDLE:
|
||||||
|
return MOO_EBADHND;
|
||||||
|
|
||||||
case ERROR_ACCESS_DENIED:
|
case ERROR_ACCESS_DENIED:
|
||||||
case ERROR_SHARING_VIOLATION:
|
case ERROR_SHARING_VIOLATION:
|
||||||
return MOO_EACCES;
|
return MOO_EACCES;
|
||||||
@ -947,6 +960,8 @@ static moo_errnum_t syserrstrb (moo_t* moo, int syserr_type, int syserr_code, mo
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
rc = FormatMessageA (
|
rc = FormatMessageA (
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
@ -954,14 +969,15 @@ static moo_errnum_t syserrstrb (moo_t* moo, int syserr_type, int syserr_code, mo
|
|||||||
buf, len, MOO_NULL
|
buf, len, MOO_NULL
|
||||||
);
|
);
|
||||||
while (rc > 0 && buf[rc - 1] == '\r' || buf[rc - 1] == '\n') buf[--rc] = '\0';
|
while (rc > 0 && buf[rc - 1] == '\r' || buf[rc - 1] == '\n') buf[--rc] = '\0';
|
||||||
|
}
|
||||||
return winerr_to_errnum(syserr_code);
|
return winerr_to_errnum(syserr_code);
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
/* TODO: convert code to string */
|
/* TODO: convert code to string */
|
||||||
moo_copy_bcstr (buf, len, "system error");
|
if (buf) moo_copy_bcstr (buf, len, "system error");
|
||||||
return os2err_to_errnum(syserr_code);
|
return os2err_to_errnum(syserr_code);
|
||||||
#elif defined(macintosh)
|
#elif defined(macintosh)
|
||||||
/* TODO: convert code to string */
|
/* TODO: convert code to string */
|
||||||
moo_copy_bcstr (buf, len, "system error");
|
if (buf) moo_copy_bcstr (buf, len, "system error");
|
||||||
return os2err_to_errnum(syserr_code);
|
return os2err_to_errnum(syserr_code);
|
||||||
#else
|
#else
|
||||||
/* in other systems, errno is still the native system error code.
|
/* in other systems, errno is still the native system error code.
|
||||||
@ -970,21 +986,49 @@ static moo_errnum_t syserrstrb (moo_t* moo, int syserr_type, int syserr_code, mo
|
|||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
#if defined(HAVE_STRERROR_R)
|
#if defined(HAVE_STRERROR_R)
|
||||||
strerror_r (syserr_code, buf, len);
|
if (buf) strerror_r (syserr_code, buf, len);
|
||||||
#else
|
#else
|
||||||
/* this is not thread safe */
|
/* this is not thread safe */
|
||||||
moo_copy_bcstr (buf, len, strerror(syserr_code));
|
if (buf) moo_copy_bcstr (buf, len, strerror(syserr_code));
|
||||||
#endif
|
#endif
|
||||||
return errno_to_errnum(syserr_code);
|
return errno_to_errnum(syserr_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
moo_copy_bcstr (buf, len, "system error");
|
if (buf) moo_copy_bcstr (buf, len, "system error");
|
||||||
return MOO_ESYSERR;
|
return MOO_ESYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
|
||||||
|
#if defined(USE_LTDL)
|
||||||
|
# define sys_dl_error() lt_dlerror()
|
||||||
|
# define sys_dl_open(x) lt_dlopen(x)
|
||||||
|
# define sys_dl_openext(x) lt_dlopenext(x)
|
||||||
|
# define sys_dl_close(x) lt_dlclose(x)
|
||||||
|
# define sys_dl_getsym(x,n) lt_dlsym(x,n)
|
||||||
|
|
||||||
|
#elif defined(USE_DLFCN)
|
||||||
|
# define sys_dl_error() dlerror()
|
||||||
|
# define sys_dl_open(x) dlopen(x,RTLD_NOW)
|
||||||
|
# define sys_dl_openext(x) dlopen(x,RTLD_NOW)
|
||||||
|
# define sys_dl_close(x) dlclose(x)
|
||||||
|
# define sys_dl_getsym(x,n) dlsym(x,n)
|
||||||
|
|
||||||
|
#elif defined(USE_WIN_DLL)
|
||||||
|
# define sys_dl_error() win_dlerror()
|
||||||
|
# define sys_dl_open(x) LoadLibraryExA(x, MOO_NULL, 0)
|
||||||
|
# define sys_dl_openext(x) LoadLibraryExA(x, MOO_NULL, 0)
|
||||||
|
# define sys_dl_close(x) FreeLibrary(x)
|
||||||
|
# define sys_dl_getsym(x,n) GetProcAddress(x,n)
|
||||||
|
|
||||||
|
#elif defined(USE_MACH_O_DYLD)
|
||||||
|
# define sys_dl_error() mach_dlerror()
|
||||||
|
# define sys_dl_open(x) mach_dlopen(x)
|
||||||
|
# define sys_dl_openext(x) mach_dlopen(x)
|
||||||
|
# define sys_dl_close(x) mach_dlclose(x)
|
||||||
|
# define sys_dl_getsym(x,n) mach_dlsym(x,n)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_WIN_DLL)
|
#if defined(USE_WIN_DLL)
|
||||||
|
|
||||||
static const char* win_dlerror (void)
|
static const char* win_dlerror (void)
|
||||||
@ -1857,15 +1901,6 @@ static void vm_gettime (moo_t* moo, moo_ntime_t* now)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__DOS__)
|
|
||||||
# if defined(_INTELC32_)
|
|
||||||
void _halt_cpu (void);
|
|
||||||
# elif defined(__WATCOMC__)
|
|
||||||
void _halt_cpu (void);
|
|
||||||
# pragma aux _halt_cpu = "hlt"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int vm_muxadd (moo_t* moo, moo_ooi_t io_handle, moo_ooi_t mask)
|
static int vm_muxadd (moo_t* moo, moo_ooi_t io_handle, moo_ooi_t mask)
|
||||||
{
|
{
|
||||||
int event_mask;
|
int event_mask;
|
||||||
@ -2290,6 +2325,15 @@ static void vm_muxwait (moo_t* moo, const moo_ntime_t* dur, moo_vmprim_muxwait_c
|
|||||||
#endif /* USE_THREAD */
|
#endif /* USE_THREAD */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__DOS__)
|
||||||
|
# if defined(_INTELC32_)
|
||||||
|
void _halt_cpu (void);
|
||||||
|
# elif defined(__WATCOMC__)
|
||||||
|
void _halt_cpu (void);
|
||||||
|
# pragma aux _halt_cpu = "hlt"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static void vm_sleep (moo_t* moo, const moo_ntime_t* dur)
|
static void vm_sleep (moo_t* moo, const moo_ntime_t* dur)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -2297,8 +2341,7 @@ static void vm_sleep (moo_t* moo, const moo_ntime_t* dur)
|
|||||||
if (xtn->waitable_timer)
|
if (xtn->waitable_timer)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
goto normal_sleep;
|
li.QuadPart = -(MOO_SECNSEC_TO_NSEC(dur->sec, dur->nsec) / 100); /* in 100 nanoseconds */
|
||||||
li.QuadPart = -MOO_SECNSEC_TO_NSEC(dur->sec, dur->nsec);
|
|
||||||
if(SetWaitableTimer(xtn->waitable_timer, &li, 0, MOO_NULL, MOO_NULL, FALSE) == FALSE) goto normal_sleep;
|
if(SetWaitableTimer(xtn->waitable_timer, &li, 0, MOO_NULL, MOO_NULL, FALSE) == FALSE) goto normal_sleep;
|
||||||
WaitForSingleObject(xtn->waitable_timer, INFINITE);
|
WaitForSingleObject(xtn->waitable_timer, INFINITE);
|
||||||
}
|
}
|
||||||
|
@ -2288,10 +2288,6 @@ MOO_EXPORT int moo_decode (
|
|||||||
const moo_oocs_t* classfqn
|
const moo_oocs_t* classfqn
|
||||||
);
|
);
|
||||||
|
|
||||||
MOO_EXPORT void moo_backtrace (
|
|
||||||
moo_t* moo
|
|
||||||
);
|
|
||||||
|
|
||||||
MOO_EXPORT void moo_assertfailed (
|
MOO_EXPORT void moo_assertfailed (
|
||||||
moo_t* moo,
|
moo_t* moo,
|
||||||
const moo_bch_t* expr,
|
const moo_bch_t* expr,
|
||||||
|
Loading…
Reference in New Issue
Block a user