1178476Sjb/*
2178476Sjb * CDDL HEADER START
3178476Sjb *
4178476Sjb * The contents of this file are subject to the terms of the
5178476Sjb * Common Development and Distribution License (the "License").
6178476Sjb * You may not use this file except in compliance with the License.
7178476Sjb *
8178476Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9178476Sjb * or http://www.opensolaris.org/os/licensing.
10178476Sjb * See the License for the specific language governing permissions
11178476Sjb * and limitations under the License.
12178476Sjb *
13178476Sjb * When distributing Covered Code, include this CDDL HEADER in each
14178476Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15178476Sjb * If applicable, add the following below this CDDL HEADER, with the
16178476Sjb * fields enclosed by brackets "[]" replaced with your own identifying
17178476Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
18178476Sjb *
19178476Sjb * CDDL HEADER END
20178476Sjb */
21178476Sjb
22178476Sjb/*
23178476Sjb * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24178476Sjb * Use is subject to license terms.
25178476Sjb */
26178476Sjb
27178476Sjb/*
28178476Sjb * ASSERTION:
29178476Sjb * Test the typedef keyword with the different D data types. Declare different
30178476Sjb * data types and test some of them with values.
31178476Sjb *
32178476Sjb * SECTION: Type and Constant Definitions/Typedef
33178476Sjb *
34178476Sjb */
35178476Sjb
36178476Sjb#pragma ident	"%Z%%M%	%I%	%E% SMI"
37178476Sjb
38178476Sjb#pragma D option quiet
39178476Sjb
40178476Sjbtypedef char new_char;
41178476Sjbtypedef short new_short;
42178476Sjbtypedef int new_int;
43178476Sjbtypedef long new_long;
44178476Sjbtypedef long long new_long_long;
45178476Sjbtypedef int8_t new_int8;
46178476Sjbtypedef int16_t new_int16;
47178476Sjbtypedef int32_t new_int32;
48178476Sjbtypedef int64_t new_int64;
49178476Sjbtypedef intptr_t new_intptr;
50178476Sjbtypedef uint8_t new_uint8;
51178476Sjbtypedef uint16_t new_uint16;
52178476Sjbtypedef uint32_t new_uint32;
53178476Sjbtypedef uint64_t new_uint64;
54178476Sjbtypedef uintptr_t new_uintptr;
55178476Sjbtypedef float new_float;
56178476Sjbtypedef double new_double;
57178476Sjbtypedef long double new_long_double;
58178476Sjb
59178476Sjbtypedef int * pointer;
60178476Sjb
61178476Sjbtypedef struct {
62178476Sjb	char ch;
63178476Sjb	int in;
64178476Sjb	long lg;
65178476Sjb} new_struct;
66178476Sjb
67178476Sjbtypedef union {
68178476Sjb	char ch;
69178476Sjb	int in;
70178476Sjb	long lg;
71178476Sjb} new_union;
72178476Sjb
73178476Sjbtypedef enum {
74178476Sjb	RED,
75178476Sjb	GREEN,
76178476Sjb	BLUE
77178476Sjb} new_enum;
78178476Sjb
79178476Sjbnew_char c;
80178476Sjbnew_short s;
81178476Sjbnew_int i;
82178476Sjbnew_long l;
83178476Sjbnew_long_long ll;
84178476Sjbnew_int8 i8;
85178476Sjbnew_int16 i16;
86178476Sjbnew_int32 i32;
87178476Sjbnew_int64 i64;
88178476Sjbnew_intptr iptr;
89178476Sjbnew_uint8 ui8;
90178476Sjbnew_uint16 ui16;
91178476Sjbnew_uint32 ui32;
92178476Sjbnew_uint64 ui64;
93178476Sjbnew_uintptr uiptr;
94178476Sjbnew_float f;
95178476Sjbnew_double d;
96178476Sjbnew_long_double ld;
97178476Sjbnew_struct ns;
98178476Sjbnew_union nu;
99178476Sjbnew_enum ne;
100178476Sjb
101178476Sjbpointer p;
102178476Sjb
103178476SjbBEGIN
104178476Sjb{
105178476Sjb	ns.ch = 'c';
106178476Sjb	ns.in = 4;
107178476Sjb	ns.lg = 4;
108178476Sjb
109178476Sjb	nu.ch = 'd';
110178476Sjb	nu.in = 5;
111178476Sjb	nu.lg = 5;
112178476Sjb
113178476Sjb	i = 10;
114178476Sjb
115178476Sjb	printf("Struct: %c, %d, %d\n", ns.ch, ns.in, ns.lg);
116178476Sjb	printf("Union: %c, %d, %d\n", nu.ch, nu.in, nu.lg);
117178476Sjb	exit(0);
118178476Sjb}
119