Support $! stringification of socket error codes on Windows.
[p5sagit/p5-mst-13.2.git] / cpan / Devel-PPPort / module3.c
1 /*******************************************************************************
2 *
3 *  Perl/Pollution/Portability
4 *
5 ********************************************************************************
6 *
7 *  $Revision: 12 $
8 *  $Author: mhx $
9 *  $Date: 2009/01/18 14:10:49 +0100 $
10 *
11 ********************************************************************************
12 *
13 *  Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
14 *  Version 2.x, Copyright (C) 2001, Paul Marquess.
15 *  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
16 *
17 *  This program is free software; you can redistribute it and/or
18 *  modify it under the same terms as Perl itself.
19 *
20 *******************************************************************************/
21
22 #include "EXTERN.h"
23 #include "perl.h"
24
25 #define NEED_PL_parser
26 #define NO_XSLOCKS
27 #include "XSUB.h"
28
29 #include "ppport.h"
30
31 static void throws_exception(int throw_e)
32 {
33   if (throw_e)
34     croak("boo\n");
35 }
36
37 int exception(int throw_e)
38 {
39   dTHR;
40   dXCPT;
41   SV *caught = get_sv("Devel::PPPort::exception_caught", 0);
42
43   XCPT_TRY_START {
44     throws_exception(throw_e);
45   } XCPT_TRY_END
46
47   XCPT_CATCH
48   {
49     sv_setiv(caught, 1);
50     XCPT_RETHROW;
51   }
52
53   sv_setiv(caught, 0);
54
55   return 42;
56 }
57
58 void call_newCONSTSUB_3(void)
59 {
60   newCONSTSUB(gv_stashpv("Devel::PPPort", FALSE), "test_value_3", newSViv(3));
61 }
62
63 U32 get_PL_signals_3(void)
64 {
65   return PL_signals;
66 }
67
68 int dummy_parser_warning(void)
69 {
70   char * volatile my_bufptr;
71   char * volatile *my_p_bufptr;
72   my_bufptr = PL_bufptr;
73   my_p_bufptr = &PL_bufptr;
74   PL_bufptr = my_bufptr;
75   PL_bufptr = *my_p_bufptr;
76   return &PL_bufptr != NULL;
77 }