Path: blob/main/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.h
39562 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright 2005 Sun Microsystems, Inc. All rights reserved.23* Use is subject to license terms.24*/25/*26* Copyright (c) 2013 by Delphix. All rights reserved.27* Copyright (c) 2013 Joyent, Inc. All rights reserved.28*/2930#ifndef _DT_DECL_H31#define _DT_DECL_H3233#include <sys/types.h>34#include <libctf.h>35#include <dtrace.h>36#include <stdio.h>3738#ifdef __cplusplus39extern "C" {40#endif4142struct dt_node; /* forward declaration of dt_node_t */4344typedef struct dt_decl {45ushort_t dd_kind; /* declaration kind (CTF_K_* kind) */46ushort_t dd_attr; /* attributes (DT_DA_* flags) */47ctf_file_t *dd_ctfp; /* CTF container for decl's type */48ctf_id_t dd_type; /* CTF identifier for decl's type */49char *dd_name; /* string name of this decl (or NULL) */50struct dt_node *dd_node; /* node for array size or parm list */51struct dt_decl *dd_next; /* next declaration in list */52} dt_decl_t;5354#define DT_DA_SIGNED 0x0001 /* signed integer value */55#define DT_DA_UNSIGNED 0x0002 /* unsigned integer value */56#define DT_DA_SHORT 0x0004 /* short integer value */57#define DT_DA_LONG 0x0008 /* long integer or double */58#define DT_DA_LONGLONG 0x0010 /* long long integer value */59#define DT_DA_CONST 0x0020 /* qualify type as const */60#define DT_DA_RESTRICT 0x0040 /* qualify type as restrict */61#define DT_DA_VOLATILE 0x0080 /* qualify type as volatile */62#define DT_DA_PAREN 0x0100 /* parenthesis tag */63#define DT_DA_USER 0x0200 /* user-land type specifier */6465typedef enum dt_dclass {66DT_DC_DEFAULT, /* no storage class specified */67DT_DC_AUTO, /* automatic storage */68DT_DC_REGISTER, /* register storage */69DT_DC_STATIC, /* static storage */70DT_DC_EXTERN, /* extern storage */71DT_DC_TYPEDEF, /* type definition */72DT_DC_SELF, /* thread-local storage */73DT_DC_THIS /* clause-local storage */74} dt_dclass_t;7576typedef struct dt_scope {77dt_decl_t *ds_decl; /* pointer to top of decl stack */78struct dt_scope *ds_next; /* pointer to next scope */79char *ds_ident; /* identifier for this scope (if any) */80ctf_file_t *ds_ctfp; /* CTF container for this scope */81ctf_id_t ds_type; /* CTF id of enclosing type */82dt_dclass_t ds_class; /* declaration class for this scope */83int ds_enumval; /* most recent enumerator value */84} dt_scope_t;8586extern dt_decl_t *dt_decl_alloc(ushort_t, char *);87extern void dt_decl_free(dt_decl_t *);88extern void dt_decl_reset(void);89extern dt_decl_t *dt_decl_push(dt_decl_t *);90extern dt_decl_t *dt_decl_pop(void);91extern dt_decl_t *dt_decl_pop_param(char **);92extern dt_decl_t *dt_decl_top(void);9394extern dt_decl_t *dt_decl_ident(char *);95extern void dt_decl_class(dt_dclass_t);9697#define DT_DP_VARARGS 0x1 /* permit varargs in prototype */98#define DT_DP_DYNAMIC 0x2 /* permit dynamic type in prototype */99#define DT_DP_VOID 0x4 /* permit void type in prototype */100#define DT_DP_ANON 0x8 /* permit anonymous parameters */101102extern int dt_decl_prototype(struct dt_node *, struct dt_node *,103const char *, uint_t);104105extern dt_decl_t *dt_decl_spec(ushort_t, char *);106extern dt_decl_t *dt_decl_attr(ushort_t);107extern dt_decl_t *dt_decl_array(struct dt_node *);108extern dt_decl_t *dt_decl_func(dt_decl_t *, struct dt_node *);109extern dt_decl_t *dt_decl_ptr(void);110111extern dt_decl_t *dt_decl_sou(uint_t, char *);112extern void dt_decl_member(struct dt_node *);113114extern dt_decl_t *dt_decl_enum(char *);115extern void dt_decl_enumerator(char *, struct dt_node *);116117extern int dt_decl_type(dt_decl_t *, dtrace_typeinfo_t *);118119extern void dt_scope_create(dt_scope_t *);120extern void dt_scope_destroy(dt_scope_t *);121extern void dt_scope_push(ctf_file_t *, ctf_id_t);122extern dt_decl_t *dt_scope_pop(void);123124#ifdef __cplusplus125}126#endif127128#endif /* _DT_DECL_H */129130131