From 3a6c04927b4136a195b0bc259f50caf8249dfced Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 16 Nov 2009 22:05:28 -0800 Subject: Big round of changes to switch the code base to use the stream abstraction instead of directly using C standard I/O, to eliminate most uses of C formatted I/O, and fix numerous bugs, such variadic argument lists which lack a terminating ``nao'' sentinel. Bug 28033 is addressed by this patch, since streams no longer provide printf-compatible formatting. The native formatter is extended with some additional capabilities to take over. The work on literal objects is expanded and they are now used throughout the code base. Fixed bad realloc in string output stream: reallocating by number of wide chars rather than bytes. --- unwind.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'unwind.h') diff --git a/unwind.h b/unwind.h index 6f7683a8..00931429 100644 --- a/unwind.h +++ b/unwind.h @@ -79,17 +79,15 @@ obj_t *uw_set_func(obj_t *sym, obj_t *value); obj_t *uw_block_return(obj_t *tag, obj_t *result); void uw_push_catch(uw_frame_t *, obj_t *matches); noreturn obj_t *uw_throw(obj_t *sym, obj_t *exception); -noreturn obj_t *uw_throwf(obj_t *sym, const wchar_t *fmt, ...); -noreturn obj_t *uw_errorf(const wchar_t *fmt, ...); -noreturn obj_t *uw_throwcf(obj_t *sym, const wchar_t *fmt, ...); -noreturn obj_t *uw_errorcf(const wchar_t *fmt, ...); +noreturn obj_t *uw_throwf(obj_t *sym, obj_t *fmt, ...); +noreturn obj_t *uw_errorf(obj_t *fmt, ...); obj_t *uw_register_subtype(obj_t *sub, obj_t *super); obj_t *uw_exception_subtype_p(obj_t *sub, obj_t *sup); void uw_continue(uw_frame_t *curr, uw_frame_t *target); void uw_pop_frame(uw_frame_t *); void uw_init(void); -noreturn obj_t *type_mismatch(const wchar_t *, ...); +noreturn obj_t *type_mismatch(obj_t *, ...); #define uw_block_begin(TAG, RESULTVAR) \ obj_t *RESULTVAR = nil; \ @@ -149,9 +147,14 @@ noreturn obj_t *type_mismatch(const wchar_t *, ...); } #define internal_error(STR) \ - uw_throwcf(internal_err, \ - L"%s:%d %ls", __FILE__, \ - __LINE__, STR) + do { \ + extern obj_t *num(long); \ + uw_throwf(internal_err, \ + lit("~a:~a ~a"), \ + lit(__FILE__), \ + num(__LINE__), lit(STR), \ + nao); \ + } while (0) #define type_assert(EXPR, ARGS) \ if (!(EXPR)) type_mismatch ARGS @@ -164,12 +167,13 @@ noreturn obj_t *type_mismatch(const wchar_t *, ...); #define numeric_assert(EXPR) \ if (!(EXPR)) \ - uw_throwcf(numeric_err, L"%ls", \ - L"assertion " #EXPR \ - L" failed") + uw_throwf(numeric_err, \ + lit("assertion " #EXPR \ + "failed"), nao) #define range_bug_unless(EXPR) \ if (!(EXPR)) \ - uw_throwcf(range_err, L"%ls", \ - L"assertion" #EXPR \ - L" failed") + uw_throwf(range_err, \ + lit("assertion " #EXPR \ + "failed"), nao) + -- cgit v1.2.3