diff options
author | dos-reis <gdr@axiomatics.org> | 2008-05-21 12:58:52 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-05-21 12:58:52 +0000 |
commit | c145229d7f609447ec9342f60643c62e35bd553f (patch) | |
tree | 8beeb41a7a55409d493ca87c93c4cfb4e4bdcca1 | |
parent | 28aeada5c757a5a997526f74a471cf0c56c6b473 (diff) | |
download | open-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.
-rw-r--r-- | src/ChangeLog | 14 | ||||
-rw-r--r-- | src/hyper/Makefile.in | 5 | ||||
-rw-r--r-- | src/hyper/ReadBitmap.c | 1 | ||||
-rw-r--r-- | src/hyper/addfile.c | 1 | ||||
-rw-r--r-- | src/hyper/cond.c | 2 | ||||
-rw-r--r-- | src/hyper/event.c | 1 | ||||
-rw-r--r-- | src/hyper/extent2.c | 1 | ||||
-rw-r--r-- | src/hyper/group.c | 1 | ||||
-rw-r--r-- | src/hyper/htadd.c | 4 | ||||
-rw-r--r-- | src/hyper/hterror.c | 1 | ||||
-rw-r--r-- | src/hyper/htinp.c | 1 | ||||
-rw-r--r-- | src/hyper/hyper.c | 1 | ||||
-rw-r--r-- | src/hyper/hyper.h | 4 | ||||
-rw-r--r-- | src/hyper/item.c | 1 | ||||
-rw-r--r-- | src/hyper/keyin.c | 1 | ||||
-rw-r--r-- | src/hyper/lex.c | 56 | ||||
-rw-r--r-- | src/hyper/lex.h | 7 | ||||
-rw-r--r-- | src/hyper/macro.c | 1 | ||||
-rw-r--r-- | src/hyper/mem.c | 1 | ||||
-rw-r--r-- | src/hyper/parse-aux.c | 1 | ||||
-rw-r--r-- | src/hyper/parse-input.c | 1 | ||||
-rw-r--r-- | src/hyper/parse-paste.c | 2 | ||||
-rw-r--r-- | src/hyper/parse-types.c | 1 | ||||
-rw-r--r-- | src/hyper/parse.c | 18 | ||||
-rw-r--r-- | src/hyper/scrollbar.c | 1 | ||||
-rw-r--r-- | src/hyper/spadbuf.c | 4 | ||||
-rw-r--r-- | src/hyper/spadint.c | 34 | ||||
-rw-r--r-- | src/hyper/titlebar.c | 1 | ||||
-rw-r--r-- | src/hyper/token.h | 3 |
29 files changed, 101 insertions, 69 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8a26d3a5..738b80d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,19 @@ 2008-05-21 Gabriel Dos Reis <gdr@cs.tamu.edu> + * 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. + +2008-05-21 Gabriel Dos Reis <gdr@cs.tamu.edu> + * graph/Gdraws/Makefile.in (HEADERS): Don't include hash.H1. * include/halloc.h: Rename from include/halloc.H1. * include/lex.H1: Remove. diff --git a/src/hyper/Makefile.in b/src/hyper/Makefile.in index e099fa56..a09184c9 100644 --- a/src/hyper/Makefile.in +++ b/src/hyper/Makefile.in @@ -110,10 +110,13 @@ stamp: $(HEADERS) ${BITMAPS} ${SCRIPTS} ${BINFILES} ${HYPER}/pages/ht.db $(STAMP) stamp mostclean-local: + $(LIBTOOL) --mode=clean rm -f $(hypertex_objects) $(htadd_objects) \ + $(spadbuf_objects) $(hthits_objects) $(ex2ht_objects) clean-local: mostclean-local - -rm -f $(objects) -rm -f $(BINFILES) + -rm -rf $(HYPER)/pages + -rm -f $(SCRIPTS) distclean-local: clean-local diff --git a/src/hyper/ReadBitmap.c b/src/hyper/ReadBitmap.c index 845e9e9d..0046726f 100644 --- a/src/hyper/ReadBitmap.c +++ b/src/hyper/ReadBitmap.c @@ -38,6 +38,7 @@ #include "openaxiom-c-macros.h" #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "hyper.h" diff --git a/src/hyper/addfile.c b/src/hyper/addfile.c index 32eddd95..6e460fc6 100644 --- a/src/hyper/addfile.c +++ b/src/hyper/addfile.c @@ -46,7 +46,6 @@ #include <errno.h> #include "halloc.h" -#include "all_hyper_proto.H1" static int build_ht_filename(char*, char*, char*); static int pathname(char*); diff --git a/src/hyper/cond.c b/src/hyper/cond.c index b0a72229..82d79c4d 100644 --- a/src/hyper/cond.c +++ b/src/hyper/cond.c @@ -46,6 +46,8 @@ #include "debug.h" #include "sockio.h" +#include "hterror.h" +#include "halloc.h" #include "hyper.h" #include "all_hyper_proto.H1" diff --git a/src/hyper/event.c b/src/hyper/event.c index 10930dc7..8da7b16a 100644 --- a/src/hyper/event.c +++ b/src/hyper/event.c @@ -58,6 +58,7 @@ #include "initx.h" #include "scrollbar.h" #include "group.h" +#include "lex.h" #include "all_hyper_proto.H1" #include "sockio.h" diff --git a/src/hyper/extent2.c b/src/hyper/extent2.c index 84b11bc9..2caf79ca 100644 --- a/src/hyper/extent2.c +++ b/src/hyper/extent2.c @@ -46,6 +46,7 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "extent.h" #include "group.h" diff --git a/src/hyper/group.c b/src/hyper/group.c index de347b7e..f1f69f84 100644 --- a/src/hyper/group.c +++ b/src/hyper/group.c @@ -45,6 +45,7 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "group.h" #include "initx.h" diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c index 6caa50da..2c0a1990 100644 --- a/src/hyper/htadd.c +++ b/src/hyper/htadd.c @@ -77,10 +77,6 @@ extern int line_number; /* keeps track of which line a page starts on * HyperDoc. */ /* for compatibility with HyperDoc */ openaxiom_sio *spad_socket = NULL; -openaxiom_sio *session_server = NULL; -int MenuServerOpened; -Display *gXDisplay; -int gXScreenNumber; int fresh = 0; #define Delete 1 diff --git a/src/hyper/hterror.c b/src/hyper/hterror.c index b98830d5..0b197cc0 100644 --- a/src/hyper/hterror.c +++ b/src/hyper/hterror.c @@ -43,6 +43,7 @@ #include "sockio.h" #include "lex.h" #include "parse.h" +#include "hyper.h" #include "all_hyper_proto.H1" diff --git a/src/hyper/htinp.c b/src/hyper/htinp.c index 113ea887..cb879eb6 100644 --- a/src/hyper/htinp.c +++ b/src/hyper/htinp.c @@ -42,6 +42,7 @@ #include <sys/signal.h> #include <setjmp.h> +#include "halloc.h" #include "sockio.h" #include "hyper.h" #include "group.h" diff --git a/src/hyper/hyper.c b/src/hyper/hyper.c index dbbd4f88..b6315932 100644 --- a/src/hyper/hyper.c +++ b/src/hyper/hyper.c @@ -49,6 +49,7 @@ #include "sockio.h" #include "hyper.h" +#include "lex.h" #include <sys/signal.h> #include <sys/types.h> diff --git a/src/hyper/hyper.h b/src/hyper/hyper.h index 48b8bbd1..7107d7d3 100644 --- a/src/hyper/hyper.h +++ b/src/hyper/hyper.h @@ -524,6 +524,8 @@ extern int space_width; #define BeepAtTheUser() /* (XBell(gXDisplay, 5)) */ #define LoudBeepAtTheUser() /* (XBell(gXDisplay, 50)) */ +extern int connect_spad(void); + /*** default fonts ***/ #define RmFontDefault "-adobe-courier-medium-r-normal--18-*-*-*-m-*-iso8859-1" @@ -545,6 +547,8 @@ typedef struct group_item { extern GroupItem *gTopOfGroupStack; +extern HyperDocPage *gPageBeingParsed; + typedef struct cond_node { char *label; diff --git a/src/hyper/item.c b/src/hyper/item.c index 3d900e04..c6764ba6 100644 --- a/src/hyper/item.c +++ b/src/hyper/item.c @@ -37,6 +37,7 @@ #include "sockio.h" #define _ITEM_C #include "debug.h" +#include "halloc.h" #include "extent.h" #include "all_hyper_proto.H1" diff --git a/src/hyper/keyin.c b/src/hyper/keyin.c index a0e89eac..7b0d310b 100644 --- a/src/hyper/keyin.c +++ b/src/hyper/keyin.c @@ -45,6 +45,7 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "hyper.h" #include "keyin.h" diff --git a/src/hyper/lex.c b/src/hyper/lex.c index 80acb07e..ad6f6672 100644 --- a/src/hyper/lex.c +++ b/src/hyper/lex.c @@ -68,11 +68,9 @@ int useAscii; #include "hyper.h" #include "hterror.h" -#include "lex.h" - -#include "all_hyper_proto.H1" #include "halloc.h" #include "sockio.h" +#include "lex.h" #include <ctype.h> @@ -320,10 +318,8 @@ AGAIN: last_command = cmd = get_int(spad_socket); if (cmd == EndOfPage) return EOF; -#ifndef HTADD if (cmd == SpadError) spad_error_handler(); -#endif } get_string_buf(spad_socket, sock_buf, 1023); /* this will be null if this is the last time*/ @@ -817,8 +813,6 @@ get_expected_token(int type) } } - -#ifndef HTADD static void spad_error_handler(void) { @@ -828,51 +822,3 @@ spad_error_handler(void) exit(-1); } -void -reset_connection(void) -{ - if (spad_socket) { - FD_CLR(spad_socket->socket, &socket_mask); - purpose_table[spad_socket->purpose] = NULL; - close(spad_socket->socket); - spad_socket->socket = 0; - spad_socket = NULL; - if (input_string) - input_string[0] = '\0'; - spad_socket->nbytes_pending = 0; - connect_spad(); - } -} -#endif - - -/* 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); -} - -/* 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; -} diff --git a/src/hyper/lex.h b/src/hyper/lex.h index ff3998fe..44d688b5 100644 --- a/src/hyper/lex.h +++ b/src/hyper/lex.h @@ -36,9 +36,8 @@ #ifndef _LEX_H_ #define _LEX_H_ 1 -#include "hyper.h" +#include "token.h" -extern int connect_spad(void); extern void get_expected_token(int); extern void parser_init(void); extern void init_scanner(void); @@ -55,10 +54,6 @@ extern int be_type(const char*); extern int begin_type(void); extern int end_type(void); extern void reset_connection(void); -extern int spad_busy(void); - - -extern HyperDocPage *gPageBeingParsed; extern short int gInSpadsrc; extern short int gInVerbatim; diff --git a/src/hyper/macro.c b/src/hyper/macro.c index 63723153..aea33777 100644 --- a/src/hyper/macro.c +++ b/src/hyper/macro.c @@ -37,6 +37,7 @@ #include "openaxiom-c-macros.h" #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "hyper.h" diff --git a/src/hyper/mem.c b/src/hyper/mem.c index e38e90ca..feed98df 100644 --- a/src/hyper/mem.c +++ b/src/hyper/mem.c @@ -44,6 +44,7 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "hyper.h" #include "group.h" diff --git a/src/hyper/parse-aux.c b/src/hyper/parse-aux.c index 08995d49..5cf233b3 100644 --- a/src/hyper/parse-aux.c +++ b/src/hyper/parse-aux.c @@ -37,6 +37,7 @@ #define _PARSE_AUX_C #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "addfile.h" diff --git a/src/hyper/parse-input.c b/src/hyper/parse-input.c index 7e5450c1..af7173da 100644 --- a/src/hyper/parse-input.c +++ b/src/hyper/parse-input.c @@ -44,6 +44,7 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "lex.h" diff --git a/src/hyper/parse-paste.c b/src/hyper/parse-paste.c index d4b83fb8..925c63df 100644 --- a/src/hyper/parse-paste.c +++ b/src/hyper/parse-paste.c @@ -45,11 +45,13 @@ #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "hyper.h" #include "display.h" #include "group.h" +#include "lex.h" #include "all_hyper_proto.H1" diff --git a/src/hyper/parse-types.c b/src/hyper/parse-types.c index 56cb418e..b1ed2c0c 100644 --- a/src/hyper/parse-types.c +++ b/src/hyper/parse-types.c @@ -44,6 +44,7 @@ #include "openaxiom-c-macros.h" #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "parse-types.h" diff --git a/src/hyper/parse.c b/src/hyper/parse.c index aa270212..25201fe5 100644 --- a/src/hyper/parse.c +++ b/src/hyper/parse.c @@ -36,6 +36,7 @@ #define _PARSE_C #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "parse.h" #include "parse-paste.h" @@ -72,6 +73,23 @@ HyperDocPage *cur_page; char *replace_page; /* true if dynamic page is link to static one */ + +void +reset_connection(void) +{ + if (spad_socket) { + FD_CLR(spad_socket->socket, &socket_mask); + purpose_table[spad_socket->purpose] = NULL; + close(spad_socket->socket); + spad_socket->socket = 0; + spad_socket = NULL; + if (input_string) + input_string[0] = '\0'; + spad_socket->nbytes_pending = 0; + connect_spad(); + } +} + /* * These routines are used for storing an restoring the parser mode. When * I start to parse from string, or from a macro, I need to restore the diff --git a/src/hyper/scrollbar.c b/src/hyper/scrollbar.c index 0f96f573..48cba63d 100644 --- a/src/hyper/scrollbar.c +++ b/src/hyper/scrollbar.c @@ -44,6 +44,7 @@ #include "openaxiom-c-macros.h" #include "debug.h" +#include "halloc.h" #include "sockio.h" #include "extent.h" #include "display.h" diff --git a/src/hyper/spadbuf.c b/src/hyper/spadbuf.c index dbe926ea..98c1687a 100644 --- a/src/hyper/spadbuf.c +++ b/src/hyper/spadbuf.c @@ -46,7 +46,7 @@ #include <sys/types.h> #include <sys/time.h> #include <signal.h> - +#include "halloc.h" #include "bsdsignal.h" #include "sockio.h" #include "edible.h" @@ -136,7 +136,7 @@ interp_io(void) return; } if (FD_ISSET(session_sock->socket, &rd)) { - len = sread(session_sock, buf, 1024, "stdio"); + len = sread(session_sock, (openaxiom_byte*) buf, 1024, "stdio"); if (len == -1) return; else { 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, diff --git a/src/hyper/titlebar.c b/src/hyper/titlebar.c index 7d925cb6..8fda183b 100644 --- a/src/hyper/titlebar.c +++ b/src/hyper/titlebar.c @@ -46,6 +46,7 @@ #include "debug.h" #include <stdlib.h> +#include "halloc.h" #include "sockio.h" #include "titlebar.h" #include "display.h" diff --git a/src/hyper/token.h b/src/hyper/token.h index cc8ed0be..a4dadac8 100644 --- a/src/hyper/token.h +++ b/src/hyper/token.h @@ -36,6 +36,9 @@ #ifndef _TOKEN_H_ #define _TOKEN_H_ 1 +#include "openaxiom-c-macros.h" +#include <stdio.h> + /* Here are a couple of flags added for whitespace stuff. They tell punctuation if there was space in front of it or not |