1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma D option quiet 28 29 BEGIN 30 { 31 i = 0; 32 j = 0; 33 34 @tour["Ghent", i++, j] = sum(5 - j); 35 j++; 36 37 @tour["Berlin", i++, j] = sum(5 - j); 38 j++; 39 40 @tour["London", i++, j] = sum(5 - j); 41 @tour["Dublin", i++, j] = sum(5 - j); 42 j++; 43 44 @tour["Shanghai", i++, j] = sum(5 - j); 45 j++; 46 47 @tour["Zurich", i++, j] = sum(5 - j); 48 j++; 49 50 @tour["Regina", i++, j] = sum(5 - j); 51 @tour["Winnipeg", i++, j] = sum(5 - j); 52 @tour["Edmonton", i++, j] = sum(5 - j); 53 @tour["Calgary", i++, j] = sum(5 - j); 54 @tour["Vancouver", i++, j] = sum(5 - j); 55 @tour["Victoria", i++, j] = sum(5 - j); 56 j++; 57 58 @tour["Prague", i++, j] = sum(5 - j); 59 @tour["London", i++, j] = sum(5 - j); 60 j++; 61 62 @tour["Brisbane", i++, j] = sum(5 - j); 63 @tour["Sydney", i++, j] = sum(5 - j); 64 @tour["Melbourne", i++, j] = sum(5 - j); 65 j++; 66 67 setopt("aggsortkey", "false"); 68 setopt("aggsortkeypos", "0"); 69 @tour["Amsterdam", i++, j] = sum(5 - j); 70 71 printf("By value:\n"); 72 printa("%20s %8d %8d %8@d\n", @tour); 73 74 setopt("aggsortkey"); 75 printf("\nBy key, position 0:\n"); 76 printa("%20s %8d %8d %8@d\n", @tour); 77 78 setopt("aggsortkeypos", "1"); 79 printf("\nBy key, position 1:\n"); 80 printa("%20s %8d %8d %8@d\n", @tour); 81 82 setopt("aggsortkeypos", "2"); 83 printf("\nBy key, position 2:\n"); 84 printa("%20s %8d %8d %8@d\n", @tour); 85 86 setopt("aggsortkey", "false"); 87 setopt("aggsortkeypos", "0"); 88 setopt("aggsortrev"); 89 90 printf("\nReversed by value:\n"); 91 printa("%20s %8d %8d %8@d\n", @tour); 92 93 setopt("aggsortkey"); 94 printf("\nReversed by key, position 0:\n"); 95 printa("%20s %8d %8d %8@d\n", @tour); 96 97 setopt("aggsortkeypos", "1"); 98 printf("\nReversed by key, position 1:\n"); 99 printa("%20s %8d %8d %8@d\n", @tour); 100 101 setopt("aggsortkeypos", "2"); 102 printf("\nReversed by key, position 2:\n"); 103 printa("%20s %8d %8d %8@d\n", @tour); 104 105 exit(0); 106 } 107