|
|
1.1 root 1: /* The Plum Hall Validation Suite for C
2: * Unpublished copyright (c) 1986-1991, Chiron Systems Inc and Plum Hall Inc.
3: * VERSION: 4
4: * DATE: 1993-01-01
5: * The "ANSI" mode of this suite corresponds to official ANSI C, X3.159-1989.
6: * As per your license agreement, your distribution is not to be moved or copied outside the Designated Site
7: * without specific permission from Plum Hall Inc.
8: */
9:
10: /*
11: * 2.1.1.2 Translation Phases
12: * This module tests the translation phases by making sure that
13: * they are processed in the right order.
14: */
15:
16:
17: /* #define NOTDEFINED 1 */
18:
19: ??=include<stddef.h>
20: #include/* SPACE */"defs.h"
21: #\
22: i\
23: f\
24: !\
25: d\
26: e\
27: f\
28: i\
29: n\
30: e\
31: d\
32: (\
33: N\
34: O\
35: T\
36: D\
37: E\
38: F\
39: I\
40: N\
41: E\
42: D\
43: )
44: #\
45: d\
46: e\
47: f\
48: i\
49: n\
50: e\
51: \
52: U\
53: I\
54: \
55: u\
56: n\
57: s\
58: i\
59: g\
60: n\
61: e\
62: d\
63: \
64: i\
65: n??/
66: t
67:
68: #define/* SPACE */PCHAR(/*SPACE*/x/*SPACE*/)/* SPACE */char x/*SPACE*/??(??)
69:
70: #endif
71: UI/* SPACE */Ui/* SPACE */=/* SPACE */'\
72: \n' ;
73: PCHAR(Pc) = "string1??/
74: #\
75: "\
76: "string2" ;
77:
78: #ifndef FREESTANDING
79: /* hosted environment assumes an invocation as "env 1" */
80: int main(
81: int argc,
82: char **argv)
83: #else
84: int main()
85: #endif
86: ??<
87: extern int Debug;
88:
89: Filename = "b2.h";
90: #ifndef FREESTANDING
91: if (argc > 2)
92: Debug = TRUE;
93: #endif
94: /* 2.1.1.2 - Phases of translation are tested throughout this module. */
95: {
96: /* separate tokens remain separate unless catenated with ## */
97: #define M -
98: int a=10, b=5, c;
99: c = a M-- b;
100: iequals(__LINE__, a, 10);
101: iequals(__LINE__, b, 4);
102: iequals(__LINE__, c, 6);
103: }
104: checkthat(__LINE__, Ui??'Ui == 0);
105: checkthat(__LINE__, Ui??!Ui == Ui);
106: checkthat(__LINE__, ??-Ui == ~'\n');
107:
108: /* 2.1.2.2 - Hosted Environment */
109: #ifndef FREESTANDING
110: checkthat(__LINE__, argc > 0);
111: if (argc < 2)
112: complain(__LINE__);
113: else
114: {
115: stequals(- __LINE__, argv[1], "1");
116: argv[1] = "string1??=string2";
117: aequals(__LINE__, argv[argc], NULL);
118: stequals(__LINE__, Pc, argv[1]);
119: }
120: #endif
121:
122: /* 2.2.1 - Character sets */
123: iequals(__LINE__, '0'+1, '1');
124: iequals(__LINE__, '1'+1, '2');
125: iequals(__LINE__, '2'+1, '3');
126: iequals(__LINE__, '3'+1, '4');
127: iequals(__LINE__, '4'+1, '5');
128: iequals(__LINE__, '5'+1, '6');
129: iequals(__LINE__, '6'+1, '7');
130: iequals(__LINE__, '7'+1, '8');
131: iequals(__LINE__, '8'+1, '9');
132: iequals(__LINE__, sizeof('\n'), sizeof(int));
133: #ifndef FREESTANDING /* 92/05/04 see upda3a.01 #515 */
134: iequals(__LINE__, sizeof(**argv), 1);
135: #endif /* FREESTANDING */
136: return report("ENVIRON");
137: ??>
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.