xref: /openbsd-src/gnu/usr.bin/binutils/gprof/source.h (revision c074d1c999f3e07019cd5e9a2f190b057ef3b935)
1b55d4692Sfgsch /* source.h
2b55d4692Sfgsch 
3*c074d1c9Sdrahn    Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
4b55d4692Sfgsch 
5b55d4692Sfgsch This file is part of GNU Binutils.
6b55d4692Sfgsch 
7b55d4692Sfgsch This program is free software; you can redistribute it and/or modify
8b55d4692Sfgsch it under the terms of the GNU General Public License as published by
9b55d4692Sfgsch the Free Software Foundation; either version 2 of the License, or
10b55d4692Sfgsch (at your option) any later version.
11b55d4692Sfgsch 
12b55d4692Sfgsch This program is distributed in the hope that it will be useful,
13b55d4692Sfgsch but WITHOUT ANY WARRANTY; without even the implied warranty of
14b55d4692Sfgsch MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15b55d4692Sfgsch GNU General Public License for more details.
16b55d4692Sfgsch 
17b55d4692Sfgsch You should have received a copy of the GNU General Public License
18b55d4692Sfgsch along with this program; if not, write to the Free Software
19b55d4692Sfgsch Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20b55d4692Sfgsch 
212159047fSniklas #ifndef source_h
222159047fSniklas #define source_h
232159047fSniklas 
242159047fSniklas typedef struct source_file
252159047fSniklas   {
262159047fSniklas     struct source_file *next;
27b55d4692Sfgsch     const char *name;		/* Name of source file.  */
28b55d4692Sfgsch     unsigned long ncalls;	/* # of "calls" to this file.  */
29b55d4692Sfgsch     int num_lines;		/* # of lines in file.  */
30b55d4692Sfgsch     int nalloced;		/* Number of lines allocated.  */
31b55d4692Sfgsch     void **line;		/* Usage-dependent per-line data.  */
322159047fSniklas   }
332159047fSniklas Source_File;
342159047fSniklas 
35b55d4692Sfgsch /* Options.  */
36*c074d1c9Sdrahn 
37*c074d1c9Sdrahn /* Create annotated output files?  */
38*c074d1c9Sdrahn extern bfd_boolean create_annotation_files;
392159047fSniklas 
40b55d4692Sfgsch /* List of directories to search for source files.  */
412159047fSniklas extern Search_List src_search_list;
422159047fSniklas 
43b55d4692Sfgsch /* Chain of source-file descriptors.  */
442159047fSniklas extern Source_File *first_src_file;
452159047fSniklas 
46b55d4692Sfgsch /* Returns pointer to source file descriptor for PATH/FILENAME.  */
47b55d4692Sfgsch extern Source_File *source_file_lookup_path PARAMS ((const char *));
48b55d4692Sfgsch extern Source_File *source_file_lookup_name PARAMS ((const char *));
492159047fSniklas 
50b55d4692Sfgsch /* Read source file SF output annotated source.  The annotation is at
51b55d4692Sfgsch    MAX_WIDTH characters wide and for each source-line an annotation is
52b55d4692Sfgsch    obtained by invoking function ANNOTE.  ARG is an argument passed to
53b55d4692Sfgsch    ANNOTE that is left uninterpreted by annotate_source().
54b55d4692Sfgsch 
55b55d4692Sfgsch    Returns a pointer to the output file (which maybe stdout) such
56b55d4692Sfgsch    that summary statistics can be printed.  If the returned file
57b55d4692Sfgsch    is not stdout, it should be closed when done with it.  */
58*c074d1c9Sdrahn extern FILE *annotate_source
59*c074d1c9Sdrahn   PARAMS ((Source_File *sf, unsigned int max_width,
60*c074d1c9Sdrahn 	   void (*annote) (char *, unsigned int, int, PTR arg),
61*c074d1c9Sdrahn 	   PTR arg));
622159047fSniklas #endif /* source_h */
63