aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/spadint.c
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-05-21 12:58:52 +0000
committerdos-reis <gdr@axiomatics.org>2008-05-21 12:58:52 +0000
commitc145229d7f609447ec9342f60643c62e35bd553f (patch)
tree8beeb41a7a55409d493ca87c93c4cfb4e4bdcca1 /src/hyper/spadint.c
parent28aeada5c757a5a997526f74a471cf0c56c6b473 (diff)
downloadopen-axiom-c145229d7f609447ec9342f60643c62e35bd553f.tar.gz
* hyper/hyper.h (connect_spad): Declare.
(gPageBeingParsed): Likewise. * hyper/htadd.c (session_server): Remove. (MenuServerOpened): Likewise. (gXDisplay): Likewise. (gXScreenNumber): Likewise. * hyper/lex.c (reset_connection): Move to hyper/parse.c (connect_spad): Move to hyper/spadint.c (spad_busy): Likewise. (get_char1): Remove conditional code. * hyper/Makefile.in (mostclean-local): Tidy.
Diffstat (limited to 'src/hyper/spadint.c')
-rw-r--r--src/hyper/spadint.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c
index 3e21deac..9f782e6c 100644
--- a/src/hyper/spadint.c
+++ b/src/hyper/spadint.c
@@ -42,6 +42,7 @@
#include "debug.h"
#include <signal.h>
+#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
#include "parse.h"
@@ -59,6 +60,39 @@ typedef struct sock_list { /* linked list of openaxiom_sio */
Sock_List *plSock = (Sock_List *) 0;
openaxiom_sio *spad_socket = (openaxiom_sio *) 0; /* to_server socket for SpadServer */
+
+/* connect to OpenAxiom , return 0 if succesful, 1 if not */
+int
+connect_spad(void)
+{
+ if (!MenuServerOpened) {
+ fprintf(stderr, "(HyperDoc) Warning: Not connected to OpenAxiom Server!\n");
+ LoudBeepAtTheUser();
+ return NotConnected;
+ }
+ if (spad_socket == NULL) {
+ spad_socket = connect_to_local_server(SpadServer, MenuServer, Forever);
+ if (spad_socket == NULL) {
+ fprintf(stderr, "(HyperDoc) Warning: Could not connect to OpenAxiom Server!\n");
+ LoudBeepAtTheUser();
+ return NotConnected;
+ }
+ }
+ /* if (spad_busy()) return SpadBusy; */
+ return Connected;
+}
+
+/* returns true if spad is currently computing */
+int
+spad_busy(void)
+{
+ if (session_server == NULL)
+ return 1;
+ send_int(session_server, QuerySpad);
+ return get_int(session_server);
+}
+
+
/* issue a OpenAxiom command to the buffer associated with a page */
void
issue_spadcommand(HyperDocPage *page, TextNode *command, int immediate,