summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Djurfeldt <djurfeldt@nada.kth.se>2000-06-19 00:41:54 +0000
committerMikael Djurfeldt <djurfeldt@nada.kth.se>2000-06-19 00:41:54 +0000
commit9293b3c638567aa05861eaaab14527f4a8f9b9f0 (patch)
tree342811e9ddb27f31bd7a3430c5149d466d9f7d12
parentbf1b9494f76c4a81122e878f38497c9cc9c338f6 (diff)
downloadguile-9293b3c638567aa05861eaaab14527f4a8f9b9f0.tar.gz
* gdbint.c (gdb_print): Print warning instead of calling scm_write
if Guile isn't yet initialized.
-rw-r--r--libguile/gdbint.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/libguile/gdbint.c b/libguile/gdbint.c
index 19d7d145b..59ad14093 100644
--- a/libguile/gdbint.c
+++ b/libguile/gdbint.c
@@ -63,6 +63,7 @@
#include "libguile/ports.h"
#include "libguile/root.h"
#include "libguile/strings.h"
+#include "libguile/init.h"
#include "libguile/gdbint.h"
@@ -105,6 +106,8 @@ do { \
} while (0)
+#define MSG_GUILE_NOT_INITIALIZED "*** Guile not initialized ***"
+
#define RESET_STRING { gdb_output_length = 0; }
#define SEND_STRING(str) \
@@ -264,20 +267,25 @@ gdb_eval (SCM exp)
int
gdb_print (SCM obj)
{
- RESET_STRING;
- SCM_BEGIN_FOREIGN_BLOCK;
- /* Reset stream */
- scm_seek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
- scm_write (obj, gdb_output_port);
- scm_truncate_file (gdb_output_port, SCM_UNDEFINED);
- {
- scm_port *pt = SCM_PTAB_ENTRY (gdb_output_port);
-
- scm_flush (gdb_output_port);
- *(pt->write_buf + pt->read_buf_size) = 0;
- SEND_STRING (pt->read_buf);
- }
- SCM_END_FOREIGN_BLOCK;
+ if (!scm_initialized_p)
+ SEND_STRING ("*** Guile not initialized ***");
+ else
+ {
+ RESET_STRING;
+ SCM_BEGIN_FOREIGN_BLOCK;
+ /* Reset stream */
+ scm_seek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
+ scm_write (obj, gdb_output_port);
+ scm_truncate_file (gdb_output_port, SCM_UNDEFINED);
+ {
+ scm_port *pt = SCM_PTAB_ENTRY (gdb_output_port);
+
+ scm_flush (gdb_output_port);
+ *(pt->write_buf + pt->read_buf_size) = 0;
+ SEND_STRING (pt->read_buf);
+ }
+ SCM_END_FOREIGN_BLOCK;
+ }
return 0;
}