| 1 | /* This file is part of the program psim. |
| 2 | |
| 3 | Copyright (C) 1994-1995, 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. REAL_NAME is to be included in any |
| 40 | line number outputs. The output of line number information can be |
| 41 | suppressed with LINE_NUMBERS */ |
| 42 | |
| 43 | extern lf *lf_open |
| 44 | (char *name, |
| 45 | char *real_name, |
| 46 | lf_file_references file_references, |
| 47 | lf_file_type type, |
| 48 | const char *program); |
| 49 | |
| 50 | extern void lf_close |
| 51 | (lf *file); |
| 52 | |
| 53 | |
| 54 | /* Basic output functions */ |
| 55 | |
| 56 | extern int lf_putchr |
| 57 | (lf *file, |
| 58 | const char ch); |
| 59 | |
| 60 | extern int lf_putstr |
| 61 | (lf *file, |
| 62 | const char *string); |
| 63 | |
| 64 | extern int lf_putint |
| 65 | (lf *file, |
| 66 | int decimal); |
| 67 | |
| 68 | extern int lf_putbin |
| 69 | (lf *file, |
| 70 | int decimal, |
| 71 | int width); |
| 72 | |
| 73 | extern int lf_printf |
| 74 | (lf *file, |
| 75 | const char *fmt, |
| 76 | ...) __attribute__((format(printf, 2, 3))); |
| 77 | |
| 78 | |
| 79 | /* Indentation control. |
| 80 | |
| 81 | lf_indent_suppress suppresses indentation on the next line (current |
| 82 | line if that has not yet been started) */ |
| 83 | |
| 84 | extern void lf_indent_suppress |
| 85 | (lf *file); |
| 86 | |
| 87 | extern void lf_indent |
| 88 | (lf *file, |
| 89 | int delta); |
| 90 | |
| 91 | |
| 92 | /* Print generic text: */ |
| 93 | |
| 94 | |
| 95 | extern int lf_print__gnu_copyleft |
| 96 | (lf *file); |
| 97 | |
| 98 | extern int lf_print__file_start |
| 99 | (lf *file); |
| 100 | |
| 101 | extern int lf_print__this_file_is_empty |
| 102 | (lf *file); |
| 103 | |
| 104 | extern int lf_print__file_finish |
| 105 | (lf *file); |
| 106 | |
| 107 | extern int lf_print__internal_reference |
| 108 | (lf *file); |
| 109 | |
| 110 | extern int lf_print__external_reference |
| 111 | (lf *file, |
| 112 | int line_nr, |
| 113 | const char *file_name); |
| 114 | |
| 115 | extern int lf_print__ucase_filename |
| 116 | (lf *file); |
| 117 | |
| 118 | /* Tab prefix is suppressed */ |
| 119 | |
| 120 | extern int lf_print__c_code |
| 121 | (lf *file, |
| 122 | const char *code); |
| 123 | |
| 124 | |
| 125 | extern int lf_print_function_type |
| 126 | (lf *file, |
| 127 | const char *type, |
| 128 | const char *prefix, |
| 129 | const char *trailing_space); |