lf.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* This file is part of the program psim.
  2. Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /* LF: Line Numbered Output Stream */
  15. typedef struct _lf lf;
  16. typedef enum {
  17. lf_is_h,
  18. lf_is_c,
  19. lf_is_text,
  20. } lf_file_type;
  21. typedef enum {
  22. lf_include_references,
  23. lf_omit_references,
  24. } lf_file_references;
  25. /* Open the file NAME for writing. REAL_NAME is to be included in any
  26. line number outputs. The output of line number information can be
  27. suppressed with LINE_NUMBERS */
  28. extern lf *lf_open
  29. (char *name,
  30. char *real_name,
  31. lf_file_references file_references,
  32. lf_file_type type,
  33. const char *program);
  34. extern void lf_close
  35. (lf *file);
  36. /* Basic output functions */
  37. extern int lf_putchr
  38. (lf *file,
  39. const char ch);
  40. extern int lf_putstr
  41. (lf *file,
  42. const char *string);
  43. extern int lf_putint
  44. (lf *file,
  45. int decimal);
  46. extern int lf_putbin
  47. (lf *file,
  48. int decimal,
  49. int width);
  50. extern int lf_printf
  51. (lf *file,
  52. const char *fmt,
  53. ...) __attribute__((format(printf, 2, 3)));
  54. /* Indentation control.
  55. lf_indent_suppress suppresses indentation on the next line (current
  56. line if that has not yet been started) */
  57. extern void lf_indent_suppress
  58. (lf *file);
  59. extern void lf_indent
  60. (lf *file,
  61. int delta);
  62. /* Print generic text: */
  63. extern int lf_print__gnu_copyleft
  64. (lf *file);
  65. extern int lf_print__file_start
  66. (lf *file);
  67. extern int lf_print__this_file_is_empty
  68. (lf *file);
  69. extern int lf_print__file_finish
  70. (lf *file);
  71. extern int lf_print__internal_reference
  72. (lf *file);
  73. extern int lf_print__external_reference
  74. (lf *file,
  75. int line_nr,
  76. const char *file_name);
  77. extern int lf_print__ucase_filename
  78. (lf *file);
  79. /* Tab prefix is suppressed */
  80. extern int lf_print__c_code
  81. (lf *file,
  82. const char *code);
  83. extern int lf_print_function_type
  84. (lf *file,
  85. const char *type,
  86. const char *prefix,
  87. const char *trailing_space);