From 3a89406b76efee69496d1620fc5111949ff11e00 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sun, 12 Sep 2004 11:27:36 +0000 Subject: New exit(...) function svn-id: r15030 --- backends/PalmOS/Src/missing/_stdlib.cpp | 8 ++++++-- backends/PalmOS/Src/missing/stdlib.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/PalmOS/Src/missing/_stdlib.cpp b/backends/PalmOS/Src/missing/_stdlib.cpp index 0c89ecd0d9..3b8bdb4b62 100644 --- a/backends/PalmOS/Src/missing/_stdlib.cpp +++ b/backends/PalmOS/Src/missing/_stdlib.cpp @@ -80,11 +80,15 @@ MemPtr realloc(MemPtr oldP, UInt32 size) { return newP; } +ErrJumpBuf stdlib_errJumpBuf; +#define ERR_MAGIC 0xDADA + void exit(Int16 status) { - // need to change this EventType event; event.eType = keyDownEvent; event.data.keyDown.chr = vchrLaunch; event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue (&event, 0, true); + EvtAddUniqueEventToQueue(&event, 0, true); + + ErrLongJump(stdlib_errJumpBuf, status == 0 ? 0xDADA : status); } diff --git a/backends/PalmOS/Src/missing/stdlib.h b/backends/PalmOS/Src/missing/stdlib.h index 5d0337dac2..6448ee390e 100644 --- a/backends/PalmOS/Src/missing/stdlib.h +++ b/backends/PalmOS/Src/missing/stdlib.h @@ -26,6 +26,11 @@ #include #include "MemGlue.h" +extern ErrJumpBuf stdlib_errJumpBuf; + +#define DO_EXIT( code ) \ + if (ErrSetJump(stdlib_errJumpBuf) == 0) { code } + #define atoi StrAToI #define atol StrAToI #define abs(a) ((a) < 0 ? -(a) : (a)) -- cgit v1.2.3