2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _DT_DECL_H
2N/A#define _DT_DECL_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <sys/types.h>
2N/A#include <libctf.h>
2N/A#include <dtrace.h>
2N/A#include <stdio.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Astruct dt_node; /* forward declaration of dt_node_t */
2N/A
2N/Atypedef struct dt_decl {
2N/A ushort_t dd_kind; /* declaration kind (CTF_K_* kind) */
2N/A ushort_t dd_attr; /* attributes (DT_DA_* flags) */
2N/A ctf_file_t *dd_ctfp; /* CTF container for decl's type */
2N/A ctf_id_t dd_type; /* CTF identifier for decl's type */
2N/A char *dd_name; /* string name of this decl (or NULL) */
2N/A struct dt_node *dd_node; /* node for array size or parm list */
2N/A struct dt_decl *dd_next; /* next declaration in list */
2N/A} dt_decl_t;
2N/A
2N/A#define DT_DA_SIGNED 0x0001 /* signed integer value */
2N/A#define DT_DA_UNSIGNED 0x0002 /* unsigned integer value */
2N/A#define DT_DA_SHORT 0x0004 /* short integer value */
2N/A#define DT_DA_LONG 0x0008 /* long integer or double */
2N/A#define DT_DA_LONGLONG 0x0010 /* long long integer value */
2N/A#define DT_DA_CONST 0x0020 /* qualify type as const */
2N/A#define DT_DA_RESTRICT 0x0040 /* qualify type as restrict */
2N/A#define DT_DA_VOLATILE 0x0080 /* qualify type as volatile */
2N/A#define DT_DA_PAREN 0x0100 /* parenthesis tag */
2N/A
2N/Atypedef enum dt_dclass {
2N/A DT_DC_DEFAULT, /* no storage class specified */
2N/A DT_DC_AUTO, /* automatic storage */
2N/A DT_DC_REGISTER, /* register storage */
2N/A DT_DC_STATIC, /* static storage */
2N/A DT_DC_EXTERN, /* extern storage */
2N/A DT_DC_TYPEDEF, /* type definition */
2N/A DT_DC_SELF, /* thread-local storage */
2N/A DT_DC_THIS /* clause-local storage */
2N/A} dt_dclass_t;
2N/A
2N/Atypedef struct dt_scope {
2N/A dt_decl_t *ds_decl; /* pointer to top of decl stack */
2N/A struct dt_scope *ds_next; /* pointer to next scope */
2N/A char *ds_ident; /* identifier for this scope (if any) */
2N/A ctf_file_t *ds_ctfp; /* CTF container for this scope */
2N/A ctf_id_t ds_type; /* CTF id of enclosing type */
2N/A dt_dclass_t ds_class; /* declaration class for this scope */
2N/A int ds_enumval; /* most recent enumerator value */
2N/A} dt_scope_t;
2N/A
2N/Aextern dt_decl_t *dt_decl_alloc(ushort_t, char *);
2N/Aextern void dt_decl_free(dt_decl_t *);
2N/Aextern void dt_decl_reset(void);
2N/Aextern dt_decl_t *dt_decl_push(dt_decl_t *);
2N/Aextern dt_decl_t *dt_decl_pop(void);
2N/Aextern dt_decl_t *dt_decl_pop_param(char **);
2N/Aextern dt_decl_t *dt_decl_top(void);
2N/A
2N/Aextern dt_decl_t *dt_decl_ident(char *);
2N/Aextern void dt_decl_class(dt_dclass_t);
2N/A
2N/A#define DT_DP_VARARGS 0x1 /* permit varargs in prototype */
2N/A#define DT_DP_DYNAMIC 0x2 /* permit dynamic type in prototype */
2N/A#define DT_DP_VOID 0x4 /* permit void type in prototype */
2N/A#define DT_DP_ANON 0x8 /* permit anonymous parameters */
2N/A
2N/Aextern int dt_decl_prototype(struct dt_node *, struct dt_node *,
2N/A const char *, uint_t);
2N/A
2N/Aextern dt_decl_t *dt_decl_spec(ushort_t, char *);
2N/Aextern dt_decl_t *dt_decl_attr(ushort_t);
2N/Aextern dt_decl_t *dt_decl_array(struct dt_node *);
2N/Aextern dt_decl_t *dt_decl_func(dt_decl_t *, struct dt_node *);
2N/Aextern dt_decl_t *dt_decl_ptr(void);
2N/A
2N/Aextern dt_decl_t *dt_decl_sou(uint_t, char *);
2N/Aextern void dt_decl_member(struct dt_node *);
2N/A
2N/Aextern dt_decl_t *dt_decl_enum(char *);
2N/Aextern void dt_decl_enumerator(char *, struct dt_node *);
2N/A
2N/Aextern int dt_decl_type(dt_decl_t *, dtrace_typeinfo_t *);
2N/A
2N/Aextern void dt_scope_create(dt_scope_t *);
2N/Aextern void dt_scope_destroy(dt_scope_t *);
2N/Aextern void dt_scope_push(ctf_file_t *, ctf_id_t);
2N/Aextern dt_decl_t *dt_scope_pop(void);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DT_DECL_H */