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 3 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, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 21 /* LF: Line Numbered Output Stream */ 22 23 typedef struct _lf lf; 24 25 typedef enum { 26 lf_is_h, 27 lf_is_c, 28 lf_is_text, 29 } lf_file_type; 30 31 32 typedef enum { 33 lf_include_references, 34 lf_omit_references, 35 } lf_file_references; 36 37 38 /* Open the file NAME for writing. REAL_NAME is to be included in any 39 line number outputs. The output of line number information can be 40 suppressed with LINE_NUMBERS */ 41 42 extern lf *lf_open 43 (char *name, 44 char *real_name, 45 lf_file_references file_references, 46 lf_file_type type, 47 const char *program); 48 49 extern void lf_close 50 (lf *file); 51 52 53 /* Basic output functions */ 54 55 extern int lf_putchr 56 (lf *file, 57 const char ch); 58 59 extern int lf_putstr 60 (lf *file, 61 const char *string); 62 63 extern int lf_putint 64 (lf *file, 65 int decimal); 66 67 extern int lf_putbin 68 (lf *file, 69 int decimal, 70 int width); 71 72 extern int lf_printf 73 (lf *file, 74 const char *fmt, 75 ...) __attribute__((format(printf, 2, 3))); 76 77 78 /* Indentation control. 79 80 lf_indent_suppress suppresses indentation on the next line (current 81 line if that has not yet been started) */ 82 83 extern void lf_indent_suppress 84 (lf *file); 85 86 extern void lf_indent 87 (lf *file, 88 int delta); 89 90 91 /* Print generic text: */ 92 93 94 extern int lf_print__gnu_copyleft 95 (lf *file); 96 97 extern int lf_print__file_start 98 (lf *file); 99 100 extern int lf_print__this_file_is_empty 101 (lf *file); 102 103 extern int lf_print__file_finish 104 (lf *file); 105 106 extern int lf_print__internal_reference 107 (lf *file); 108 109 extern int lf_print__external_reference 110 (lf *file, 111 int line_nr, 112 const char *file_name); 113 114 extern int lf_print__ucase_filename 115 (lf *file); 116 117 /* Tab prefix is suppressed */ 118 119 extern int lf_print__c_code 120 (lf *file, 121 const char *code); 122 123 124 extern int lf_print_function_type 125 (lf *file, 126 const char *type, 127 const char *prefix, 128 const char *trailing_space); 129