4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * Used to dump enums in forth mode.
32 * Enums are simple - there is no member-specific mode for them. We get
33 * the header op at the start, and we save the type id for dumping later.
34 * If we get the members op, we've been invoked in member-specific mode,
35 * which is a syntax error for an enum. When we ge the trailer op, we
36 * dump all of the members and the trailer thus concluding the enum.
41 static ctf_id_t fth_enum_curtid
;
42 static int fth_enum_curnmems
;
45 fth_enum_header(ctf_id_t tid
)
47 fth_enum_curtid
= tid
;
49 (void) fprintf(out
, "\n");
56 fth_enum_members(char *memfilter
, char *format
)
58 return (parse_warn("Member-specific mode cannot be used for "
64 fth_enum_cb(const char *name
, int value
, void *arg
)
66 (void) fprintf(out
, "here ,\" %s\" %x\n", name
, value
);
73 fth_enum_trailer(void)
75 if (ctf_enum_iter(ctf
, fth_enum_curtid
, fth_enum_cb
, NULL
) != 0)
78 (void) fprintf(out
, "%x c-enum .%s\n", fth_enum_curnmems
, fth_curtype
);
80 fth_enum_curnmems
= 0;
85 fth_type_ops_t fth_enum_ops
= {