Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * Hypervisor Software File: fscope.h | |
5 | * | |
6 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
7 | * | |
8 | * - Do no alter or remove copyright notices | |
9 | * | |
10 | * - Redistribution and use of this software in source and binary forms, with | |
11 | * or without modification, are permitted provided that the following | |
12 | * conditions are met: | |
13 | * | |
14 | * - Redistribution of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * | |
17 | * - Redistribution in binary form must reproduce the above copyright notice, | |
18 | * this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | |
20 | * | |
21 | * Neither the name of Sun Microsystems, Inc. or the names of contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * This software is provided "AS IS," without a warranty of any kind. | |
26 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
27 | * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
28 | * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
29 | * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
30 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
31 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
32 | * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
33 | * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
34 | * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
35 | * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
36 | * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
37 | * | |
38 | * You acknowledge that this software is not designed, licensed or | |
39 | * intended for use in the design, construction, operation or maintenance of | |
40 | * any nuclear facility. | |
41 | * | |
42 | * ========== Copyright Header End ============================================ | |
43 | */ | |
44 | /* | |
45 | * @(#)fscope.h 1.1 02/05/02 | |
46 | * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved | |
47 | * Use is subject to license terms. | |
48 | */ | |
49 | ||
50 | #ifndef _FSCOPE_H_ | |
51 | #define _FSCOPE_H_ | |
52 | ||
53 | #include "xref.h" | |
54 | ||
55 | #define ASSERT(x, y) \ | |
56 | if (x); else fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, y) | |
57 | ||
58 | #define TYPE_LIMIT 1 | |
59 | #define TYPE_CALLS 2 | |
60 | #define TYPE_CALLERS 3 | |
61 | #define TYPE_DEFINE 4 | |
62 | #define TYPE_INTERACT 5 | |
63 | #define TYPE_STRING 6 | |
64 | #define TYPE_TEXT 7 | |
65 | #define TYPE_DIRECTED 8 | |
66 | ||
67 | #define FLAG_ABS_PATH 1 | |
68 | #define FLAG_REGEXP 2 | |
69 | #define FLAG_VERBOSE 4 | |
70 | ||
71 | typedef struct EXTRACT_T extract_t; | |
72 | ||
73 | typedef struct OUTPUT_MODE_T { | |
74 | char *name; | |
75 | void (*init)(extract_t *info); | |
76 | void (*update)(extract_t *info, xref_t *cref); | |
77 | void (*fini)(extract_t *info); | |
78 | } output_mode_t; | |
79 | ||
80 | /* | |
81 | * private is for the list user to set, | |
82 | * notify is there so that a pruned list element can notify a user of the | |
83 | * private pointer about a dispose or copy operation. | |
84 | */ | |
85 | typedef struct SEARCH_T { | |
86 | xref_t *xref; | |
87 | void *private; | |
88 | void *(*notify)(struct SEARCH_T *this, int dispose); | |
89 | struct SEARCH_T *next; | |
90 | struct SEARCH_T *prev; | |
91 | } search_t; | |
92 | ||
93 | struct EXTRACT_T { | |
94 | int lo, hi; /* limit matching */ | |
95 | int type; /* non interactive control flag */ | |
96 | int flags; /* search types */ | |
97 | char *root_buf; /* path construction */ | |
98 | char *root; /* root replacement string */ | |
99 | char *symbol; /* regexp/symbol to search for */ | |
100 | char *indexfile; /* index file name */ | |
101 | char *outputfile; /* output file name */ | |
102 | void *private; /* private pointer for callers use */ | |
103 | FILE *outfd; /* output file descriptor */ | |
104 | xref_state_t *state; /* xref state */ | |
105 | output_mode_t *extract; /* current extract mode */ | |
106 | }; | |
107 | ||
108 | void xref_grep_format(extract_t *info, xref_t *cref); | |
109 | char *expand_filename(extract_t *info, xref_t *cref); | |
110 | ||
111 | void xref_tag_init(extract_t *info); | |
112 | void xref_tag_fini(extract_t *info); | |
113 | void xref_tag_format(extract_t *info, xref_t *cref); | |
114 | void xref_etag_format(extract_t *info, xref_t *cref); | |
115 | void xref_interactive_mode(extract_t *info); | |
116 | ||
117 | search_t *new_search_t(void); | |
118 | ||
119 | void free_searchlist(search_t *list); | |
120 | search_t *build_searchlist(extract_t *info, search_t *root, int restrict); | |
121 | search_t *search_list(extract_t *info, int prune, search_t *list, | |
122 | int (match)(extract_t *info, search_t *item)); | |
123 | void iterate_list(extract_t *info, search_t *list, | |
124 | void (fn)(extract_t *info, search_t *item)); | |
125 | ||
126 | #endif |