Initial creation of sourceware repository
[external/binutils.git] / sim / igen / lf.h
1 /*  This file is part of the program psim.
2
3     Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14  
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  
19     */
20
21
22 /* LF: Line Numbered Output Stream */
23
24 typedef struct _lf lf;
25
26 typedef enum {
27   lf_is_h,
28   lf_is_c,
29   lf_is_text,
30 } lf_file_type;
31
32
33 typedef enum {
34   lf_include_references,
35   lf_omit_references,
36 } lf_file_references;
37
38
39 /* Open the file NAME for writing ("-" for stdout).  Use REAL_NAME
40    when refering to the opened file.  Line number information (in the
41    output) can be suppressed with FILE_REFERENCES ==
42    LF_OMIT_REFERENCES.  TYPE is to determine the formatting of some of
43    the print messages below. */
44
45 extern lf *lf_open
46 (char *name,
47  char *real_name,
48  lf_file_references file_references,
49  lf_file_type type,
50  const char *program);
51
52 extern void lf_close
53 (lf *file);
54
55
56 /* Basic output functions */
57
58 extern int lf_write
59 (lf *file,
60  const char *string,
61  int len);
62
63 extern int lf_putchr
64 (lf *file,
65  const char ch);
66
67 extern int lf_putstr
68 (lf *file,
69  const char *string);
70
71 extern int lf_putint
72 (lf *file,
73  int decimal);
74
75 extern int lf_putbin
76 (lf *file,
77  int decimal,
78  int width);
79
80 extern int lf_printf
81 (lf *file,
82  const char *fmt,
83  ...) __attribute__((format(printf, 2, 3)));
84
85
86 /* Indentation control.
87
88    lf_indent_suppress suppresses indentation on the next line (current
89    line if that has not yet been started) */
90
91 extern void lf_indent_suppress
92 (lf *file);
93
94 extern void lf_indent
95 (lf *file,
96  int delta);
97
98
99 /* Print generic text: */
100
101
102 extern int lf_print__gnu_copyleft
103 (lf *file);
104
105 extern int lf_print__file_start
106 (lf *file);
107
108 extern int lf_print__this_file_is_empty
109 (lf *file,
110  const char *reason);
111
112 extern int lf_print__file_finish
113 (lf *file);
114
115 extern int lf_print__internal_ref
116 (lf *file);
117
118 extern int lf_print__external_ref
119 (lf *file,
120  int line_nr,
121  const char *file_name);
122
123 extern int lf_print__line_ref
124 (lf *file,
125  line_ref *line);
126
127 extern int lf_print__ucase_filename
128 (lf *file);
129
130 extern int lf_print__function_type
131 (lf *file,
132  const char *type,
133  const char *prefix,
134  const char *trailing_space);
135
136 typedef int print_function(lf *file);
137
138 extern int lf_print__function_type_function
139 (lf *file,
140  print_function *print_type,
141  const char *prefix,
142  const char *trailing_space);
143