]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/pge-boot/GDebug.c
1 /* do not edit automatically generated by mc from Debug. */
2 /* Debug.mod provides some simple debugging routines.
4 Copyright (C) 2001-2021 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
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)
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.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
28 # if !defined (PROC_D)
30 typedef void (*PROC_t
) (void);
31 typedef struct { PROC_t proc
; } PROC
;
40 # include "GNumberIO.h"
45 # define MaxNoOfDigits 12
48 Halt - writes a message in the format:
51 It then terminates by calling HALT.
54 extern "C" void Debug_Halt (const char *Message_
, unsigned int _Message_high
, unsigned int LineNo
, const char *Module_
, unsigned int _Module_high
);
57 DebugString - writes a string to the debugging device (Scn.Write).
59 as carriage return, linefeed.
62 extern "C" void Debug_DebugString (const char *a_
, unsigned int _a_high
);
65 WriteLn - writes a carriage return and a newline
69 static void WriteLn (void);
73 WriteLn - writes a carriage return and a newline
77 static void WriteLn (void)
79 StdIO_Write (ASCII_cr
);
80 StdIO_Write (ASCII_lf
);
85 Halt - writes a message in the format:
88 It then terminates by calling HALT.
91 extern "C" void Debug_Halt (const char *Message_
, unsigned int _Message_high
, unsigned int LineNo
, const char *Module_
, unsigned int _Module_high
)
93 typedef struct Halt__T1_a Halt__T1
;
95 struct Halt__T1_a
{ char array
[MaxNoOfDigits
+1]; };
97 char Message
[_Message_high
+1];
98 char Module
[_Module_high
+1];
100 /* make a local copy of each unbounded array. */
101 memcpy (Message
, Message_
, _Message_high
+1);
102 memcpy (Module
, Module_
, _Module_high
+1);
104 Debug_DebugString ((const char *) Module
, _Module_high
); /* should be large enough for most source files.. */
105 NumberIO_CardToStr (LineNo
, 0, (char *) &No
.array
[0], MaxNoOfDigits
);
106 Debug_DebugString ((const char *) ":", 1);
107 Debug_DebugString ((const char *) &No
.array
[0], MaxNoOfDigits
);
108 Debug_DebugString ((const char *) ":", 1);
109 Debug_DebugString ((const char *) Message
, _Message_high
);
110 Debug_DebugString ((const char *) "\\n", 2);
112 __builtin_unreachable ();
117 DebugString - writes a string to the debugging device (Scn.Write).
119 as carriage return, linefeed.
122 extern "C" void Debug_DebugString (const char *a_
, unsigned int _a_high
)
128 /* make a local copy of each unbounded array. */
129 memcpy (a
, a_
, _a_high
+1);
133 while ((n
<= high
) && (a
[n
] != ASCII_nul
))
137 /* avoid dangling else. */
140 /* avoid gcc warning by using compound statement even if not strictly necessary. */
146 else if (a
[n
+1] == '\\')
148 /* avoid dangling else. */
162 extern "C" void _M2_Debug_init (__attribute__((unused
)) int argc
,__attribute__((unused
)) char *argv
[],__attribute__((unused
)) char *envp
[])
166 extern "C" void _M2_Debug_finish (__attribute__((unused
)) int argc
,__attribute__((unused
)) char *argv
[],__attribute__((unused
)) char *envp
[])