Blame view
scripts/genksyms/genksyms.h
2.61 KB
1da177e4c
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* Generate kernel symbol version hashes. Copyright 1996, 1997 Linux International. New implementation contributed by Richard Henderson <rth@tamu.edu> Based on original work by Bjorn Ekwall <bj0rn@blox.se> This file is part of the Linux modutils. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
1da177e4c
|
22 23 24 25 |
#ifndef MODUTILS_GENKSYMS_H #define MODUTILS_GENKSYMS_H 1 #include <stdio.h> |
ce5606869
|
26 |
enum symbol_type { |
e37ddb825
|
27 28 |
SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION, SYM_ENUM_CONST |
1da177e4c
|
29 |
}; |
64e6c1e12
|
30 31 32 |
enum symbol_status { STATUS_UNCHANGED, STATUS_DEFINED, STATUS_MODIFIED }; |
ce5606869
|
33 34 35 36 |
struct string_list { struct string_list *next; enum symbol_type tag; char *string; |
1da177e4c
|
37 |
}; |
ce5606869
|
38 39 40 41 42 43 |
struct symbol { struct symbol *hash_next; const char *name; enum symbol_type type; struct string_list *defn; struct symbol *expansion_trail; |
15fde6751
|
44 |
struct symbol *visited; |
ce5606869
|
45 |
int is_extern; |
64e6c1e12
|
46 47 |
int is_declared; enum symbol_status status; |
5dae9a550
|
48 |
int is_override; |
1da177e4c
|
49 50 51 52 |
}; typedef struct string_list **yystype; #define YYSTYPE yystype |
1da177e4c
|
53 |
extern int cur_line; |
ce5606869
|
54 |
extern char *cur_filename; |
1da177e4c
|
55 |
|
01762c4ec
|
56 |
struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); |
1da177e4c
|
57 |
struct symbol *add_symbol(const char *name, enum symbol_type type, |
ce5606869
|
58 |
struct string_list *defn, int is_extern); |
1da177e4c
|
59 |
void export_symbol(const char *); |
1da177e4c
|
60 |
void free_node(struct string_list *list); |
ce5606869
|
61 |
void free_list(struct string_list *s, struct string_list *e); |
1da177e4c
|
62 |
struct string_list *copy_node(struct string_list *); |
e37ddb825
|
63 64 |
struct string_list *copy_list_range(struct string_list *start, struct string_list *end); |
1da177e4c
|
65 66 67 68 69 |
int yylex(void); int yyparse(void); void error_with_pos(const char *, ...); |
1da177e4c
|
70 |
/*----------------------------------------------------------------------*/ |
1da177e4c
|
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
#define xmalloc(size) ({ void *__ptr = malloc(size); \ if(!__ptr && size != 0) { \ fprintf(stderr, "out of memory "); \ exit(1); \ } \ __ptr; }) #define xstrdup(str) ({ char *__str = strdup(str); \ if (!__str) { \ fprintf(stderr, "out of memory "); \ exit(1); \ } \ __str; }) |
ce5606869
|
85 |
#endif /* genksyms.h */ |