1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/* In MSW, this is all there is to pd; the rest sits in a "pdlib" dll so
that externs can link back to functions defined in pd. */
#include <stdio.h>
int sys_main(int argc, char **argv);
/* WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler(
ULONG FirstHandler,
PVECTORED_EXCEPTION_HANDLER VectoredHandler ); */
#ifdef MSW
#if 0
#incldue "winbase.h"
LONG NTAPI VectoredExceptionHandler(void *PEXCEPTION_POINTERS)
{
fprintf(stderr, "caught exception\n");
return(EXCEPTION_CONTINUE_SEARCH);
}
int main(int argc, char **argv)
{
printf("Pd entry point\n");
AddVectoredExceptionHandler(
ULONG FirstHandler,
PVECTORED_EXCEPTION_HANDLER VectoredHandler );
#endif
#if 1
int main(int argc, char **argv)
{
__try
{
sys_main(argc, argv);
}
__finally
{
printf("caught an exception; stopping\n");
}
}
#endif
#else /* not MSW */
int main(int argc, char **argv)
{
return (sys_main(argc, argv));
}
#endif
/* In MSW, this is all there is to pd; the rest sits in a "pdlib" dll so
that externs can link back to functions defined in pd. */
#include <stdio.h>
int sys_main(int argc, char **argv);
/* WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler(
ULONG FirstHandler,
PVECTORED_EXCEPTION_HANDLER VectoredHandler ); */
#ifdef MSW
#if 0
#incldue "winbase.h"
LONG NTAPI VectoredExceptionHandler(void *PEXCEPTION_POINTERS)
{
fprintf(stderr, "caught exception\n");
return(EXCEPTION_CONTINUE_SEARCH);
}
int main(int argc, char **argv)
{
printf("Pd entry point\n");
AddVectoredExceptionHandler(
ULONG FirstHandler,
PVECTORED_EXCEPTION_HANDLER VectoredHandler );
#endif
#if 1
int main(int argc, char **argv)
{
__try
{
sys_main(argc, argv);
}
__finally
{
printf("caught an exception; stopping\n");
}
}
#endif
#else /* not MSW */
int main(int argc, char **argv)
{
return (sys_main(argc, argv));
}
#endif
|