Lots of changes from David Mosberger-Tang; see ChangeLog and NOTES for details:
[external/binutils.git] / gprof / source.h
1 #ifndef source_h
2 #define source_h
3
4 #include <stdio.h>
5 #include "gprof.h"
6 #include "search_list.h"
7
8 typedef struct source_file {
9     struct source_file  *next;
10     const char          *name;          /* name of source file */
11     int                 ncalls;         /* # of "calls" to this file */
12     int                 num_lines;      /* # of lines in file */
13     int                 nalloced;       /* number of lines allocated */
14     void                **line;         /* usage-dependent per-line data */
15 } Source_File;
16
17 /*
18  * Options:
19  */
20 extern bool create_annotation_files;    /* create annotated output files? */
21
22 /*
23  * List of directories to search for source files:
24  */
25 extern Search_List src_search_list;
26
27 /*
28  * Chain of source-file descriptors:
29  */
30 extern Source_File *first_src_file;
31
32 /*
33  * Returns pointer to source file descriptor for PATH/FILENAME.
34  */
35 extern Source_File *source_file_lookup_path PARAMS((const char *path));
36 extern Source_File *source_file_lookup_name PARAMS((const char *filename));
37
38 /*
39  * Read source file SF output annotated source.  The annotation is at
40  * MAX_WIDTH characters wide and for each source-line an annotation is
41  * obtained by invoking function ANNOTE.  ARG is an argument passed to
42  * ANNOTE that is left uninterpreted by annotate_source().
43  *
44  * Returns a pointer to the output file (which maybe stdout) such
45  * that summary statistics can be printed.  If the returned file
46  * is not stdout, it should be closed when done with it.
47  */
48 extern FILE *annotate_source PARAMS((Source_File *sf, int max_width,
49                                      void (*annote) (char *b, int w, int l,
50                                                      void *arg),
51                                      void *arg));
52
53 #endif /* source_h */