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