* win32-socket.c: #include <config.h> if HAVE_CONFIG_H.
[bpt/guile.git] / libguile / gdb_interface.h
CommitLineData
0527e687
DH
1/* classes: h_files */
2
3#ifndef GDB_INTERFACE_H
4#define GDB_INTERFACE_H
504388eb 5/* Simple interpreter interface for GDB, the GNU debugger.
58ade102 6 Copyright (C) 1996, 2000, 2001 Free Software Foundation
504388eb
MD
7
8This file is part of GDB.
9
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
c22adbeb
MV
24As a special exception, the Free Software Foundation gives permission
25for additional uses of the text contained in its release of GUILE.
26
27The exception is that, if you link the GUILE library with other files
28to produce an executable, this does not by itself cause the
29resulting executable to be covered by the GNU General Public License.
30Your use of that executable is in no way restricted on account of
31linking the GUILE library code into it.
32
33This exception does not however invalidate any other reasons why
34the executable file might be covered by the GNU General Public License.
35
36This exception applies only to the code released by the
37Free Software Foundation under the name GUILE. If you copy
38code from other Free Software Foundation releases into a copy of
39GUILE, as the General Public License permits, the exception does
40not apply to the code that you add in this way. To avoid misleading
41anyone as to the status of such modified files, you must delete
42this exception notice from them.
43
44If you write modifications of your own for GUILE, it is your choice
45whether to permit this exception to apply to your modifications.
46If you do not wish that, delete this exception notice.
47
504388eb
MD
48The author can be reached at djurfeldt@nada.kth.se
49Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
50
51/* This is the header file for GDB's interpreter interface. The
52 interpreter must supply definitions of all symbols declared in this
53 file.
54
55 Before including this file, you must #define GDB_TYPE to be the
56 data type used for communication with the interpreter. */
57
58/* The following macro can be used to anchor the symbols of the
59 interface in your main program. This is necessary if the interface
60 is defined in a library, such as Guile. */
61
c01a6af5 62#if !defined (__MINGW32__) && !defined (__CYGWIN__)
504388eb
MD
63#define GDB_INTERFACE \
64void *gdb_interface[] = { \
65 &gdb_options, \
66 &gdb_language, \
67 &gdb_result, \
68 &gdb_output, \
69 &gdb_output_length, \
01c77a0a
MD
70 (void *) gdb_maybe_valid_type_p, \
71 (void *) gdb_read, \
72 (void *) gdb_eval, \
73 (void *) gdb_print, \
74 (void *) gdb_binding \
8f9dc614 75}
c01a6af5 76#else /* __MINGW32__, __CYGWIN__ */
82893676
MG
77/* Because the following functions are imported from a DLL (some kind of
78 shared library) these are NO static initializers. That is why you need to
79 define them and assign the functions and data items at run time. */
80#define GDB_INTERFACE \
81void *gdb_interface[] = \
82 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
83#define GDB_INTERFACE_INIT \
84 do { \
85 gdb_interface[0] = &gdb_options; \
86 gdb_interface[1] = &gdb_language; \
87 gdb_interface[2] = &gdb_result; \
88 gdb_interface[3] = &gdb_output; \
89 gdb_interface[4] = &gdb_output_length; \
90 gdb_interface[5] = (void *) gdb_maybe_valid_type_p; \
91 gdb_interface[6] = (void *) gdb_read; \
92 gdb_interface[7] = (void *) gdb_eval; \
93 gdb_interface[8] = (void *) gdb_print; \
94 gdb_interface[9] = (void *) gdb_binding; \
95 } while (0);
96#endif /* __MINGW32__ */
504388eb
MD
97
98/* GDB_OPTIONS is a set of flags informing gdb what features are present
99 in the interface. Currently only one option is supported: */
100
101/* GDB_HAVE_BINDINGS: Set this bit if your interpreter can create new
102 top level bindings on demand (through gdb_top_level_binding) */
103
104#define GDB_HAVE_BINDINGS 1
105
c01a6af5 106SCM_API unsigned short gdb_options;
504388eb
MD
107
108/* GDB_LANGUAGE holds the name of the preferred language mode for this
109 interpreter. For lisp interpreters, the suggested mode is "lisp/c". */
110
c01a6af5 111SCM_API char *gdb_language;
504388eb
MD
112
113/* GDB_RESULT is used for passing results from the interpreter to GDB */
114
c01a6af5 115SCM_API GDB_TYPE gdb_result;
504388eb
MD
116
117/* The interpreter passes strings to GDB in GDB_OUTPUT and
118 GDB_OUTPUT_LENGTH. GDB_OUTPUT should hold the pointer to the
119 string. GDB_OUTPUT_LENGTH should hold its length. The string
120 doesn't need to be terminated by '\0'. */
121
c01a6af5 122SCM_API char *gdb_output;
504388eb 123
c01a6af5 124SCM_API int gdb_output_length;
504388eb 125
504388eb
MD
126/* Return TRUE if the interpreter regards VALUE's type as valid. A
127 lazy implementation is allowed to pass TRUE always. FALSE should
128 only be returned when it is certain that VALUE is not valid.
129
130 In the "lisp/c" language mode, this is used to heuristically
131 discriminate lisp values from C values during printing. */
132
c01a6af5 133SCM_API int gdb_maybe_valid_type_p (GDB_TYPE value);
504388eb
MD
134
135/* Parse expression in string STR. Store result in GDB_RESULT, then
136 return 0 to indicate success. On error, return -1 to indicate
137 failure. An error string can be passed in GDB_OUTPUT and
138 GDB_OUTPUT_LENGTH. Be careful to set GDB_OUTPUT_LENGTH to zero if
139 no message is passed. Please note that the resulting value should
140 be protected against garbage collection. */
141
c01a6af5 142SCM_API int gdb_read (char *str);
504388eb
MD
143
144/* Evaluate expression EXP. Store result in GDB_RESULT, then return 0
145 to indicate success. On error, return -1 to indicate failure. Any
146 output (both on success and failure) can be passed in GDB_OUTPUT
147 and GDB_OUTPUT_LENGTH. Be careful to set GDB_OUTPUT_LENGTH to zero
148 if no output is passed. Please note that the resulting lisp object
149 should be protected against garbage collection. */
150
c01a6af5 151SCM_API int gdb_eval (GDB_TYPE exp);
504388eb
MD
152
153/* Print VALUE. Store output in GDB_OUTPUT and GDB_OUTPUT_LENGTH.
154 Return 0 to indicate success. On error, return -1 to indicate
155 failure. GDB will not look at GDB_OUTPUT or GDB_OUTPUT_LENGTH on
156 failure. Note that this function should be robust against strange
157 values. It could in fact be passed any kind of value. */
158
c01a6af5 159SCM_API int gdb_print (GDB_TYPE value);
504388eb
MD
160
161/* Bind NAME to VALUE in interpreter. (GDB has previously obtained
162 NAME by passing a string to gdb_read.) Return 0 to indicate
163 success or -1 to indicate failure. This feature is optional. GDB
164 will only call this function if the GDB_HAVE_BINDINGS flag is set
165 in gdb_options. Note that GDB may call this function many times
166 for the same name.
167
168 For scheme interpreters, this function should introduce top-level
169 bindings. */
170
c01a6af5 171SCM_API int gdb_binding (GDB_TYPE name, GDB_TYPE value);
504388eb 172
0527e687 173#endif /* GDB_INTERFACE_H */
89e00824
ML
174
175/*
176 Local Variables:
177 c-file-style: "gnu"
178 End:
179*/