2 * Test header file for h2ph
4 * Try to test as many constructs as possible
5 * For example, the multi-line comment :)
8 /* And here's a single line comment :) */
10 /* Test #define with no indenting, over multiple lines */
14 /* Test #ifndef and parameter interpretation*/
16 #define ERROR(x) fprintf(stderr, "%s\n", x[2][3][0])
22 /* #ident - doesn't really do anything, but I think it always gets included anyway */
23 #ident "$Revision h2ph.h,v 1.0 98/05/04 20:42:14 billy $"
27 #define MAX(a,b) ((a) > (b) ? (a) : (b))
29 /* Test #undef'ining an existing constant function */
34 #ifdef __SOME_UNIMPORTANT_PROPERTY
35 #define MIN(a,b) ((a) < (b) ? (a) : (b))
36 #endif /* __SOME_UNIMPORTANT_PROPERTY */
39 * Test #if, #elif, #else, #endif, #warn and #error, and `!'
40 * Also test whitespace between the `#' and the command
42 #if !(defined __SOMETHING_MORE_IMPORTANT)
44 #elif !(defined __SOMETHING_REALLY_REALLY_IMPORTANT)
45 # error "Nup, can't go on" /* ' /* stupid font-lock-mode */
46 #else /* defined __SOMETHING_MORE_IMPORTANT && defined __SOMETHING_REALLY_REALLY_IMPORTANT */
47 # define EVERYTHING_IS_OK
52 #if (!((defined __SOMETHING_TRIVIAL && defined __SOMETHING_LESS_SO)) \
53 || defined __SOMETHING_OVERPOWERING)
55 #elif !(defined __SOMETHING_TRIVIAL) /* defined __SOMETHING_LESS_SO */
57 #elif !(defined __SOMETHING_LESS_SO) /* defined __SOMETHING_TRIVIAL */
59 #else /* defined __SOMETHING_TRIVIAL && defined __SOMETHING_LESS_SO */
60 # define WHATEVER 1000
63 /* Test passing through the alien constructs (perlbug #34493) */
64 #ifdef __LANGUAGE_PASCAL__
65 function Tru64_Pascal(n: Integer): Integer;
69 * Test #include, #import and #include_next
70 * #include_next is difficult to test, it really depends on the actual
71 * circumstances - for example, `#include_next <limits.h>' on a Linux system
72 * with `use lib qw(/opt/perl5/lib/site_perl/i586-linux/linux);' or whatever
73 * your equivalent is...
76 #include <sys/socket.h>
78 #include_next <sys/fcntl.h>
81 /* typedefs should be ignored */
82 typedef struct a_struct {
89 * however, typedefs of enums and just plain enums should end up being treated
90 * like a bunch of #defines...
93 typedef enum _days_of_week { sun, mon, tue, wed, thu, fri, sat, Sun=0, Mon,
94 Tue, Wed, Thu, Fri, Sat } days_of_week;
97 * Some moderate flexing of tri-graph pre substitution.
99 ??=ifndef _SOMETHING_TRIGRAPHIC
100 ??=define _SOMETHING_TRIGRAPHIC
101 ??= define SOMETHING_ELSE_TRIGRAPHIC_0 "??!" /* | ??!| || */
102 ??=define SOMETHING_ELSE_TRIGRAPHIC_1 "??'" /* | ??'| ^| */
103 ??= define SOMETHING_ELSE_TRIGRAPHIC_2 "??(" /* | ??(| [| */
104 ??= define SOMETHING_ELSE_TRIGRAPHIC_3 "??)" /* | ??)| ]| */
105 ??=define SOMETHING_ELSE_TRIGRAPHIC_4 "??-0" /* | ??-| ~| */
106 ??= define SOMETHING_ELSE_TRIGRAPHIC_5 "??/ " /* | ??/| \| */
107 ??= define SOMETHING_ELSE_TRIGRAPHIC_6 "??<" /* | ??<| {| */
108 ??=define SOMETHING_ELSE_TRIGRAPHIC_7 "??=" /* | ??=| #| */
109 ??= define SOMETHING_ELSE_TRIGRAPHIC_8 "??>" /* | ??>| }| */
112 // test C++-style comment
115 typdef struct empty_struct {
116 } // trailing C++-style comment should not force continuation
119 /* comments (that look like string) inside enums... */
135 /* Handle multi-line quoted strings: */
136 __asm__ __volatile__("
143 #define multiline "multiline
146 #endif /* _H2PH_H_ */