1*9512fe85Sahl /*
2*9512fe85Sahl  * CDDL HEADER START
3*9512fe85Sahl  *
4*9512fe85Sahl  * The contents of this file are subject to the terms of the
5*9512fe85Sahl  * Common Development and Distribution License (the "License").
6*9512fe85Sahl  * You may not use this file except in compliance with the License.
7*9512fe85Sahl  *
8*9512fe85Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9512fe85Sahl  * or http://www.opensolaris.org/os/licensing.
10*9512fe85Sahl  * See the License for the specific language governing permissions
11*9512fe85Sahl  * and limitations under the License.
12*9512fe85Sahl  *
13*9512fe85Sahl  * When distributing Covered Code, include this CDDL HEADER in each
14*9512fe85Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9512fe85Sahl  * If applicable, add the following below this CDDL HEADER, with the
16*9512fe85Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
17*9512fe85Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9512fe85Sahl  *
19*9512fe85Sahl  * CDDL HEADER END
20*9512fe85Sahl  */
21*9512fe85Sahl 
22*9512fe85Sahl /*
23*9512fe85Sahl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*9512fe85Sahl  * Use is subject to license terms.
25*9512fe85Sahl  */
26*9512fe85Sahl 
27*9512fe85Sahl /*
28*9512fe85Sahl  * ASSERTION: Declaration of the different data types within a struct and
29*9512fe85Sahl  * their definitions in a later clause should work fine.
30*9512fe85Sahl  *
31*9512fe85Sahl  * SECTION: Structs and Unions/Structs
32*9512fe85Sahl  *
33*9512fe85Sahl  * NOTES: The floats, doubles and strings have not been implemented yet.
34*9512fe85Sahl  * When they do, appropriate lines in the code below should be uncommented.
35*9512fe85Sahl  * Similarly, the lines with the kmem_flags pointer assignment should be
36*9512fe85Sahl  * uncommented when the issues pertaining to it are clarified.
37*9512fe85Sahl  *
38*9512fe85Sahl  */
39*9512fe85Sahl #pragma D option quiet
40*9512fe85Sahl 
41*9512fe85Sahl struct record {
42*9512fe85Sahl 	char new_char;
43*9512fe85Sahl 	short new_short;
44*9512fe85Sahl 	int new_int;
45*9512fe85Sahl 	long new_long;
46*9512fe85Sahl 	long long new_long_long;
47*9512fe85Sahl 	int8_t new_int8;
48*9512fe85Sahl 	int16_t new_int16;
49*9512fe85Sahl 	int32_t new_int32;
50*9512fe85Sahl 	int64_t new_int64;
51*9512fe85Sahl 	intptr_t new_intptr;
52*9512fe85Sahl 	uint8_t new_uint8;
53*9512fe85Sahl 	uint16_t new_uint16;
54*9512fe85Sahl 	uint32_t new_uint32;
55*9512fe85Sahl 	uint64_t new_uint64;
56*9512fe85Sahl 	uintptr_t new_uintptr;
57*9512fe85Sahl 
58*9512fe85Sahl 	/*
59*9512fe85Sahl 	float new_float;
60*9512fe85Sahl 	double new_double;
61*9512fe85Sahl 	long double new_long_double;
62*9512fe85Sahl 
63*9512fe85Sahl 	string new_string;
64*9512fe85Sahl 	*/
65*9512fe85Sahl 
66*9512fe85Sahl 	struct {
67*9512fe85Sahl 		char ch;
68*9512fe85Sahl 		int in;
69*9512fe85Sahl 		long lg;
70*9512fe85Sahl 	} new_struct;
71*9512fe85Sahl 
72*9512fe85Sahl 	union {
73*9512fe85Sahl 	     char ch;
74*9512fe85Sahl 	     int in;
75*9512fe85Sahl 	     long lg;
76*9512fe85Sahl 	} new_union;
77*9512fe85Sahl 
78*9512fe85Sahl enum colors {
79*9512fe85Sahl 	RED,
80*9512fe85Sahl 	GREEN,
81*9512fe85Sahl 	BLUE
82*9512fe85Sahl } new_enum;
83*9512fe85Sahl 
84*9512fe85Sahl 
85*9512fe85Sahl 	int *pointer;
86*9512fe85Sahl } var;
87*9512fe85Sahl 
88*9512fe85Sahl /*
89*9512fe85Sahl 	var.pointer = &`kmem_flags;
90*9512fe85Sahl */
91*9512fe85Sahl BEGIN
92*9512fe85Sahl {
93*9512fe85Sahl 	var.new_char = 'c';
94*9512fe85Sahl 	var.new_short = 10;
95*9512fe85Sahl 	var.new_int = 100;
96*9512fe85Sahl 	var.new_long = 1234567890;
97*9512fe85Sahl 	var.new_long_long = 1234512345;
98*9512fe85Sahl 	var.new_int8 = 'p';
99*9512fe85Sahl 	var.new_int16 = 20;
100*9512fe85Sahl 	var.new_int32 = 200;
101*9512fe85Sahl 	var.new_int64 = 2000000;
102*9512fe85Sahl 	var.new_intptr = 0x12345;
103*9512fe85Sahl 	var.new_uint8 = 'q';
104*9512fe85Sahl 	var.new_uint16 = 30;
105*9512fe85Sahl 	var.new_uint32 = 300;
106*9512fe85Sahl 	var.new_uint64 = 3000000;
107*9512fe85Sahl 	var.new_uintptr = 0x67890;
108*9512fe85Sahl 
109*9512fe85Sahl /*	var.new_float = 1.23456;
110*9512fe85Sahl 	var.new_double = 2.34567890;
111*9512fe85Sahl 	var.new_long_double = 3.567890123;
112*9512fe85Sahl 
113*9512fe85Sahl 	var.new_string = "hello";
114*9512fe85Sahl */
115*9512fe85Sahl 
116*9512fe85Sahl /*
117*9512fe85Sahl 	var.pointer = &`kmem_flags;
118*9512fe85Sahl */
119*9512fe85Sahl 
120*9512fe85Sahl 	var.new_struct.ch = 'c';
121*9512fe85Sahl 	var.new_struct.in = 4;
122*9512fe85Sahl 	var.new_struct.lg = 4;
123*9512fe85Sahl 
124*9512fe85Sahl 	var.new_union.ch = 'd';
125*9512fe85Sahl 	var.new_union.in = 5;
126*9512fe85Sahl 	var.new_union.lg = 5;
127*9512fe85Sahl 
128*9512fe85Sahl 	this->var = var;
129*9512fe85Sahl 
130*9512fe85Sahl 	exit(0);
131*9512fe85Sahl }
132