Commit in reactos on MAIN
lib/pseh/framebased.c+221.1 -> 1.2
lib/pseh/i386/framebased.asm+201.1 -> 1.2
include/pseh.h+31added 1.1
include/pseh/framebased.h+134added 1.1
include/pseh/framebased/internal.h+85added 1.1
+292
3 added + 2 modified, total 5 files
Added license text (MIT license) to the SEH library, added the header files

reactos/lib/pseh
framebased.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- framebased.c	2 Jun 2004 18:36:55 -0000	1.1
+++ framebased.c	2 Jun 2004 19:22:06 -0000	1.2
@@ -1,3 +1,25 @@
+/*
+ Copyright (c) 2004 KJK::Hyperion
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
 #define STRICT
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>

reactos/lib/pseh/i386
framebased.asm 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- framebased.asm	2 Jun 2004 18:36:55 -0000	1.1
+++ framebased.asm	2 Jun 2004 19:22:06 -0000	1.2
@@ -1,3 +1,23 @@
+; Copyright (c) 2004 KJK::Hyperion
+
+; Permission is hereby granted, free of charge, to any person obtaining a copy
+; of this software and associated documentation files (the "Software"), to deal
+; in the Software without restriction, including without limitation the rights
+; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+; copies of the Software, and to permit persons to whom the Software is
+; furnished to dos so, subject to the following conditions:
+
+; The above copyright notice and this permission notice shall be included in all
+; copies or substantial portions of the Software.
+
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+; SOFTWARE.
+
 cpu 486
 segment .text use32
 

reactos/include
pseh.h added at 1.1
diff -N pseh.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pseh.h	2 Jun 2004 19:22:06 -0000	1.1
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2004 KJK::Hyperion
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+#ifndef KJK_PSEH_H_
+#define KJK_PSEH_H_
+
+/* TODO: <pseh/native.h> to wrap native SEH implementations */
+#include <pseh/framebased.h>
+
+#endif
+
+/* EOF */

reactos/include/pseh
framebased.h added at 1.1
diff -N framebased.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ framebased.h	2 Jun 2004 19:22:06 -0000	1.1
@@ -0,0 +1,134 @@
+/*
+ Copyright (c) 2004 KJK::Hyperion
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+#ifndef KJK_PSEH_FRAMEBASED_H_
+#define KJK_PSEH_FRAMEBASED_H_
+
+#include <pseh/framebased/internal.h>
+#include <setjmp.h>
+#include <stddef.h>
+#include <excpt.h>
+
+typedef struct __SEHFrame
+{
+ _SEHPortableFrame_t SEH_Header;
+ jmp_buf SEH_JmpBuf;
+ void * SEH_Locals;
+}
+_SEHFrame_t;
+
+static void __stdcall _SEHCompilerSpecificHandler(_SEHPortableFrame_t * frame)
+{
+ _SEHFrame_t * myframe;
+ myframe = (_SEHFrame_t *)(((char *)frame) - offsetof(_SEHFrame_t, SEH_Header));
+ longjmp(myframe->SEH_JmpBuf, 1);
+}
+
+#define _SEH_FILTER(NAME_) \
+ int __stdcall NAME_ \
+ ( \
+  struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \
+  struct __SEHPortableFrame * _SEHPortableFrame \
+ )
+
+#define _SEH_FINALLY(NAME_) \
+ void __stdcall NAME_ \
+ ( \
+  struct __SEHPortableFrame * _SEHPortableFrame \
+ )
+
+#define _SEH_TRY_FINALLY(FINALLY_) \
+ _SEH_TRY_FILTER_FINALLY \
+ ( \
+  (_SEHFilter_t)(EXCEPTION_CONTINUE_SEARCH + 1), \
+  (FINALLY_) \
+ )
+
+#define _SEH_END_FINALLY _SEH_HANDLE _SEH_END
+
+#define _SEH_TRY_FILTER(FILTER_) \
+ _SEH_TRY_FILTER_FINALLY((FILTER_), NULL)
+
+#define _SEH_TRY_HANDLE_FINALLY(FINALLY_) \
+ _SEH_TRY_FILTER_FINALLY \
+ ( \
+  (_SEHFilter_t)(EXCEPTION_EXECUTE_HANDLER + 1), \
+  (FINALLY_) \
+ )
+
+#define _SEH_TRY \
+ _SEH_TRY_HANDLE_FINALLY(NULL)
+
+#define _SEH_TRY_FILTER_FINALLY(FILTER_, FINALLY_) \
+ {                                                                             \
+  static const _SEHHandlers_t _SEHHandlers =                                   \
+  {                                                                            \
+   (FILTER_),                                                                  \
+   _SEHCompilerSpecificHandler,                                                \
+   (FINALLY_)                                                                  \
+  };                                                                           \
+                                                                               \
+  _SEHFrame_t _SEHFrame;                                                       \
+  _SEHPortableFrame_t * _SEHPortableFrame;                                     \
+                                                                               \
+  _SEHFrame.SEH_Header.SPF_Handlers = &_SEHHandlers;                           \
+                                                                               \
+  _SEHPortableFrame = &_SEHFrame.SEH_Header;                                   \
+  (void)_SEHPortableFrame;                                                     \
+                                                                               \
+  if(setjmp(_SEHFrame.SEH_JmpBuf) == 0)                                        \
+  {                                                                            \
+   _SEHEnter(&_SEHFrame.SEH_Header);                                           \
+                                                                               \
+   do                                                                          \
+   {
+
+#define _SEH_HANDLE \
+                                                                               \
+   }                                                                           \
+   while(0);                                                                   \
+                                                                               \
+   _SEHLeave(&_SEHFrame.SEH_Header);                                           \
+  }                                                                            \
+  else                                                                         \
+  {                                                                            \
+   _SEHLeave(&_SEHFrame.SEH_Header);                                           \
+
+#define _SEH_END \
+  }                                                                            \
+                                                                               \
+  if(_SEHHandlers.SH_Finally)                                                  \
+   _SEHHandlers.SH_Finally(&_SEHFrame.SEH_Header);                             \
+ }
+
+#define _SEH_LEAVE break
+
+#define _SEH_GetExceptionCode() (unsigned long)(_SEHPortableFrame->SPF_Code)
+
+#define _SEH_GetExceptionPointers() \
+ ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
+
+#define _SEH_AbnormalTermination() (_SEHPortableFrame->SPF_Code != 0)
+
+#endif
+
+/* EOF */

reactos/include/pseh/framebased
internal.h added at 1.1
diff -N internal.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ internal.h	2 Jun 2004 19:22:06 -0000	1.1
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2004 KJK::Hyperion
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+#ifndef KJK_PSEH_FRAMEBASED_INTERNAL_H_
+#define KJK_PSEH_FRAMEBASED_INTERNAL_H_
+
+struct _EXCEPTION_RECORD;
+struct _EXCEPTION_POINTERS;
+struct _CONTEXT;
+ 
+typedef int (__cdecl * _SEHFrameHandler_t)
+(
+ struct _EXCEPTION_RECORD *,
+ void *,
+ struct _CONTEXT *,
+ void *
+);
+
+typedef struct __SEHRegistration
+{
+ struct __SEHRegistration * SER_Prev;
+ _SEHFrameHandler_t SER_Handler;
+}
+_SEHRegistration_t;
+
+struct __SEHPortableFrame;
+
+typedef int (__stdcall * _SEHFilter_t)
+(
+ struct _EXCEPTION_POINTERS *,
+ struct __SEHPortableFrame *
+);
+
+typedef __declspec(noreturn) void (__stdcall * _SEHHandler_t)
+(
+ struct __SEHPortableFrame *
+);
+
+typedef void (__stdcall * _SEHFinally_t)
+(
+ struct __SEHPortableFrame *
+);
+
+typedef struct __SEHHandlers
+{
+ _SEHFilter_t SH_Filter;
+ _SEHHandler_t SH_Handler;
+ _SEHFinally_t SH_Finally;
+}
+_SEHHandlers_t;
+
+typedef struct __SEHPortableFrame
+{
+ _SEHRegistration_t SPF_Registration;
+ unsigned long SPF_Code;
+ int SPF_Handling;
+ const _SEHHandlers_t * SPF_Handlers;
+}
+_SEHPortableFrame_t;
+
+extern void __stdcall _SEHEnter(_SEHPortableFrame_t *);
+extern void __stdcall _SEHLeave(_SEHPortableFrame_t *);
+
+#endif
+
+/* EOF */
CVSspam 0.2.8