dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / translators / tst.CircularTransDecl.d
blob58466f703a8c24d7a7ec73c289c3dedb7ba08d80
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * ASSERTION:
31 * Test circular declaration of translations
33 * SECTION: Translators/ Translator Declarations
34 * SECTION: Translators/ Translate Operator
37 #pragma D option quiet
39 struct input_struct {
40 int i;
41 char c;
44 struct output_struct {
45 int myi;
46 char myc;
49 translator struct output_struct < struct input_struct ivar >
51 myi = ((struct input_struct ) ivar).i;
52 myc = ((struct input_struct ) ivar).c;
55 translator struct input_struct < struct output_struct uvar >
57 i = ((struct output_struct ) uvar).myi;
58 c = ((struct output_struct ) uvar).myc;
61 struct input_struct f1;
62 struct output_struct f2;
64 BEGIN
66 f1.i = 10;
67 f1.c = 'c';
69 f2.myi = 100;
70 f2.myc = 'd';
72 printf("Testing circular translations\n");
73 forwardi = xlate < struct output_struct > (f1).myi;
74 forwardc = xlate < struct output_struct > (f1).myc;
75 backwardi = xlate < struct input_struct > (f2).i;
76 backwardc = xlate < struct input_struct > (f2).c;
78 printf("forwardi: %d\tforwardc: %c\n", forwardi, forwardc);
79 printf("backwardi: %d\tbackwardc: %c", backwardi, backwardc);
80 exit(0);
83 BEGIN
84 /(10 == forwardi) && ('c' == forwardc) && (100 == backwardi) &&
85 ('d' == backwardc)/
87 exit(0);
90 BEGIN
91 /(10 != forwardi) || ('c' != forwardc) || (100 != backwardi) ||
92 ('d' != backwardc)/
94 exit(1);
97 ERROR
99 exit(1);