diff options
Diffstat (limited to 'src/cflow.h')
-rw-r--r-- | src/cflow.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/cflow.h b/src/cflow.h index 7a38682..c6712c9 100644 --- a/src/cflow.h +++ b/src/cflow.h @@ -1,8 +1,8 @@ /* This file is part of GNU cflow - Copyright (C) 1997,2005,2007 Sergey Poznyakoff + Copyright (C) 1997,2005,2007,2009 Sergey Poznyakoff GNU cflow 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 3 of the License, or (at your option) any later version. @@ -42,21 +42,25 @@ #if !HAVE_SETLOCALE # define setlocale(category, locale) /* empty */ #endif #define NUMITEMS(a) sizeof(a)/sizeof((a)[0]) -typedef struct cons *Consptr; -typedef struct cons Cons; -struct cons { - Consptr car; - Consptr cdr; +struct linked_list_entry { + struct linked_list_entry *next; + void *data; }; -#define CAR(a) (a)->car -#define CDR(a) (a)->cdr +typedef void (*linked_list_free_data_fp) (void*); + +struct linked_list { + linked_list_free_data_fp free_data; + struct linked_list_entry *head, *tail; +}; + +#define linked_list_head(list) ((list) ? (list)->head : NULL) enum symtype { SymUndefined, /* Undefined or deleted symbol */ SymToken, /* A token */ SymIdentifier /* Function or variable */ }; @@ -94,26 +98,26 @@ struct symbol { int expand_line; /* Output line when this symbol was first expanded */ int token_type; /* Type of the token */ char *source; /* Source file */ int def_line; /* Source line */ - Consptr ref_line; /* Referenced in */ + struct linked_list *ref_line; /* Referenced in */ int level; /* Block nesting level (for local vars), Parameter nesting level (for params) */ char *decl; /* Declaration */ enum storage storage; /* Storage type */ int arity; /* Number of parameters or -1 for variables */ int recursive; /* Is the function recursive */ - Consptr caller; /* List of callers */ - Consptr callee; /* List of callees */ + struct linked_list *caller; /* List of callers */ + struct linked_list *callee; /* List of callees */ }; /* Output flags */ #define PRINT_XREF 0x01 #define PRINT_TREE 0x02 @@ -159,16 +163,18 @@ extern unsigned input_file_count; Symbol *lookup(char*); Symbol *install(char*); void delete_autos(int level); void delete_statics(void); void delete_parms(int level); void move_parms(int level); -void cleanup(void); int collect_symbols(Symbol ***, int (*sel)()); -Consptr append_to_list(Consptr *, void *); -int symbol_in_list(Symbol *sym, Consptr list); +struct linked_list *linked_list_create(linked_list_free_data_fp fun); +void linked_list_destroy(struct linked_list **plist); +void linked_list_append(struct linked_list **plist, void *data); +void linked_list_prepend(struct linked_list **plist, void *data); +int symbol_in_list(Symbol *sym, struct linked_list *list); int get_token(void); int source(char *name); void init_lex(int debug_level); void set_preprocessor(const char *arg); void pp_option(const char *arg); |