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#pragma ident "%Z%%M% %I% %E% SMI" 28178476Sjb 29178476Sjb/* 30178476Sjb * ASSERTION: Declaration of the different data types within a union and 31178476Sjb * their definitions in a later clause should work fine. 32178476Sjb * 33178476Sjb * SECTION: Structs and Unions/Unions 34178476Sjb * 35178476Sjb * NOTES: The floats, doubles and strings have not been implemented yet. 36178476Sjb * When they do, appropriate lines in the code below should be uncommented. 37178476Sjb * Similarly, the lines with the kmem_flags pointer assignment should be 38178476Sjb * uncommented when the issues pertaining to it are clarified. 39178476Sjb * 40178476Sjb */ 41178476Sjb 42178476Sjb#pragma D option quiet 43178476Sjb 44178476Sjbunion record { 45178476Sjb char new_char; 46178476Sjb short new_short; 47178476Sjb int new_int; 48178476Sjb long new_long; 49178476Sjb long long new_long_long; 50178476Sjb int8_t new_int8; 51178476Sjb int16_t new_int16; 52178476Sjb int32_t new_int32; 53178476Sjb int64_t new_int64; 54178476Sjb intptr_t new_intptr; 55178476Sjb uint8_t new_uint8; 56178476Sjb uint16_t new_uint16; 57178476Sjb uint32_t new_uint32; 58178476Sjb uint64_t new_uint64; 59178476Sjb uintptr_t new_uintptr; 60178476Sjb 61178476Sjb /*float new_float; 62178476Sjb double new_double; 63178476Sjb long double new_long_double; 64178476Sjb 65178476Sjb string new_string; 66178476Sjb */ 67178476Sjb 68178476Sjb struct { 69178476Sjb char ch; 70178476Sjb int in; 71178476Sjb long lg; 72178476Sjb } new_struct; 73178476Sjb 74178476Sjb union { 75178476Sjb char ch; 76178476Sjb int in; 77178476Sjb long lg; 78178476Sjb } new_union; 79178476Sjb 80178476Sjbenum { 81178476Sjb RED, 82178476Sjb GREEN, 83178476Sjb BLUE 84178476Sjb} new_enum; 85178476Sjb 86178476Sjb 87178476Sjb int *pointer; 88178476Sjb} var; 89178476Sjb 90178476Sjb/* 91178476Sjb var.pointer = &`kmem_flags; 92178476Sjb*/ 93178476SjbBEGIN 94178476Sjb{ 95178476Sjb var.new_char = 'c'; 96178476Sjb var.new_short = 10; 97178476Sjb var.new_int = 100; 98178476Sjb var.new_long = 1234567890; 99178476Sjb var.new_long_long = 1234512345; 100178476Sjb var.new_int8 = 'p'; 101178476Sjb var.new_int16 = 20; 102178476Sjb var.new_int32 = 200; 103178476Sjb var.new_int64 = 2000000; 104178476Sjb var.new_intptr = 0x12345; 105178476Sjb var.new_uint8 = 'q'; 106178476Sjb var.new_uint16 = 30; 107178476Sjb var.new_uint32 = 300; 108178476Sjb var.new_uint64 = 3000000; 109178476Sjb var.new_uintptr = 0x67890; 110178476Sjb 111178476Sjb /* var.new_float = 1.23456; 112178476Sjb var.new_double = 2.34567890; 113178476Sjb var.new_long_double = 3.567890123; 114178476Sjb 115178476Sjb var.new_string = "hello"; 116178476Sjb */ 117178476Sjb 118178476Sjb /* 119178476Sjb var.pointer = &`kmem_flags; 120178476Sjb */ 121178476Sjb 122178476Sjb var.new_struct.ch = 'c'; 123178476Sjb var.new_struct.in = 4; 124178476Sjb var.new_struct.lg = 4; 125178476Sjb 126178476Sjb var.new_union.ch = 'd'; 127178476Sjb var.new_union.in = 5; 128178476Sjb var.new_union.lg = 5; 129178476Sjb 130178476Sjb 131178476Sjb exit(0); 132178476Sjb} 133