diff --git a/changelog b/changelog index 1a831be..f161db0 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20070914 jap adapt changes for )hd restart to Axiom sources +20070914 jap Jose Alfredo Portes +20070914 wxh src/sman/bookvol6 enable restart of hyperdoc with )hd +20070914 wxh src/include/sman.h1 enable restart of hyperdoc with )hd +20070914 wxh src/hyper/hyper enable restart of hyperdoc with )hd 20070913 tpd src/input/Makefile schaum1.input added 20070913 tpd src/input/schaum1.input added 20070909 tpd src/algebra/newton.spad included in fffg.spad diff --git a/src/hyper/hyper.pamphlet b/src/hyper/hyper.pamphlet index 2126df1..1e44d61 100644 --- a/src/hyper/hyper.pamphlet +++ b/src/hyper/hyper.pamphlet @@ -945,11 +945,14 @@ make_server_connections(void) */ if (open_server(MenuServerName) == -2) { - fprintf(stderr, "(HyperDoc) Warning: Not connected to AXIOM Server!\n"); - MenuServerOpened = 0; + fprintf(stderr, "(HyperDoc) Warning: Not connected to AXIOM Server!\n"); + MenuServerOpened = 0; } else - MenuServerOpened = 1; + /* In order to allow hyperdoc restarts from the console we clean up + * the socket on exit */ + atexit(&clean_socket); + MenuServerOpened = 1; /* diff --git a/src/include/sman.h1 b/src/include/sman.h1 index 20dbc90..9645289 100755 --- a/src/include/sman.h1 +++ b/src/include/sman.h1 @@ -25,6 +25,7 @@ static void start_the_graphics(void); static void fork_Axiom(void); static void start_the_Axiom(char * * envp); static void clean_up_sockets(void); +static void clean_hypertex_socket(void); static void read_from_spad_io(int ptcNum); static void read_from_manager(int ptcNum); static void manage_spad_io(int ptcNum); diff --git a/src/sman/bookvol6.pamphlet b/src/sman/bookvol6.pamphlet index d80388b..2c2a20c 100644 --- a/src/sman/bookvol6.pamphlet +++ b/src/sman/bookvol6.pamphlet @@ -812,6 +812,8 @@ these structures which maintains the process list for axiom. #define NadaDelShitsky 2 /* When a process dies start it up again */ #define DoItAgain 3 +/* When hypertex dies, clean its socket */ +#define CleanHypertexSocket 4 typedef struct spad_proc { int proc_id; /* process id of child */ @@ -1405,7 +1407,8 @@ start_the_hypertex(void) sprintf(prog, "%s -k -rv %s", HypertexProgram, VerifyRecordFile); spawn_of_hell(prog, NadaDelShitsky); } - else spawn_of_hell(HypertexProgram, NadaDelShitsky); + /* If we restart hyperdoc from the axiom command prompt */ + else spawn_of_hell(HypertexProgram, CleanHypertexSocket); } @ @@ -1515,8 +1518,18 @@ start_the_Axiom(char **envp) @ \subsection{clean\_up\_sockets} +In order to be able to restart hyperdoc from the axiom command prompt +we need to remove the socket for this server. <>= static void +clean_hypertex_socket(void) +{ + char name[256]; + sprintf(name, "%s%d", MenuServerName, server_num); + unlink(name); +} + +static void clean_up_sockets(void) { char name[256]; @@ -1526,8 +1539,7 @@ clean_up_sockets(void) unlink(name); sprintf(name, "%s%d", SessionIOName, server_num); unlink(name); - sprintf(name, "%s%d", MenuServerName, server_num); - unlink(name); + clean_hypertex_socket(); } @ @@ -1700,11 +1712,12 @@ monitor_children(void) stat = 0; dead_baby = wait(&stat); /* Check the value of dead_baby, since wait may have returned - a pid but subsequently we have received a signal. Yeuch! */ + a pid but subsequently we have received a signal. Yeuch! + In order to restart hyperdoc from the axiom command prompt + we no longer call clean_up_terminal */ if (dead_baby == -1 && death_signal) { kill_all_children(); clean_up_sockets(); - clean_up_terminal(); sleep(2); exit(0); } @@ -1728,10 +1741,12 @@ monitor_children(void) continue; } switch(proc->death_action) { + /* In order to restart hyperdoc from the axiom command prompt + we no longer call clean_up_terminal. Instead we've added a + case to just clean up the socket. */ case Die: kill_all_children(); clean_up_sockets(); - clean_up_terminal(); sleep(2); exit(0); case NadaDelShitsky: @@ -1739,6 +1754,9 @@ monitor_children(void) case DoItAgain: spawn_of_hell(proc->command, DoItAgain); break; + case CleanHypertexSocket: + clean_hypertex_socket(); + break; } } }