From 7bca6927a92cc6f87655cbffe5c96df4b84adae7 Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 1 Jun 2023 22:28:07 -0500 Subject: [PATCH] fixed formatting --- src/_time.h | 69 ++++++++++++++++++++++++-------------------------- src/cbaselib.c | 7 ++--- src/cvm.c | 4 +-- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/_time.h b/src/_time.h index 3e729f6..37e909a 100644 --- a/src/_time.h +++ b/src/_time.h @@ -3,57 +3,54 @@ #ifdef _WIN32 -#include -#include +# include +# include -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) - #define DELTA_EPOCH_IN_MICROSECS 116444736000000000Ui64 -#else - #define DELTA_EPOCH_IN_MICROSECS 116444736000000000ULL -#endif +# if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) +# define DELTA_EPOCH_IN_MICROSECS 116444736000000000Ui64 +# else +# define DELTA_EPOCH_IN_MICROSECS 116444736000000000ULL +# endif struct timezone { - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ }; int gettimeofday(struct timeval *tv, struct timezone *tz) { - FILETIME ft; - unsigned __int64 tmpres = 0; - static int tzflag; + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; - if (NULL != tv) - { - GetSystemTimeAsFileTime(&ft); + if (NULL != tv) { + GetSystemTimeAsFileTime(&ft); - tmpres |= ft.dwHighDateTime; - tmpres <<= 32; - tmpres |= ft.dwLowDateTime; + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; - /*converting file time to unix epoch*/ - tmpres /= 10; /*convert into microseconds*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; - tv->tv_sec = (long)(tmpres / 1000000UL); - tv->tv_usec = (long)(tmpres % 1000000UL); - } - - if (NULL != tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; + /*converting file time to unix epoch*/ + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); } - tz->tz_minuteswest = _timezone / 60; - tz->tz_dsttime = _daylight; - } - return 0; + if (NULL != tz) { + if (!tzflag) { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; } #else -#include +# include #endif #endif \ No newline at end of file diff --git a/src/cbaselib.c b/src/cbaselib.c index 7e0df43..a6928dc 100644 --- a/src/cbaselib.c +++ b/src/cbaselib.c @@ -1,13 +1,13 @@ #include "cbaselib.h" +#include "_time.h" +#include "cdebug.h" #include "cmem.h" #include "cobj.h" #include "cvalue.h" -#include "cdebug.h" #include "cvm.h" #include -#include "_time.h" // ================================================================ [BASELIB] @@ -891,7 +891,8 @@ int cosmoB_vdisassemble(CState *state, int nargs, CValue *args) closure = cosmoV_readClosure(args[0]); // print the disasembly - disasmChunk(&closure->function->chunk, closure->function->name ? closure->function->name->str : UNNAMEDCHUNK, 0); + disasmChunk(&closure->function->chunk, + closure->function->name ? closure->function->name->str : UNNAMEDCHUNK, 0); return 0; } diff --git a/src/cvm.c b/src/cvm.c index 5b248b0..f2fb1d5 100644 --- a/src/cvm.c +++ b/src/cvm.c @@ -42,9 +42,9 @@ COSMO_API bool cosmoV_undump(CState *state, cosmo_Reader reader, const void *ud) return false; }; -#ifdef VM_DEBUG + // #ifdef VM_DEBUG disasmChunk(&func->chunk, func->name ? func->name->str : UNNAMEDCHUNK, 0); -#endif + // #endif // push function onto the stack so it doesn't it cleaned up by the GC, at the same stack // location put our closure