1 /* @(#)sym.h 1.14 04/03/11 Copyright 1985, 1999 J. Schilling */ 2 /* 3 * A program to produce a static calltree for C-functions 4 * 5 * symbol definitions 6 * 7 * Copyright (c) 1985, 1999 J. Schilling 8 */ 9 /* 10 * The contents of this file are subject to the terms of the 11 * Common Development and Distribution License, Version 1.0 only 12 * (the "License"). You may not use this file except in compliance 13 * with the License. 14 * 15 * See the file CDDL.Schily.txt in this distribution for details. 16 * A copy of the CDDL is also available via the Internet at 17 * http://www.opensource.org/licenses/cddl1.txt 18 * 19 * When distributing Covered Code, include this CDDL HEADER in each 20 * file and include the License file CDDL.Schily.txt from this distribution. 21 */ 22 23 /* 24 * The heart of all name lists used in calltree. 25 * 26 * All symbol nodes that are members of the global function list use 27 * the s_uses member to keep track of callers/callees, 28 * 29 * while all symbol nodes that are in a symbol tree bejond a 30 * the s_uses pointer use the s_sym pointer as a back pointer to the 31 * symbol node of the caller/callee. 32 * 33 */ 34 typedef struct symbol sym_t; 35 36 struct symbol { 37 sym_t *s_left; /* ... will be sorted before this */ 38 sym_t *s_right; /* ... will be sorted after this */ 39 char *s_filename; /* Filename where this sym was found */ 40 char *s_name; /* Name of this symbol */ 41 union { 42 sym_t *v_uses; /* Caller or Callee usage tree */ 43 sym_t *v_sym; /* Ptr to caller/calle in main tree */ 44 } s_value; 45 int s_lineno; /* Line number this sym was found */ 46 int s_flags; /* Flags */ 47 }; 48 49 /* 50 * Shortcut's for readability of the code. 51 */ 52 #define s_uses s_value.v_uses 53 #define s_sym s_value.v_sym 54 55 /* 56 * Definitions for s_flags 57 */ 58 #define S_RECURSE 0x01 /* Found a recursive call */ 59 #define S_USED 0x02 /* This func has been used */ 60 #define S_DEF 0x04 /* Found a definition for this func */ 61 #define S_WARN 0x08 /* Warned about multiple definitions */ 62 63 /* 64 * The third parameter of lookup() ... if not L_LOOK/L_CREATE, this is a 65 * symbol tree where we could find already allocated strings in s_name. 66 */ 67 #define L_LOOK ((sym_t *)0) /* Only lookup a symbol */ 68 #define L_CREATE ((sym_t *)1) /* Create the symbol if not yet def'd */ 69 70 extern sym_t *lookup __PR((char *name, sym_t **table, sym_t *gtab)); 71