xref: /netbsd-src/external/gpl3/gdb/dist/sim/igen/lf.h (revision 71f621822dbfd5073a314948bec169b7bb05f7be)
1 /* The IGEN simulator generator for GDB, the GNU Debugger.
2 
3    Copyright 2002-2024 Free Software Foundation, Inc.
4 
5    Contributed by Andrew Cagney.
6 
7    This file is part of GDB.
8 
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21 
22 #ifndef IGEN_LF_H
23 #define IGEN_LF_H
24 
25 #include "ansidecl.h"
26 #include "misc.h"
27 
28 /* LF: Line Numbered Output Stream */
29 
30 typedef struct _lf lf;
31 
32 typedef enum
33 {
34   lf_is_h,
35   lf_is_c,
36   lf_is_text,
37 }
38 lf_file_type;
39 
40 
41 typedef enum
42 {
43   lf_include_references,
44   lf_omit_references,
45 }
46 lf_file_references;
47 
48 
49 /* Open the file NAME for writing ("-" for stdout).  Use REAL_NAME
50    when refering to the opened file.  Line number information (in the
51    output) can be suppressed with FILE_REFERENCES ==
52    LF_OMIT_REFERENCES.  TYPE is to determine the formatting of some of
53    the print messages below. */
54 
55 extern lf *lf_open
56   (const char *name,
57    const char *real_name,
58    lf_file_references file_references,
59    lf_file_type type, const char *program);
60 
61 extern lf_file_type lf_get_file_type (const lf *file);
62 
63 extern void lf_close (lf *file);
64 
65 
66 /* Basic output functions */
67 
68 extern int lf_write (lf *file, const char *string, int len);
69 
70 extern int lf_putchr (lf *file, const char ch);
71 
72 extern int lf_putstr (lf *file, const char *string);
73 
74 extern int lf_putint (lf *file, int decimal);
75 
76 extern int lf_putbin (lf *file, int decimal, int width);
77 
78 extern int lf_printf
79   (lf *file, const char *fmt, ...) ATTRIBUTE_PRINTF (2, 3);
80 
81 
82 /* Indentation control.
83 
84    lf_indent_suppress suppresses indentation on the next line (current
85    line if that has not yet been started) */
86 
87 extern void lf_indent_suppress (lf *file);
88 
89 extern void lf_indent (lf *file, int delta);
90 
91 
92 /* Print generic text: */
93 
94 
95 extern int lf_print__gnu_copyleft (lf *file);
96 
97 extern int lf_print__file_start (lf *file);
98 
99 extern int lf_print__this_file_is_empty (lf *file, const char *reason);
100 
101 extern int lf_print__file_finish (lf *file);
102 
103 extern int lf_print__internal_ref (lf *file);
104 
105 extern int lf_print__external_ref
106   (lf *file, int line_nr, const char *file_name);
107 
108 extern int lf_print__line_ref (lf *file, const line_ref *line);
109 
110 extern int lf_print__ucase_filename (lf *file);
111 
112 extern int lf_print__function_type
113   (lf *file,
114    const char *type, const char *prefix, const char *trailing_space);
115 
116 typedef int print_function (lf *file);
117 
118 extern int lf_print__function_type_function
119   (lf *file,
120    print_function * print_type,
121    const char *prefix, const char *trailing_space);
122 
123 #endif /* IGEN_LF_H */
124