diff options
author | dos-reis <gdr@axiomatics.org> | 2008-09-09 05:24:24 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-09-09 05:24:24 +0000 |
commit | c6dc46b33cae5230dcbdf024da95532ea0cd1891 (patch) | |
tree | bec45d8eafffbf2c1ff769bfed962bf1f86b4567 /src | |
parent | c0f80aca887462749a7cdc4fcacc579ee59aa850 (diff) | |
download | open-axiom-c6dc46b33cae5230dcbdf024da95532ea0cd1891.tar.gz |
* lib/sockio-c.c (openaxiom_sleep): Move to open-axiom.h.
* clef/edible.c: Include "open-axiom.h". Use openaxiom_sleep, not
sleep.
* graph/view2D/viewport2D.c: Likewise.
* graph/viewAlone/spoon2D.c: Likewise.
* graph/viewAlone/spoonComp.c: Likewise.
* graph/viewman/fun2D.c: Likewise.
* graph/viewman/fun3D.c: Likewise.
* hyper/spadint.c: Likewise.
* sman/session.c: Likewise.
* sman/sman.c: Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 15 | ||||
-rw-r--r-- | src/clef/edible.c | 8 | ||||
-rw-r--r-- | src/graph/view2D/viewport2D.c | 5 | ||||
-rw-r--r-- | src/graph/viewAlone/spoon2D.c | 4 | ||||
-rw-r--r-- | src/graph/viewAlone/spoonComp.c | 4 | ||||
-rw-r--r-- | src/graph/viewman/fun2D.c | 5 | ||||
-rw-r--r-- | src/graph/viewman/fun3D.c | 4 | ||||
-rw-r--r-- | src/hyper/spadint.c | 6 | ||||
-rw-r--r-- | src/include/open-axiom.h | 17 | ||||
-rw-r--r-- | src/lib/sockio-c.c | 16 | ||||
-rw-r--r-- | src/sman/session.c | 5 | ||||
-rw-r--r-- | src/sman/sman.c | 10 |
12 files changed, 56 insertions, 43 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2350a20f..e61ae674 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2008-09-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + Alfredo Portes <doyenatccny@gmail.com> + + * lib/sockio-c.c (openaxiom_sleep): Move to open-axiom.h. + * clef/edible.c: Include "open-axiom.h". Use openaxiom_sleep, not + sleep. + * graph/view2D/viewport2D.c: Likewise. + * graph/viewAlone/spoon2D.c: Likewise. + * graph/viewAlone/spoonComp.c: Likewise. + * graph/viewman/fun2D.c: Likewise. + * graph/viewman/fun3D.c: Likewise. + * hyper/spadint.c: Likewise. + * sman/session.c: Likewise. + * sman/sman.c: Likewise. + 2008-09-07 Gabriel Dos Reis <gdr@cs.tamu.edu> * boot/parser.boot (bpImport): Invert syntax for importing foreign diff --git a/src/clef/edible.c b/src/clef/edible.c index a2b87863..fb5494e6 100644 --- a/src/clef/edible.c +++ b/src/clef/edible.c @@ -33,8 +33,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "openaxiom-c-macros.h" - #include <stdlib.h> #include <unistd.h> #include <stdio.h> @@ -46,7 +44,7 @@ #include <errno.h> #include <signal.h> - +#include "open-axiom.h" #include "sockio.h" #include "edible.h" #include "com.h" @@ -398,7 +396,7 @@ terminate_handler(int sig) sigfile = open(sigbuff, O_RDWR | O_APPEND); write(sigfile, "Terminate Handler\n", strlen("Terminate Handler\n") + 1); close(sigfile); - sleep(1); + openaxiom_sleep(1); #endif kill(child_pid, SIGTERM); /* fix the terminal, and exit */ @@ -420,7 +418,7 @@ interrupt_handler(int sig) sigfile = open(sigbuff, O_RDWR | O_APPEND); write(sigfile, "Interrupt Handler\n", strlen("Interrupt Handler\n") + 1); close(sigfile); - sleep(1); + openaxiom_sleep(1); #endif kill(child_pid, SIGINT); } diff --git a/src/graph/view2D/viewport2D.c b/src/graph/view2D/viewport2D.c index d0f4ee30..2f499307 100644 --- a/src/graph/view2D/viewport2D.c +++ b/src/graph/view2D/viewport2D.c @@ -34,7 +34,6 @@ */ #define _VIEWPORT2D_C -#include "openaxiom-c-macros.h" #include <stdio.h> #include <stdlib.h> @@ -46,6 +45,8 @@ #include <X11/Xutil.h> #include <limits.h> +#include "open-axiom.h" + #define NotPoint (SHRT_MAX) #define eqNANQ(x) (x == NotPoint) @@ -571,7 +572,7 @@ makeViewport(char *title,int vX,int vY,int vW,int vH,int showCP) /* Create a viewport */ if (!(viewport = (viewPoints *)malloc(sizeof(viewPoints)))) { fprintf(stderr,"Ran out of memory (malloc) trying to create a viewport.\n"); - sleep(5); + openaxiom_sleep(5); exitWithAck(RootWindow(dsply,scrn),Window,-1); } diff --git a/src/graph/viewAlone/spoon2D.c b/src/graph/viewAlone/spoon2D.c index 236caeb8..c50e4ba3 100644 --- a/src/graph/viewAlone/spoon2D.c +++ b/src/graph/viewAlone/spoon2D.c @@ -34,12 +34,12 @@ */ #define _SPOON2D_C -#include "openaxiom-c-macros.h" #include <unistd.h> #include <stdlib.h> #include <string.h> +#include "open-axiom.h" #include "viewAlone.h" @@ -133,7 +133,7 @@ spoonView2D(void) /*** get acknowledge from viewport */ code = read(viewP.viewIn,&(viewP.viewWindow),sizeof(Window)); - sleep(1); /* wait a second...*/ + openaxiom_sleep(1); /* wait a second...*/ exit(0); } /* switch */ diff --git a/src/graph/viewAlone/spoonComp.c b/src/graph/viewAlone/spoonComp.c index 79fe174c..92902443 100644 --- a/src/graph/viewAlone/spoonComp.c +++ b/src/graph/viewAlone/spoonComp.c @@ -34,12 +34,12 @@ */ #define _SPOONCOMP_C -#include "openaxiom-c-macros.h" #include <stdlib.h> #include <unistd.h> #include <string.h> +#include "open-axiom.h" #include "viewAlone.h" #include "mode.h" @@ -155,7 +155,7 @@ spoonView3D(int type) /*** get acknowledge from viewport */ code = read(viewP.viewIn,&(viewP.viewWindow),sizeof(Window)); - sleep(1); /* wait a second...*/ + openaxiom_sleep(1); /* wait a second...*/ exit(0); } /* switch */ diff --git a/src/graph/viewman/fun2D.c b/src/graph/viewman/fun2D.c index 3f38dd71..dd98f836 100644 --- a/src/graph/viewman/fun2D.c +++ b/src/graph/viewman/fun2D.c @@ -34,7 +34,6 @@ */ #define _FUN2D_C -#include "openaxiom-c-macros.h" #include <stdlib.h> #include <unistd.h> @@ -42,7 +41,7 @@ #include <string.h> - +#include "open-axiom.h" #include "viewman.h" #include "actions.h" @@ -282,7 +281,7 @@ forkView2D(void) /*** get acknowledge from viewport */ code = readViewport(viewport,&(viewport->viewWindow),sizeof(Window)); - sleep(1); /* wait a second...*/ + openaxiom_sleep(1); /* wait a second...*/ send_int(spadSock,viewport->PID); /* acknowledge to spad */ } /* switch */ diff --git a/src/graph/viewman/fun3D.c b/src/graph/viewman/fun3D.c index 19e186ef..f6f4cd23 100644 --- a/src/graph/viewman/fun3D.c +++ b/src/graph/viewman/fun3D.c @@ -34,13 +34,13 @@ */ #define _FUN3D_C -#include "openaxiom-c-macros.h" #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <string.h> +#include "open-axiom.h" #include "viewman.h" #include "mode.h" #include "actions.h" @@ -355,7 +355,7 @@ forkView3D(int typeOfViewport) /*** get acknowledge from viewport */ code = readViewport(viewport,&(viewport->viewWindow),sizeof(Window)); - sleep(1); /* wait a second...*/ + openaxiom_sleep(1); /* wait a second...*/ send_int(spadSock,viewport->PID); /* acknowledge to spad */ } /* switch */ diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c index 0b8c9300..9541350c 100644 --- a/src/hyper/spadint.c +++ b/src/hyper/spadint.c @@ -37,8 +37,8 @@ /* Communication interface for external OpenAxiom buffers */ #define _SPADINT_C -#include "openaxiom-c-macros.h" +#include "open-axiom.h" #include "debug.h" #include <signal.h> @@ -172,7 +172,7 @@ issue_dependent_commands(HyperDocPage *page, TextNode *command,int type) depend->spadcom->type); while (!gIsEndOfOutput) pause(); - sleep(1); + openaxiom_sleep(1); } } } @@ -259,7 +259,7 @@ start_user_buffer(HyperDocPage *page) */ } accept_menu_server_connection(page); - sleep(2); + openaxiom_sleep(2); } /* Clears the execution marks in a hash table when a buffer has been killed */ diff --git a/src/include/open-axiom.h b/src/include/open-axiom.h index 391e12e3..19cbfedf 100644 --- a/src/include/open-axiom.h +++ b/src/include/open-axiom.h @@ -63,6 +63,8 @@ typedef HANDLE openaxiom_handle; typedef void* openaxiom_handle; #endif +#include <unistd.h> + /* Do we have graphics support? */ #ifdef X_DISPLAY_MISSING # define OPENAXIOM_HAVE_GRAPHICS 0 @@ -76,5 +78,20 @@ typedef void* openaxiom_handle; #define oa_buffer_address(BUF) ((openaxiom_byte*)&BUF[0]) +/* The function sleep() is not available under Windows. Instead, they + have Sleep(); with capital S, please. Furthermore, it does not + take argument in second, but in milliseconds, three order + of magnitude of difference when compared to the Unix world. + We abstract over that difference here. */ + +static inline void +openaxiom_sleep(int n) +{ +#ifdef __WIN32__ + Sleep(n * 1000); +#else + sleep(n); +#endif +} #endif /* OPENAXIOM_included */ diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index b3e4ca24..8705b08e 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -94,22 +94,6 @@ int spad_server_number = -1; #include "sockio.h" -/* The function sleep() is not available under Windows. Instead, they - have Sleep(); with capital S, please. Furthermore, it does not - take argument in second, but in milliseconds, three order - of magnitude of difference when compared to the Unix world. - We abstract over that difference here. */ - -static inline void -openaxiom_sleep(int n) -{ -#ifdef __WIN32__ - Sleep(n * 1000); -#else - sleep(n); -#endif -} - /* Non zero if the host system module support for socket is activated. This is needed only for MS platforms. */ static int openaxiom_socket_module_loaded = 0; diff --git a/src/sman/session.c b/src/sman/session.c index 4addf254..7cbc375a 100644 --- a/src/sman/session.c +++ b/src/sman/session.c @@ -37,12 +37,13 @@ /* #define DEBUG */ #define _SESSION_C -#include "openaxiom-c-macros.h" #include <stdlib.h> #include <sys/time.h> #include <stdio.h> #include <string.h> #include <signal.h> + +#include "open-axiom.h" #include "sockio.h" #include "com.h" #include "bsdsignal.h" @@ -465,7 +466,7 @@ main(void) #ifdef DEBUG2 /* delay for attaching with debugger before interesting things happen */ - sleep(30); + openaxiom_sleep(30); #endif /* spad_server connects to Lisp server socket diff --git a/src/sman/sman.c b/src/sman/sman.c index c7b5aa62..76c6d59e 100644 --- a/src/sman/sman.c +++ b/src/sman/sman.c @@ -33,8 +33,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "openaxiom-c-macros.h" - #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -47,7 +45,7 @@ #include <sys/wait.h> #include <signal.h> - +#include "open-axiom.h" #include "sockio.h" #include "com.h" #include "bsdsignal.h" @@ -735,7 +733,7 @@ monitor_children(void) if (dead_baby == -1 && death_signal) { kill_all_children(); clean_up_sockets(); - sleep(2); + openaxiom_sleep(2); exit(0); } @@ -754,7 +752,7 @@ monitor_children(void) case Die: kill_all_children(); clean_up_sockets(); - sleep(2); + openaxiom_sleep(2); exit(0); case NadaDelShitsky: break; @@ -789,7 +787,7 @@ main(int argc, char *argv[],char *envp[]) if (start_local_spadclient) start_the_local_spadclient(); if (start_ht) start_the_hypertex(); if (start_graphics) start_the_graphics(); - sleep(1); + openaxiom_sleep(1); if (fork_you(Die) != NULL) { sman_catch_signals(); |