Added cwasm_arena.c and cwasm_debug.c. Arena API hasn't been tested well yet. There's also something wrong with our DebugOutputLineBuffer usage for splitting lines to multiple Javascript output calls. Also added an int level to jsStdPrint and a bunch of macros to cwasm.h
This commit is contained in:
@@ -7,6 +7,8 @@ Date: 08\28\2025
|
||||
#ifndef _ASSERT_H
|
||||
#define _ASSERT_H
|
||||
|
||||
#include "src/std_js_imports.h"
|
||||
|
||||
#define assert(condition) do { if (!(condition)) { jsStdAssertFailure(__FILE__, __LINE__, __func__, #condition, nullptr); } } while(0)
|
||||
//NOTE: assert_msg is not a standard function but we want to be able to pass a message to jsStdAssertFailure so we added this variant
|
||||
#define assert_msg(condition, message) do { if (!(condition)) { jsStdAssertFailure(__FILE__, __LINE__, __func__, #condition, (message)); } } while(0)
|
||||
|
||||
@@ -9,7 +9,7 @@ Description:
|
||||
#ifndef _STD_JS_IMPORTS_H
|
||||
#define _STD_JS_IMPORTS_H
|
||||
|
||||
MAYBE_EXTERN_C void jsStdPrint(const char* messageStrPntr, int messageLength);
|
||||
MAYBE_EXTERN_C void jsStdPrint(int level, const char* messageStrPntr, int messageLength);
|
||||
MAYBE_EXTERN_C _Noreturn void jsStdAbort(const char* messageStrPntr, int exitCode);
|
||||
MAYBE_EXTERN_C _Noreturn void jsStdAssertFailure(const char* filePathPntr, int fileLineNum, const char* funcNamePntr, const char* conditionStrPntr, const char* messageStrPntr);
|
||||
MAYBE_EXTERN_C void jsStdDebugBreak();
|
||||
|
||||
@@ -31,7 +31,7 @@ int vprintf(const char* restrict formatStr, va_list args)
|
||||
if (result > 0 && result < STD_PRINTF_BUFFER_SIZE)
|
||||
{
|
||||
stdGlobalPrintBuffer[result] = '\0'; //ensure null-termination
|
||||
jsStdPrint(&stdGlobalPrintBuffer[0], result);
|
||||
jsStdPrint(1, &stdGlobalPrintBuffer[0], result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user