diff options
| author | dos-reis <gdr@axiomatics.org> | 2010-11-28 15:08:36 +0000 | 
|---|---|---|
| committer | dos-reis <gdr@axiomatics.org> | 2010-11-28 15:08:36 +0000 | 
| commit | bbb5a69f0f2348adbbb8db960e5e45306b865683 (patch) | |
| tree | 23f3039b350d61a402f3af97e8cc3ec06f08797e /src/lib | |
| parent | ab86c48186a05391f1c1fbc3f90759cc0caff45b (diff) | |
| download | open-axiom-bbb5a69f0f2348adbbb8db960e5e45306b865683.tar.gz | |
	* lib/Makefile.in: Build libopen-axiom-core and libspad with a C++
	compiler and linker.
	* lib/bsdsignal.c: Fix C calling convention annotation.
	* lib/cfuns-c.c: Likewise.
	* lib/edin.c: Likewise.
	* lib/sockio-c.c: Likewise.
	* include/bsdsignal.h: Remove 'extern "C"'-block annotation.
	* include/cfuns.h: Likewise.
	* include/cursor.h: Likewise.
	* include/edin.h: Likewise.
	* include/fnct_key.h: Likewise.
	* include/halloc.h: Likewise.
	* include/hash.h: Likewise.
	* include/openpty.h: Likewise.
	* include/pixmap.h: Likewise.
	* include/prt.h: Likewise.
	* include/sockio.h: Likewise.
	* include/spadcolors.h: Likewise.
	* include/util.H1: Likewise.
	* include/view.h: Likewise.
	* include/wct.h: Likewise.
	* include/open-axiom.h (OPENAXIOM_C_CALL): New macro.
	(OPENAXIOM_C_EXPORT): Likewise.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Makefile.in | 10 | ||||
| -rw-r--r-- | src/lib/bsdsignal.c | 4 | ||||
| -rw-r--r-- | src/lib/cfuns-c.c | 68 | ||||
| -rw-r--r-- | src/lib/edin.c | 20 | ||||
| -rw-r--r-- | src/lib/sockio-c.c | 167 | ||||
| -rw-r--r-- | src/lib/util.c | 2 | 
6 files changed, 135 insertions, 136 deletions
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 53027039..25b8be68 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2008, Gabriel Dos Reis. +# Copyright (C) 2007-2010, Gabriel Dos Reis.  # All rights reserved.  #  # Redistribution and use in source and binary forms, with or without @@ -86,20 +86,20 @@ $(axiom_target_libdir)/libopen-axiom-core.$(LIBEXT): \  $(axiom_target_libdir)/libopen-axiom-core$(SHREXT): \  	$(libopen_axiom_core_objects)  	$(mkdir_p) $(axiom_target_libdir) -	$(LINK_SHRLIB) $(oa_shrlib_flags) -o $@ \ +	$(CXXLINK_SHRLIB) $(oa_shrlib_flags) -o $@ \  		$(libopen_axiom_core_objects) \  		@oa_c_runtime_extra@ -lm  libopen-axiom-core.$(LIBEXT): $(libopen_axiom_core_SOURCES:.c=.lo) -	$(LINK) -o $@ $(libopen_axiom_core_SOURCES:.c=.lo) +	$(CXXLINK) -o $@ $(libopen_axiom_core_SOURCES:.c=.lo)  libspad.$(LIBEXT): $(libspad_objects) -	$(LINK) -o $@ $(libspad_objects) +	$(CXXLINK) -o $@ $(libspad_objects)  .PRECIOUS: %.$(OBJEXT)  %.$(OBJEXT) %.lo: %.c $(axiom_c_macros_h) -	$(COMPILE) $(oa_shrobj_flags) -no-suppress -o $@ $(CFLAGS) \ +	$(CXXCOMPILE) $(oa_shrobj_flags) -no-suppress -o $@ $(CFLAGS) \  		$(axiom_includes) $(AXIOM_X11_CFLAGS) $<  # This is a support library, so it does not change often and diff --git a/src/lib/bsdsignal.c b/src/lib/bsdsignal.c index 7cb3195c..07fc6b54 100644 --- a/src/lib/bsdsignal.c +++ b/src/lib/bsdsignal.c @@ -1,7 +1,7 @@  /*      Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.      All rights reserved. -    Copyright (C) Gabriel Dos Reis. +    Copyright (C) 2007-2010, Gabriel Dos Reis.      All rights reserved.      Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@  #include <signal.h>   #include "bsdsignal.h" -OPENAXIOM_EXPORT SignalHandlerFunc +OPENAXIOM_C_EXPORT SignalHandlerFunc  bsdSignal(int sig, SignalHandlerFunc action, int restartSystemCall)  {  #if HAVE_DECL_SIGACTION diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index 62d401dd..d32c584f 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -77,7 +77,7 @@  #  define getegid() getgid()  #endif -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  addtopath(char *dir)  {      char *path, *newpath; @@ -112,7 +112,7 @@ openaxiom_is_path_separator(char c)    Returns a the dirname of `path'.  If `path' has no separator, then    returns ".".  The returned value if malloc-allocated.  */ -OPENAXIOM_EXPORT char* +OPENAXIOM_C_EXPORT char*  oa_dirname(const char* path)  {     const int n = strlen(path); @@ -146,7 +146,7 @@ oa_dirname(const char* path)   */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  directoryp(char *path)  {      struct stat buf; @@ -155,7 +155,7 @@ directoryp(char *path)      return code == -1 ? -1 : S_ISDIR(buf.st_mode);  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   make_path_from_file(char *s, char *t)  {      char *pos = ""; @@ -235,7 +235,7 @@ axiom_has_write_access(const struct stat* file_info)        2 if the file does not exists but process has write          has write access to the dirname of path.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  writeablep(char *path)  {      struct stat buf; @@ -271,7 +271,7 @@ writeablep(char *path)        0 if the file exists but process has no read access.        1 if the file exists and read access is granted.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  readablep(char *path)  {      struct stat buf; @@ -298,7 +298,7 @@ readablep(char *path) -OPENAXIOM_EXPORT long +OPENAXIOM_C_EXPORT long  findString(char *file, char *string)  {      int nstring, charpos; @@ -318,7 +318,7 @@ findString(char *file, char *string)  } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  copyEnvValue(char *varName, char *buffer)  {      char *s; @@ -332,7 +332,7 @@ copyEnvValue(char *varName, char *buffer)  /* Return 1 if the file descriptor FD, as viewed by the Core Executable,     is attached to a terminal.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  std_stream_is_terminal(int fd)  {     assert(fd > -1 && fd < 3); @@ -364,7 +364,7 @@ std_stream_is_terminal(int fd)  /* Change the process' curretnt directory.  Return zero on success,     and -1 on failure.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_chdir(const char* path)  {  #ifdef __WIN32__ @@ -387,7 +387,7 @@ is_dot_or_dotdot(const char* path)     Return 0 on success, and -1 on falure.     In practice, OpenAxiom does not remove directories with     non-trivial recursive structues.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_unlink(const char* path)  {     const char* curdir; @@ -485,7 +485,7 @@ oa_unlink(const char* path)  }  /* Rename a file or directory.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_rename(const char* old_path, const char* new_path)  {  #ifdef __WIN32__ @@ -497,7 +497,7 @@ oa_rename(const char* old_path, const char* new_path)  /* Create a new directory named `path'.  Return 0 on success,     and -1 on failure.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_mkdir(const char* path)  {  #ifdef __WIN32__ @@ -510,13 +510,13 @@ oa_mkdir(const char* path)  }  /* Run a shell command.  Effectively forward to C's system().  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_system(const char* cmd)  {     return system(cmd);  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   oa_getpid(void)   {  #ifdef __WIN32__ @@ -528,7 +528,7 @@ oa_getpid(void)  /* Concatenate two strings and return a pointer to the     newly allocate resulting string. */ -OPENAXIOM_EXPORT const char* +OPENAXIOM_C_EXPORT const char*  oa_concatenate_string(const char* lhs, const char* rhs)  {     if (lhs == NULL) @@ -546,13 +546,13 @@ oa_concatenate_string(const char* lhs, const char* rhs)  /* Return a string object that is the result of catenating the strings     designated by `left' and `right'.   */ -OPENAXIOM_EXPORT const char* +OPENAXIOM_C_EXPORT const char*  oa_strcat(const char* left, const char* right)  {     int left_size = strlen(left);     int right_size = strlen(right);     int size = left_size + right_size; -   char* buffer = malloc(size + 1); +   char* buffer = (char*) malloc(size + 1);     memcpy(buffer, left, left_size);     memcpy(buffer + left_size, right, right_size); @@ -561,7 +561,7 @@ oa_strcat(const char* left, const char* right)  }  /* Return the value of an environment variable.  */ -OPENAXIOM_EXPORT char* +OPENAXIOM_C_EXPORT char*  oa_getenv(const char* var)  {  #ifdef __WIN32__    @@ -588,7 +588,7 @@ oa_getenv(const char* var)  /* Set the value of environment variable VAR to VAL.     Return 1 on success, and 0 otherwise.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_setenv(const char* var, const char* val)  {  #ifdef __WIN32__ @@ -606,7 +606,7 @@ oa_setenv(const char* var, const char* val)  } -OPENAXIOM_EXPORT char* +OPENAXIOM_C_EXPORT char*  oa_getcwd(void)  {     int bufsz = 256; @@ -631,7 +631,7 @@ oa_getcwd(void)        if (errno == ERANGE) {           errno = 0;           bufsz *= 2; -         buf = realloc(buf, bufsz); +         buf = (char*) realloc(buf, bufsz);        }        else {           perror("oa_getcwd"); @@ -642,7 +642,7 @@ oa_getcwd(void)  #endif  } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_access_file_for_read(const char* path)  {  #ifdef __WIN32__ @@ -653,7 +653,7 @@ oa_access_file_for_read(const char* path)  } -OPENAXIOM_EXPORT const char* +OPENAXIOM_C_EXPORT const char*  oa_get_tmpdir(void)  {  #ifdef __WIN32__ @@ -682,7 +682,7 @@ oa_get_tmpdir(void)  } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_copy_file(const char* src, const char* dst)  {  #ifdef __WIN32__ @@ -712,7 +712,7 @@ oa_copy_file(const char* src, const char* dst)  } -OPENAXIOM_EXPORT double  +OPENAXIOM_C_EXPORT double   plus_infinity(void )  {  #ifdef INFINITY    @@ -724,13 +724,13 @@ plus_infinity(void )  #endif     } -OPENAXIOM_EXPORT double  +OPENAXIOM_C_EXPORT double   minus_infinity(void)  {     return -plus_infinity();  } -OPENAXIOM_EXPORT double  +OPENAXIOM_C_EXPORT double   quiet_double_NaN(void)  {  #ifdef NAN @@ -741,7 +741,7 @@ quiet_double_NaN(void)  } -OPENAXIOM_EXPORT openaxiom_byteorder +OPENAXIOM_C_EXPORT openaxiom_byteorder  oa_get_host_byteorder(void)  {  #ifdef WORDS_BIGENDIAN @@ -752,7 +752,7 @@ oa_get_host_byteorder(void)  } -OPENAXIOM_EXPORT void +OPENAXIOM_C_EXPORT void  oa_allocate_process_argv(openaxiom_process* proc, int argc)  {     proc->argc = argc; @@ -760,7 +760,7 @@ oa_allocate_process_argv(openaxiom_process* proc, int argc)     proc->argv[argc] = NULL;  } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_spawn(openaxiom_process* proc, openaxiom_spawn_flags flags)  {  #ifdef __WIN32__ @@ -828,7 +828,7 @@ oa_spawn(openaxiom_process* proc, openaxiom_spawn_flags flags)  #endif     } -OPENAXIOM_EXPORT char* +OPENAXIOM_C_EXPORT char*  oa_substr(const char* str, const size_t begin, const size_t end)  {     char* substring; @@ -840,14 +840,14 @@ oa_substr(const char* str, const size_t begin, const size_t end)           return NULL;     len = (end - begin) + 2; -   substring = malloc(len * sizeof(char)); +   substring = (char*) malloc(len * sizeof(char));     memset(substring,'\0',len);     memcpy(substring, str+begin, len-1);     return substring;  } -OPENAXIOM_EXPORT char** +OPENAXIOM_C_EXPORT char**  oa_split(const char* sequence, const char* delimiter, int* size)  {     int sequence_length = 0, newsize = 0; diff --git a/src/lib/edin.c b/src/lib/edin.c index 508c701a..c93e2876 100644 --- a/src/lib/edin.c +++ b/src/lib/edin.c @@ -811,7 +811,7 @@ void  insert_queue(void)  {    QueStruct *trace; -  QueStruct *new; +  QueStruct *new_q;    int c;    if (!ECHOIT) @@ -840,21 +840,21 @@ insert_queue(void)     * simply places the buff command into the front of the queue     */    if (ring_size < MAXRING) { -    new = (QueStruct *) malloc(sizeof(struct que_struct)); -    if (new == NULL) { +    new_q = (QueStruct *) malloc(sizeof(struct que_struct)); +    if (new_q == NULL) {        fprintf(stderr, "Malloc Error: Ran out of memory\n");        exit(-1);      }      if (ring_size == 0) { -      ring = new; -      ring->prev = ring->next = new; +      ring = new_q; +      ring->prev = ring->next = new_q;      }      else { -      new->next = ring->next; -      new->prev = ring; -      ring->next = new; -      new->next->prev = new; -      ring = new; +      new_q->next = ring->next; +      new_q->prev = ring; +      ring->next = new_q; +      new_q->next->prev = new_q; +      ring = new_q;      }      ring_size++;    } diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index 853ecd91..19bfc085 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -1,8 +1,7 @@  /*      Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.      All rights reserved. - -    Copyright (C) 2007-2008, Gabriel Dos Reis. +    Copyright (C) 2007-2010, Gabriel Dos Reis.      All rights reserved.      Redistribution and use in source and binary forms, with or without @@ -78,19 +77,19 @@  /* socket description of spad clients */ -OPENAXIOM_EXPORT openaxiom_sio clients[MaxClients];        +openaxiom_sio clients[MaxClients];         /* AF_LOCAL and AF_INET sockets for server */ -OPENAXIOM_EXPORT openaxiom_sio server[2];                  +openaxiom_sio server[2];                   /* table of dedicated socket types */ -OPENAXIOM_EXPORT openaxiom_sio *purpose_table[TotalMaxPurposes];  +openaxiom_sio *purpose_table[TotalMaxPurposes];   /* bit mask of active sockets */ -OPENAXIOM_EXPORT fd_set socket_mask;              +fd_set socket_mask;               /* bit mask of server sockets */ -OPENAXIOM_EXPORT fd_set server_mask;              +fd_set server_mask;               /* used to identify closed socket on SIGPIPE */  int socket_closed;               @@ -145,7 +144,7 @@ openaxiom_load_socket_module(void)  /* Convert an IP address from presentation (string or ascii form)     to numeric form.  The result is stored in the last argument.     Success is indicated by a return value 0; failure is -1.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_inet_pton(const char* addr, int prot, openaxiom_byte* bytes)  {     openaxiom_load_socket_module(); @@ -173,7 +172,7 @@ oa_inet_pton(const char* addr, int prot, openaxiom_byte* bytes)  /* Resolve a hostname to its IP address.  On success return 0,     otherwise -1.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_get_host_address(const char* n, int prot, openaxiom_byte* bytes)  {     struct hostent* h; @@ -237,7 +236,7 @@ is_valid_socket(const openaxiom_sio* s)     any other file descriptor function.  Furthermore, Windows     requires cleanup.  */ -OPENAXIOM_EXPORT void +OPENAXIOM_C_EXPORT void  oa_close_socket(openaxiom_socket s)  {  #ifdef __WIN32__ @@ -257,7 +256,7 @@ oa_close_socket(openaxiom_socket s)        ae full duplex communication links, supporting regular        file I/O operations.  */ -OPENAXIOM_EXPORT openaxiom_filedesc +OPENAXIOM_C_EXPORT openaxiom_filedesc  oa_open_local_client_stream_socket(const char* path)  {  #ifdef __WIN32__ @@ -304,7 +303,7 @@ oa_open_local_client_stream_socket(const char* path)  #endif     } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_filedesc_read(openaxiom_filedesc desc, openaxiom_byte* buf, int size)  {  #ifdef __WIN32__ @@ -321,7 +320,7 @@ oa_filedesc_read(openaxiom_filedesc desc, openaxiom_byte* buf, int size)  #endif     } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_filedesc_write(openaxiom_filedesc desc, const openaxiom_byte* buf, int size)  {  #ifdef __WIN32__ @@ -338,7 +337,7 @@ oa_filedesc_write(openaxiom_filedesc desc, const openaxiom_byte* buf, int size)  #endif     } -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_filedesc_close(openaxiom_filedesc desc)  {  #ifdef __WIN32__ @@ -351,7 +350,7 @@ oa_filedesc_close(openaxiom_filedesc desc)  /* IP sockets.  */ -OPENAXIOM_EXPORT openaxiom_socket +OPENAXIOM_C_EXPORT openaxiom_socket  oa_connect_ip_port_stream(const openaxiom_byte* addr, int prot,                            openaxiom_port port)  { @@ -387,7 +386,7 @@ oa_connect_ip_port_stream(const openaxiom_byte* addr, int prot,     On failure, return -1; otherwise return the number of bytes     actually read.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_socket_read(openaxiom_socket sock, openaxiom_byte* buf, int size)  {     return recv(sock, (char*) buf, size, 0); @@ -396,7 +395,7 @@ oa_socket_read(openaxiom_socket sock, openaxiom_byte* buf, int size)  /* Attempt to read a byte from scoket `sock'.     On failure, return -1; otherwise the actual byte read.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_socket_read_byte(openaxiom_socket sock)  {     openaxiom_byte byte; @@ -409,14 +408,14 @@ oa_socket_read_byte(openaxiom_socket sock)  /* Send `size' bytes of data contained in `buf' to the socket `sock'.     Return -1 on failured; the number of actualy write bytes on success.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_socket_write(openaxiom_socket sock, const openaxiom_byte* buf, int size)  {     return send(sock, (const char*) buf, size, 0);  }  /* Send one byte to socket `sock'.  */ -OPENAXIOM_EXPORT int +OPENAXIOM_C_EXPORT int  oa_socket_write_byte(openaxiom_socket sock, openaxiom_byte byte)  {     return oa_socket_write(sock, &byte, 1) < 1 ? -1 : byte; @@ -448,13 +447,13 @@ openaxiom_connection_refused(void)  } -OPENAXIOM_EXPORT void   +OPENAXIOM_C_EXPORT void    sigpipe_handler(int sig)  {    socket_closed = 1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   wait_for_client_read(openaxiom_sio *sock, openaxiom_byte* buf, int buf_size,                       const char* msg)  { @@ -472,7 +471,7 @@ wait_for_client_read(openaxiom_sio *sock, openaxiom_byte* buf, int buf_size,    }  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   wait_for_client_write(openaxiom_sio* sock, const openaxiom_byte* buf,                        int buf_size, const char* msg)  { @@ -490,7 +489,7 @@ wait_for_client_write(openaxiom_sio* sock, const openaxiom_byte* buf,    }  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sread(openaxiom_sio* sock, openaxiom_byte* buf, int buf_size, const char *msg)  {    int ret_val; @@ -515,7 +514,7 @@ sread(openaxiom_sio* sock, openaxiom_byte* buf, int buf_size, const char *msg)    return ret_val;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   swrite(openaxiom_sio* sock, const openaxiom_byte* buf, int buf_size,         const char* msg)  { @@ -542,17 +541,17 @@ swrite(openaxiom_sio* sock, const openaxiom_byte* buf, int buf_size,    return ret_val;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sselect(int n,fd_set  *rd, fd_set  *wr, fd_set *ex, void *timeout)  {    int ret_val;    do { -    ret_val = select(n, (void *)rd, (void *)wr, (void *)ex, (struct timeval *) timeout); +    ret_val = select(n, rd, wr, ex, (struct timeval *) timeout);    } while (ret_val == -1 && openaxiom_syscall_was_cancelled());    return ret_val;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   fill_buf(openaxiom_sio *sock, openaxiom_byte* buf, int len, const char* msg)  {    int bytes =  0, ret_val; @@ -564,7 +563,7 @@ fill_buf(openaxiom_sio *sock, openaxiom_byte* buf, int len, const char* msg)    return bytes;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   get_int(openaxiom_sio *sock)  {    int val = -1, len; @@ -581,7 +580,7 @@ get_int(openaxiom_sio *sock)    return val;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_int(int purpose)  {    if (accept_if_needed(purpose) != -1) @@ -589,7 +588,7 @@ sock_get_int(int purpose)    else return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   get_ints(openaxiom_sio *sock, int *vals, int num)  {    int i; @@ -598,7 +597,7 @@ get_ints(openaxiom_sio *sock, int *vals, int num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_ints(int purpose, int *vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -606,7 +605,7 @@ sock_get_ints(int purpose, int *vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_int(openaxiom_sio *sock,int val)  {    int ret_val; @@ -617,7 +616,7 @@ send_int(openaxiom_sio *sock,int val)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_int(int purpose,int  val)  {    if (accept_if_needed(purpose) != -1) @@ -625,7 +624,7 @@ sock_send_int(int purpose,int  val)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_ints(openaxiom_sio *sock, const int *vals, int num)  {    int i; @@ -635,7 +634,7 @@ send_ints(openaxiom_sio *sock, const int *vals, int num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_ints(int purpose, const int *vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -643,13 +642,13 @@ sock_send_ints(int purpose, const int *vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_string_len(openaxiom_sio *sock, const char *str,int len)  {    int val;    if (len > 1023) {      char *buf; -    buf = malloc(len+1); +    buf = (char*) malloc(len+1);      strncpy(buf,str,len);      buf[len]='\0';      send_int(sock,len+1); @@ -668,7 +667,7 @@ send_string_len(openaxiom_sio *sock, const char *str,int len)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_string(openaxiom_sio* sock, const char* str)  {    int val, len = strlen(str); @@ -681,7 +680,7 @@ send_string(openaxiom_sio* sock, const char* str)  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_string(int purpose, const char *str)  {    if (accept_if_needed(purpose) != -1) @@ -689,7 +688,7 @@ sock_send_string(int purpose, const char *str)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_string_len(int purpose, const char* str, int len)  {    if (accept_if_needed(purpose) != -1) @@ -697,7 +696,7 @@ sock_send_string_len(int purpose, const char* str, int len)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_strings(openaxiom_sio *sock, const char** vals, int num)  {    int i; @@ -707,7 +706,7 @@ send_strings(openaxiom_sio *sock, const char** vals, int num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_strings(int purpose, const char**vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -715,14 +714,14 @@ sock_send_strings(int purpose, const char**vals, int num)    return -1;  } -OPENAXIOM_EXPORT char * +OPENAXIOM_C_EXPORT char *  get_string(openaxiom_sio *sock)  {    int val, len;    char *buf;    len = get_int(sock);    if (len <0) return NULL; -  buf = malloc(len*sizeof(char)); +  buf = (char*) malloc(len*sizeof(char));    val = fill_buf(sock, (openaxiom_byte*) buf, len, "get_string");    if (val == -1){          free(buf); @@ -734,7 +733,7 @@ get_string(openaxiom_sio *sock)    return buf;  } -OPENAXIOM_EXPORT char * +OPENAXIOM_C_EXPORT char *  sock_get_string(int purpose)  {    if (accept_if_needed(purpose) != -1) @@ -743,7 +742,7 @@ sock_get_string(int purpose)  } -OPENAXIOM_EXPORT char * +OPENAXIOM_C_EXPORT char *  get_string_buf(openaxiom_sio *sock, char *buf, int buf_len)  {     int nbytes_read; @@ -763,7 +762,7 @@ get_string_buf(openaxiom_sio *sock, char *buf, int buf_len)     return sock->nbytes_pending == 0 ? NULL : buf;  } -OPENAXIOM_EXPORT char * +OPENAXIOM_C_EXPORT char *  sock_get_string_buf(int purpose, char* buf, int buf_len)  {    if (accept_if_needed(purpose) != -1) @@ -771,7 +770,7 @@ sock_get_string_buf(int purpose, char* buf, int buf_len)    return NULL;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   get_strings(openaxiom_sio *sock, char** vals,int num)  {    int i; @@ -780,7 +779,7 @@ get_strings(openaxiom_sio *sock, char** vals,int num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_strings(int purpose, char** vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -788,7 +787,7 @@ sock_get_strings(int purpose, char** vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_float(openaxiom_sio *sock, double num)  {    int val; @@ -799,7 +798,7 @@ send_float(openaxiom_sio *sock, double num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_float(int purpose, double num)  {    if (accept_if_needed(purpose) != -1) @@ -807,7 +806,7 @@ sock_send_float(int purpose, double num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_sfloats(openaxiom_sio *sock, const float *vals,int  num)  {    int i; @@ -817,7 +816,7 @@ send_sfloats(openaxiom_sio *sock, const float *vals,int  num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_sfloats(int purpose, const float* vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -825,7 +824,7 @@ sock_send_sfloats(int purpose, const float* vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_floats(openaxiom_sio *sock, const double *vals, int num)  {    int i; @@ -835,7 +834,7 @@ send_floats(openaxiom_sio *sock, const double *vals, int num)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_floats(int purpose, const double  *vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -843,7 +842,7 @@ sock_send_floats(int purpose, const double  *vals, int num)    return -1;  } -OPENAXIOM_EXPORT double  +OPENAXIOM_C_EXPORT double   get_float(openaxiom_sio *sock)  {    int val; @@ -855,7 +854,7 @@ get_float(openaxiom_sio *sock)    return num;  } -OPENAXIOM_EXPORT double  +OPENAXIOM_C_EXPORT double   sock_get_float(int purpose)  {    if (accept_if_needed(purpose) != -1) @@ -863,7 +862,7 @@ sock_get_float(int purpose)    else return 0.0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   get_sfloats(openaxiom_sio *sock, float *vals, int num)  {    int i; @@ -873,7 +872,7 @@ get_sfloats(openaxiom_sio *sock, float *vals, int num)  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_sfloats(int purpose,float * vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -881,7 +880,7 @@ sock_get_sfloats(int purpose,float * vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   get_floats(openaxiom_sio *sock,double *vals,int num)  {    int i; @@ -891,7 +890,7 @@ get_floats(openaxiom_sio *sock,double *vals,int num)  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_floats(int purpose, double *vals, int num)  {    if (accept_if_needed(purpose) != -1) @@ -899,7 +898,7 @@ sock_get_floats(int purpose, double *vals, int num)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   wait_for_client_kill(openaxiom_sio *sock, int sig)  {    int ret_val; @@ -917,7 +916,7 @@ wait_for_client_kill(openaxiom_sio *sock, int sig)  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_get_remote_fd(int purpose)  {    if (accept_if_needed(purpose) != -1) @@ -925,7 +924,7 @@ sock_get_remote_fd(int purpose)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_signal(openaxiom_sio *sock, int sig)  {    int ret_val; @@ -944,7 +943,7 @@ send_signal(openaxiom_sio *sock, int sig)    return ret_val;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_signal(int purpose,int  sig)  {    if (accept_if_needed(purpose) != -1) @@ -952,7 +951,7 @@ sock_send_signal(int purpose,int  sig)    return -1;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   send_wakeup(openaxiom_sio *sock)  {  #ifdef SIGUSR1    @@ -962,7 +961,7 @@ send_wakeup(openaxiom_sio *sock)  #endif    } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_send_wakeup(int purpose)  {    if (accept_if_needed(purpose) != -1) @@ -970,7 +969,7 @@ sock_send_wakeup(int purpose)    return -1;  } -OPENAXIOM_EXPORT openaxiom_sio * +OPENAXIOM_C_EXPORT openaxiom_sio *  connect_to_local_server_new(char *server_name, int purpose, int time_out)  {    int max_con=(time_out == 0 ? 1000000 : time_out), i, code=-1; @@ -1022,7 +1021,7 @@ connect_to_local_server_new(char *server_name, int purpose, int time_out)    return sock;  } -OPENAXIOM_EXPORT openaxiom_sio * +OPENAXIOM_C_EXPORT openaxiom_sio *  connect_to_local_server(char *server_name, int purpose, int time_out)  {    int max_con=(time_out == 0 ? 1000000 : time_out), i, code=-1; @@ -1077,7 +1076,7 @@ connect_to_local_server(char *server_name, int purpose, int time_out)  /* act as terminal session for sock connected to stdin and stdout of another     process */ -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   remote_stdio(openaxiom_sio *sock)  {    char buf[1024]; @@ -1111,7 +1110,7 @@ remote_stdio(openaxiom_sio *sock)  }  /* initialize the table of dedicated sockets */ -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   init_purpose_table(void)  {    int i; @@ -1121,21 +1120,21 @@ init_purpose_table(void)  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   make_server_number(void)  {    spad_server_number = oa_getpid();    return spad_server_number;  } -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   close_socket(openaxiom_socket socket_num, const char *name)  {    oa_close_socket(socket_num);    oa_unlink(name);  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   make_server_name(char *name, const char* base)  {    char *num; @@ -1156,7 +1155,7 @@ make_server_name(char *name, const char* base)  /* client Spad server sockets.  Two sockets are created: server[0]     is the internet server socket, and server[1] is a local domain socket. */ -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   open_server(const char* server_name)  {    char *s, name[256]; @@ -1222,7 +1221,7 @@ open_server(const char* server_name)    return 0;  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   accept_connection(openaxiom_sio *sock)  {    int client; @@ -1243,7 +1242,7 @@ accept_connection(openaxiom_sio *sock)  }  /* reads a the socket purpose declaration for classification */ -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   get_socket_type(openaxiom_sio *sock)  {    sock->pid = get_int(sock); @@ -1265,7 +1264,7 @@ get_socket_type(openaxiom_sio *sock)    }  } -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   sock_accept_connection(int purpose)  {    fd_set rd; @@ -1289,7 +1288,7 @@ sock_accept_connection(int purpose)  }  /* direct stdin and stdout from the given socket */ -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   redirect_stdio(openaxiom_sio *sock)  {    int fd; @@ -1308,7 +1307,7 @@ redirect_stdio(openaxiom_sio *sock)    FD_CLR(sock->socket, &socket_mask);  } -OPENAXIOM_EXPORT void +OPENAXIOM_C_EXPORT void  init_socks(void)  {    int i; @@ -1321,7 +1320,7 @@ init_socks(void)  /* Socket I/O selection called from the BOOT serverLoop function */ -OPENAXIOM_EXPORT int  +OPENAXIOM_C_EXPORT int   server_switch(void)  {    int ret_val, i, cmd = 0; @@ -1341,7 +1340,7 @@ server_switch(void)          FD_SET(purpose_table[MenuServer]->socket, &fds_mask);        }        rd = fds_mask; -      ret_val = select(FD_SETSIZE, (void *) &rd, (void *) 0, (void *) 0, (void *) 0); +      ret_val = select(FD_SETSIZE, &rd, 0, 0, 0);        if (ret_val == -1) {          /* perror ("Select in switch"); */          return -1; @@ -1368,7 +1367,7 @@ server_switch(void)    }  } -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   flush_stdout(void)  {    static FILE *fp = NULL; @@ -1382,7 +1381,7 @@ flush_stdout(void)    fflush(fp);  } -OPENAXIOM_EXPORT void  +OPENAXIOM_C_EXPORT void   print_line(const char* s)  {    printf("%s\n", s); diff --git a/src/lib/util.c b/src/lib/util.c index 1fee3d04..01681611 100644 --- a/src/lib/util.c +++ b/src/lib/util.c @@ -42,7 +42,7 @@  #include <X11/Xlib.h>  #include <X11/Xutil.h>  #include "view.h" - +#include "cfuns.h"  #include "util.H1"  | 
