| 1 |
/* do not edit automatically generated by mc from mcPretty. */ |
| 2 |
/* mcPretty.def provides an interface to the pretty printing of output code. |
| 3 |
|
| 4 |
Copyright (C) 2016-2025 Free Software Foundation, Inc. |
| 5 |
Contributed by Gaius Mulley <[email protected]>. |
| 6 |
|
| 7 |
This file is part of GNU Modula-2. |
| 8 |
|
| 9 |
GNU Modula-2 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, or (at your option) |
| 12 |
any later version. |
| 13 |
|
| 14 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 21 |
<http://www.gnu.org/licenses/>. */ |
| 22 |
|
| 23 |
|
| 24 |
#if !defined (_mcPretty_H) |
| 25 |
# define _mcPretty_H |
| 26 |
|
| 27 |
#include "config.h" |
| 28 |
#include "system.h" |
| 29 |
# ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
# endif |
| 32 |
#include <stdbool.h> |
| 33 |
# if !defined (PROC_D) |
| 34 |
# define PROC_D |
| 35 |
typedef void (*PROC_t) (void); |
| 36 |
typedef struct { PROC_t proc; } PROC; |
| 37 |
# endif |
| 38 |
|
| 39 |
# include "GDynamicStrings.h" |
| 40 |
|
| 41 |
# if defined (_mcPretty_C) |
| 42 |
# define EXTERN |
| 43 |
# else |
| 44 |
# define EXTERN extern |
| 45 |
# endif |
| 46 |
|
| 47 |
#if !defined (mcPretty_pretty_D) |
| 48 |
# define mcPretty_pretty_D |
| 49 |
typedef void *mcPretty_pretty; |
| 50 |
#endif |
| 51 |
|
| 52 |
typedef struct mcPretty_writeProc_p mcPretty_writeProc; |
| 53 |
|
| 54 |
typedef struct mcPretty_writeLnProc_p mcPretty_writeLnProc; |
| 55 |
|
| 56 |
typedef void (*mcPretty_writeProc_t) (char); |
| 57 |
struct mcPretty_writeProc_p { mcPretty_writeProc_t proc; }; |
| 58 |
|
| 59 |
typedef void (*mcPretty_writeLnProc_t) (void); |
| 60 |
struct mcPretty_writeLnProc_p { mcPretty_writeLnProc_t proc; }; |
| 61 |
|
| 62 |
|
| 63 |
/* |
| 64 |
initPretty - initialise a pretty print data structure. |
| 65 |
*/ |
| 66 |
|
| 67 |
EXTERN mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_writeLnProc l); |
| 68 |
|
| 69 |
/* |
| 70 |
dupPretty - duplicate a pretty print data structure. |
| 71 |
*/ |
| 72 |
|
| 73 |
EXTERN mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p); |
| 74 |
|
| 75 |
/* |
| 76 |
killPretty - destroy a pretty print data structure. |
| 77 |
Post condition: p is assigned to NIL. |
| 78 |
*/ |
| 79 |
|
| 80 |
EXTERN void mcPretty_killPretty (mcPretty_pretty *p); |
| 81 |
|
| 82 |
/* |
| 83 |
pushPretty - duplicate, p. Push, p, and return the duplicate. |
| 84 |
*/ |
| 85 |
|
| 86 |
EXTERN mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p); |
| 87 |
|
| 88 |
/* |
| 89 |
popPretty - pops the pretty object from the stack. |
| 90 |
*/ |
| 91 |
|
| 92 |
EXTERN mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p); |
| 93 |
|
| 94 |
/* |
| 95 |
getindent - returns the current indent value. |
| 96 |
*/ |
| 97 |
|
| 98 |
EXTERN unsigned int mcPretty_getindent (mcPretty_pretty p); |
| 99 |
|
| 100 |
/* |
| 101 |
setindent - sets the current indent to, n. |
| 102 |
*/ |
| 103 |
|
| 104 |
EXTERN void mcPretty_setindent (mcPretty_pretty p, unsigned int n); |
| 105 |
|
| 106 |
/* |
| 107 |
getcurpos - returns the current cursor position. |
| 108 |
*/ |
| 109 |
|
| 110 |
EXTERN unsigned int mcPretty_getcurpos (mcPretty_pretty s); |
| 111 |
|
| 112 |
/* |
| 113 |
getseekpos - returns the seek position. |
| 114 |
*/ |
| 115 |
|
| 116 |
EXTERN unsigned int mcPretty_getseekpos (mcPretty_pretty s); |
| 117 |
|
| 118 |
/* |
| 119 |
getcurline - returns the current line number. |
| 120 |
*/ |
| 121 |
|
| 122 |
EXTERN unsigned int mcPretty_getcurline (mcPretty_pretty s); |
| 123 |
|
| 124 |
/* |
| 125 |
setNeedSpace - sets needSpace flag to TRUE. |
| 126 |
*/ |
| 127 |
|
| 128 |
EXTERN void mcPretty_setNeedSpace (mcPretty_pretty s); |
| 129 |
|
| 130 |
/* |
| 131 |
noSpace - unset needsSpace. |
| 132 |
*/ |
| 133 |
|
| 134 |
EXTERN void mcPretty_noSpace (mcPretty_pretty s); |
| 135 |
|
| 136 |
/* |
| 137 |
print - print a string using, p. |
| 138 |
*/ |
| 139 |
|
| 140 |
EXTERN void mcPretty_print (mcPretty_pretty p, const char *a_, unsigned int _a_high); |
| 141 |
|
| 142 |
/* |
| 143 |
prints - print a string using, p. |
| 144 |
*/ |
| 145 |
|
| 146 |
EXTERN void mcPretty_prints (mcPretty_pretty p, DynamicStrings_String s); |
| 147 |
|
| 148 |
/* |
| 149 |
raw - print out string, s, without any translation of |
| 150 |
escape sequences. |
| 151 |
*/ |
| 152 |
|
| 153 |
EXTERN void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s); |
| 154 |
# ifdef __cplusplus |
| 155 |
} |
| 156 |
# endif |
| 157 |
|
| 158 |
# undef EXTERN |
| 159 |
#endif |