aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog26
-rw-r--r--src/include/bsdsignal.h13
-rw-r--r--src/include/cfuns.h64
-rw-r--r--src/include/cursor.h8
-rw-r--r--src/include/edin.h8
-rw-r--r--src/include/fnct_key.h9
-rw-r--r--src/include/halloc.h8
-rw-r--r--src/include/hash.h18
-rw-r--r--src/include/open-axiom.h37
-rw-r--r--src/include/openpty.h8
-rw-r--r--src/include/pixmap.h8
-rw-r--r--src/include/prt.h8
-rw-r--r--src/include/sockio.h175
-rw-r--r--src/include/spadcolors.h13
-rw-r--r--src/include/util.H18
-rw-r--r--src/include/view.h2
-rw-r--r--src/include/wct.h9
-rw-r--r--src/lib/Makefile.in10
-rw-r--r--src/lib/bsdsignal.c4
-rw-r--r--src/lib/cfuns-c.c68
-rw-r--r--src/lib/edin.c20
-rw-r--r--src/lib/sockio-c.c167
-rw-r--r--src/lib/util.c2
23 files changed, 301 insertions, 392 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 67bdc994..f342236d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,31 @@
2010-11-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * 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.
+
+2010-11-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* lisp/Makefile.in: Link the basic core with a C++ compiler when
GCL or ECL.
* lisp/core.lisp.in: Implement appropriate change.
diff --git a/src/include/bsdsignal.h b/src/include/bsdsignal.h
index ecbebebe..4c2a1992 100644
--- a/src/include/bsdsignal.h
+++ b/src/include/bsdsignal.h
@@ -1,7 +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
@@ -40,11 +40,6 @@
#include "open-axiom.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
#ifdef SIGCHLD
# define OPENAXIOM_SIGCHLD SIGCHLD
#elif defined (SIGCLD)
@@ -56,10 +51,6 @@ extern "C" {
typedef void (* SignalHandlerFunc)(int);
-OPENAXIOM_EXPORT SignalHandlerFunc bsdSignal(int, SignalHandlerFunc, int);
-
-#ifdef __cplusplus
-}
-#endif
+OPENAXIOM_C_EXPORT SignalHandlerFunc bsdSignal(int, SignalHandlerFunc, int);
#endif /* OPENAXIOM_BSDSIGNAL_included */
diff --git a/src/include/cfuns.h b/src/include/cfuns.h
index 10f439d2..28e89d85 100644
--- a/src/include/cfuns.h
+++ b/src/include/cfuns.h
@@ -38,43 +38,35 @@
#include "open-axiom.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+OPENAXIOM_C_EXPORT int addtopath(char*);
+OPENAXIOM_C_EXPORT int directoryp(char*);
+OPENAXIOM_C_EXPORT int make_path_from_file(char*, char*);
+OPENAXIOM_C_EXPORT int writeablep(char*);
+OPENAXIOM_C_EXPORT int readablep(char*);
+OPENAXIOM_C_EXPORT long findString(char*, char*);
+OPENAXIOM_C_EXPORT int copyEnvValue(char*, char*);
+OPENAXIOM_C_EXPORT int oa_chdir(const char*);
+OPENAXIOM_C_EXPORT int oa_unlink(const char*);
+OPENAXIOM_C_EXPORT int oa_rename(const char*, const char*);
+OPENAXIOM_C_EXPORT int oa_mkdir(const char*);
+OPENAXIOM_C_EXPORT int oa_system(const char*);
+OPENAXIOM_C_EXPORT char* oa_getenv(const char*);
+OPENAXIOM_C_EXPORT int oa_setenv(const char*, const char*);
+OPENAXIOM_C_EXPORT int oa_getpid(void);
+OPENAXIOM_C_EXPORT char* oa_getcwd(void);
+OPENAXIOM_C_EXPORT int oa_access_file_for_read(const char*);
+OPENAXIOM_C_EXPORT char* oa_dirname(const char*);
+OPENAXIOM_C_EXPORT const char* oa_get_tmpdir(void);
+OPENAXIOM_C_EXPORT int oa_copy_file(const char*, const char*);
-OPENAXIOM_EXPORT int addtopath(char*);
-OPENAXIOM_EXPORT int directoryp(char*);
-OPENAXIOM_EXPORT int make_path_from_file(char*, char*);
-OPENAXIOM_EXPORT int writeablep(char*);
-OPENAXIOM_EXPORT int readablep(char*);
-OPENAXIOM_EXPORT long findString(char*, char*);
-OPENAXIOM_EXPORT int copyEnvValue(char*, char*);
-OPENAXIOM_EXPORT int oa_chdir(const char*);
-OPENAXIOM_EXPORT int oa_unlink(const char*);
-OPENAXIOM_EXPORT int oa_rename(const char*, const char*);
-OPENAXIOM_EXPORT int oa_mkdir(const char*);
-OPENAXIOM_EXPORT int oa_system(const char*);
-OPENAXIOM_EXPORT char* oa_getenv(const char*);
-OPENAXIOM_EXPORT int oa_setenv(const char*, const char*);
-OPENAXIOM_EXPORT int oa_getpid(void);
-OPENAXIOM_EXPORT char* oa_getcwd(void);
-OPENAXIOM_EXPORT int oa_access_file_for_read(const char*);
-OPENAXIOM_EXPORT char* oa_dirname(const char*);
-OPENAXIOM_EXPORT const char* oa_get_tmpdir(void);
-OPENAXIOM_EXPORT int oa_copy_file(const char*, const char*);
+OPENAXIOM_C_EXPORT double plus_infinity(void);
+OPENAXIOM_C_EXPORT double minus_infinity(void);
+OPENAXIOM_C_EXPORT double quiet_double_NaN(void);
+OPENAXIOM_C_EXPORT openaxiom_byteorder oa_get_host_byteorder(void);
-OPENAXIOM_EXPORT double plus_infinity(void);
-OPENAXIOM_EXPORT double minus_infinity(void);
-OPENAXIOM_EXPORT double quiet_double_NaN(void);
-OPENAXIOM_EXPORT openaxiom_byteorder oa_get_host_byteorder(void);
-
-OPENAXIOM_EXPORT const char* oa_concatenate_string(const char*, const char*);
-OPENAXIOM_EXPORT const char* oa_strcat(const char*, const char*);
-OPENAXIOM_EXPORT char* oa_substr(const char*, const size_t, const size_t);
-OPENAXIOM_EXPORT char** oa_split(const char*, const char*, int*);
-
-#ifdef __cplusplus
-}
-#endif
+OPENAXIOM_C_EXPORT const char* oa_concatenate_string(const char*, const char*);
+OPENAXIOM_C_EXPORT const char* oa_strcat(const char*, const char*);
+OPENAXIOM_C_EXPORT char* oa_substr(const char*, const size_t, const size_t);
+OPENAXIOM_C_EXPORT char** oa_split(const char*, const char*, int*);
#endif /* OPENAXIOM_CFUNS_included */
diff --git a/src/include/cursor.h b/src/include/cursor.h
index 7073786b..ac44357c 100644
--- a/src/include/cursor.h
+++ b/src/include/cursor.h
@@ -36,14 +36,6 @@
#ifndef OPENAXIOM_cursor_INCLUDED
#define OPENAXIOM_cursor_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern int Cursor_shape(int );
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_cursor_INCLUDED */
diff --git a/src/include/edin.h b/src/include/edin.h
index 73c02b2b..65f77aeb 100644
--- a/src/include/edin.h
+++ b/src/include/edin.h
@@ -36,10 +36,6 @@
#ifndef OPENAXIOM_edin_INCLUDED
#define OPENAXIOM_edin_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern void init_reader(void);
extern void init_flag(int * , int );
extern void do_reading(void);
@@ -58,8 +54,4 @@ extern void flagncpy(int * , int * , int );
extern void send_function_to_child(void);
extern void send_buff_to_child(int );
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_edin_INCLUDED */
diff --git a/src/include/fnct_key.h b/src/include/fnct_key.h
index e0223961..812b62b6 100644
--- a/src/include/fnct_key.h
+++ b/src/include/fnct_key.h
@@ -36,11 +36,6 @@
#ifndef OPENAXIOM_fnct_key_INCLUDED
#define OPENAXIOM_fnct_key_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern void set_editor_key(void);
extern void define_function_keys(void);
extern int get_key(int , char * );
@@ -48,8 +43,4 @@ extern int get_str(int , char * );
extern void null_fnct(int );
extern void handle_function_key(int , int );
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_fnct_key_INCLUDED */
diff --git a/src/include/halloc.h b/src/include/halloc.h
index 6df64c31..facead25 100644
--- a/src/include/halloc.h
+++ b/src/include/halloc.h
@@ -36,14 +36,6 @@
#ifndef OPENAXIOM_HALLOC
#define OPENAXIOM_HALLOC
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern char * halloc(int, const char*);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_HALLOC */
diff --git a/src/include/hash.h b/src/include/hash.h
index aadcec03..8f97754d 100644
--- a/src/include/hash.h
+++ b/src/include/hash.h
@@ -1,6 +1,8 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -34,27 +36,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef OPENAXIOM_HASH_INCLUDED
#define OPENAXIOM_HASH_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct HashEntry {
+struct HashEntry {
const char *key; /* pointer to key data */
char *data; /* Pointer to entry */
struct HashEntry *next; /* Link to next entry */
-} HashEntry;
+};
typedef int (*EqualFunction)(const void*, const void*);
typedef int (*HashcodeFunction)(const void*,int);
typedef void (*MappableFunction) (const void*);
typedef void (*FreeFunction) (void *);
-typedef struct HashTable {
+struct HashTable {
HashEntry **table; /* the actual table */
int size; /* size of table */
int num_entries; /* number of elements in a hash table */
EqualFunction equal; /* equality predicate for keys */
HashcodeFunction hash_code; /* create hash code for a key */
-} HashTable;
+};
extern char* alloc_string(const char*);
extern HashEntry* hash_copy_entry(HashEntry*);
@@ -69,8 +67,4 @@ extern char* hash_replace(HashTable*, char*, const char*);
extern int string_equal(const char*, const char*);
extern int string_hash(const char*, int size);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_HASH_INCLUDED */
diff --git a/src/include/open-axiom.h b/src/include/open-axiom.h
index fd0e7326..30cb3fd3 100644
--- a/src/include/open-axiom.h
+++ b/src/include/open-axiom.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007-2009, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,13 @@
#include "openaxiom-c-macros.h"
+/* Annotation to request C calling convention */
+#ifdef __cplusplus
+# define OPENAXIOM_C_CALL extern "C"
+#else
+# define OPENAXIOM_C_CALL
+#endif
+
/* Cope with MS-platform oddities. */
#ifdef __WIN32__
# ifdef DLL_EXPORT
@@ -51,6 +58,8 @@
# define OPENAXIOM_EXPORT /* nothing */
#endif /* OPENAXIOM_EXPORT */
+#define OPENAXIOM_C_EXPORT OPENAXIOM_C_CALL OPENAXIOM_EXPORT
+
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined (HAVE_INTTYPES_H)
@@ -68,10 +77,6 @@ typedef void* openaxiom_handle;
#include <unistd.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Do we have graphics support? */
#ifdef X_DISPLAY_MISSING
# define OPENAXIOM_HAVE_GRAPHICS 0
@@ -80,22 +85,22 @@ extern "C" {
#endif
/* Byte order enumeration. */
-typedef enum openaxiom_byteorder {
+enum openaxiom_byteorder {
oa_unknown_endian, oa_little_endian, oa_big_endian
-} openaxiom_byteorder;
+};
/* Datatype for packaging information necessary tolaunch a process. */
-typedef struct openaxiom_process {
+struct openaxiom_process {
int argc;
char** argv;
int id;
-} openaxiom_process;
+};
-typedef enum openaxiom_spawn_flags {
+enum openaxiom_spawn_flags {
openaxiom_spawn_search_path = 0x01,
openaxiom_spawn_replace = 0x02,
-} openaxiom_spawn_flags;
+};
/* Return the address of the data buffer `BUF'. */
@@ -130,12 +135,8 @@ openaxiom_sleep(int n)
}
-OPENAXIOM_EXPORT void oa_allocate_process_argv(openaxiom_process*, int);
-OPENAXIOM_EXPORT int oa_spawn(openaxiom_process*, openaxiom_spawn_flags);
-OPENAXIOM_EXPORT const char* oa_concatenate_string(const char*, const char*);
-
-#ifdef __cplusplus
-}
-#endif
+OPENAXIOM_C_EXPORT void oa_allocate_process_argv(openaxiom_process*, int);
+OPENAXIOM_C_EXPORT int oa_spawn(openaxiom_process*, openaxiom_spawn_flags);
+OPENAXIOM_C_EXPORT const char* oa_concatenate_string(const char*, const char*);
#endif /* OPENAXIOM_included */
diff --git a/src/include/openpty.h b/src/include/openpty.h
index 24df8a0d..c76bb3d8 100644
--- a/src/include/openpty.h
+++ b/src/include/openpty.h
@@ -36,14 +36,6 @@
#ifndef OPENAXIOM_openpty_INCLUDED
#define OPENAXIOM_openpty_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern int ptyopen(int*, int*, char*);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_openpty_INCLUDED */
diff --git a/src/include/pixmap.h b/src/include/pixmap.h
index 86f34437..a181b979 100644
--- a/src/include/pixmap.h
+++ b/src/include/pixmap.h
@@ -36,18 +36,10 @@
#ifndef OPENAXIOM_PIXMAP_included
#define OPENAXIOM_PIXMAP_included
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern int file_exists(char * );
extern FILE * zzopen(char * , char * );
extern void write_pixmap_file(Display * , int , char * , Window , int , int , int , int );
extern int read_pixmap_file(Display * , int , char * , XImage * * , int * , int * );
-
-#ifdef __cplusplus
-}
-#endif
#endif
diff --git a/src/include/prt.h b/src/include/prt.h
index 5df67134..a6d60e7f 100644
--- a/src/include/prt.h
+++ b/src/include/prt.h
@@ -36,10 +36,6 @@
#ifndef OPENAXIOM_ptr_INCLUDED
#define OPENAXIOM_ptr_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern void myputchar(char );
extern void clear_buff(void);
extern void move_end(void);
@@ -60,8 +56,4 @@ extern void move_ahead(void);
extern void move_back(void);
extern void back_over_current_char(void);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_ptr_INCLUDED */
diff --git a/src/include/sockio.h b/src/include/sockio.h
index 07d9097a..03893967 100644
--- a/src/include/sockio.h
+++ b/src/include/sockio.h
@@ -1,7 +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
@@ -53,11 +53,6 @@
#include "openaxiom-c-macros.h"
#include "open-axiom.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
/* On Windows, a socket identifier is not a file descriptor. It is
represented by an integer type, but that integer type is not just
plain int as in the Unix world. It is an unsigned integer.
@@ -73,7 +68,7 @@ typedef int openaxiom_filedesc;
#endif
typedef int openaxiom_port;
-typedef struct openaxiom_sio {
+struct openaxiom_sio {
openaxiom_socket socket; /* descriptor of this socket I/O endpoint. */
int type; /* socket type (AF_UNIX or AF_INET) */
int purpose; /* can be SessionManager, GraphicsServer, etc. */
@@ -86,103 +81,102 @@ typedef struct openaxiom_sio {
} addr;
char *host_name; /* name of foreign host if type == AF_INET */
size_t nbytes_pending; /* pending bytes for read. */
-} openaxiom_sio;
+};
-OPENAXIOM_EXPORT openaxiom_filedesc
+OPENAXIOM_C_EXPORT openaxiom_filedesc
oa_open_local_client_stream_socket(const char*);
-OPENAXIOM_EXPORT int oa_inet_pton(const char*, int, openaxiom_byte*);
-OPENAXIOM_EXPORT int oa_get_host_address(const char*, int, openaxiom_byte*);
-OPENAXIOM_EXPORT int oa_open_local_server_stream_socket(const char*);
-OPENAXIOM_EXPORT openaxiom_socket
+OPENAXIOM_C_EXPORT int oa_inet_pton(const char*, int, openaxiom_byte*);
+OPENAXIOM_C_EXPORT int oa_get_host_address(const char*, int, openaxiom_byte*);
+OPENAXIOM_C_EXPORT int oa_open_local_server_stream_socket(const char*);
+OPENAXIOM_C_EXPORT openaxiom_socket
oa_connect_ip_port_stream(const openaxiom_byte*, int, openaxiom_port);
-OPENAXIOM_EXPORT int oa_socket_write(openaxiom_socket,
+OPENAXIOM_C_EXPORT int oa_socket_write(openaxiom_socket,
const openaxiom_byte*, int);
-OPENAXIOM_EXPORT int oa_socket_write_byte(openaxiom_socket, openaxiom_byte);
+OPENAXIOM_C_EXPORT int oa_socket_write_byte(openaxiom_socket, openaxiom_byte);
-OPENAXIOM_EXPORT int oa_socket_read(openaxiom_socket,
+OPENAXIOM_C_EXPORT int oa_socket_read(openaxiom_socket,
openaxiom_byte*, int);
-OPENAXIOM_EXPORT int oa_socket_read_byte(openaxiom_socket);
+OPENAXIOM_C_EXPORT int oa_socket_read_byte(openaxiom_socket);
-OPENAXIOM_EXPORT void oa_close_socket(openaxiom_socket);
+OPENAXIOM_C_EXPORT void oa_close_socket(openaxiom_socket);
-OPENAXIOM_EXPORT int
+OPENAXIOM_C_EXPORT int
oa_filedesc_write(openaxiom_filedesc, const openaxiom_byte*, int);
-OPENAXIOM_EXPORT int
+OPENAXIOM_C_EXPORT int
oa_filedesc_read(openaxiom_filedesc, openaxiom_byte*, int);
-OPENAXIOM_EXPORT int oa_filedesc_close(openaxiom_filedesc);
+OPENAXIOM_C_EXPORT int oa_filedesc_close(openaxiom_filedesc);
-OPENAXIOM_EXPORT int sread(openaxiom_sio*, openaxiom_byte*, int, const char*);
-OPENAXIOM_EXPORT int swrite(openaxiom_sio*, const openaxiom_byte*, int,
+OPENAXIOM_C_EXPORT int sread(openaxiom_sio*, openaxiom_byte*, int, const char*);
+OPENAXIOM_C_EXPORT int swrite(openaxiom_sio*, const openaxiom_byte*, int,
const char*);
-OPENAXIOM_EXPORT int wait_for_client_read(openaxiom_sio*, openaxiom_byte*,
+OPENAXIOM_C_EXPORT int wait_for_client_read(openaxiom_sio*, openaxiom_byte*,
int, const char*);
-OPENAXIOM_EXPORT int wait_for_client_write(openaxiom_sio*,
+OPENAXIOM_C_EXPORT int wait_for_client_write(openaxiom_sio*,
const openaxiom_byte*, int,
const char*);
-OPENAXIOM_EXPORT int make_server_name(char*, const char*);
-OPENAXIOM_EXPORT int make_server_number(void);
-OPENAXIOM_EXPORT openaxiom_sio* connect_to_local_server(char*, int, int);
-OPENAXIOM_EXPORT int open_server(const char*);
-OPENAXIOM_EXPORT int accept_connection(openaxiom_sio*);
-OPENAXIOM_EXPORT int sselect(int, fd_set*, fd_set*, fd_set*, void*);
-OPENAXIOM_EXPORT void close_socket(openaxiom_socket, const char*);
-
-OPENAXIOM_EXPORT int get_int(openaxiom_sio*);
-OPENAXIOM_EXPORT double get_float(openaxiom_sio*);
-OPENAXIOM_EXPORT double sock_get_float(int);
-OPENAXIOM_EXPORT int get_sfloats(openaxiom_sio*, float*, int);
-OPENAXIOM_EXPORT char* get_string(openaxiom_sio*);
-OPENAXIOM_EXPORT void sigpipe_handler(int);
-OPENAXIOM_EXPORT int fill_buf(openaxiom_sio*, openaxiom_byte*, int,
+OPENAXIOM_C_EXPORT int make_server_name(char*, const char*);
+OPENAXIOM_C_EXPORT int make_server_number(void);
+OPENAXIOM_C_EXPORT openaxiom_sio* connect_to_local_server(char*, int, int);
+OPENAXIOM_C_EXPORT int open_server(const char*);
+OPENAXIOM_C_EXPORT int accept_connection(openaxiom_sio*);
+OPENAXIOM_C_EXPORT int sselect(int, fd_set*, fd_set*, fd_set*, void*);
+OPENAXIOM_C_EXPORT void close_socket(openaxiom_socket, const char*);
+
+OPENAXIOM_C_EXPORT int get_int(openaxiom_sio*);
+OPENAXIOM_C_EXPORT double get_float(openaxiom_sio*);
+OPENAXIOM_C_EXPORT double sock_get_float(int);
+OPENAXIOM_C_EXPORT int get_sfloats(openaxiom_sio*, float*, int);
+OPENAXIOM_C_EXPORT char* get_string(openaxiom_sio*);
+OPENAXIOM_C_EXPORT void sigpipe_handler(int);
+OPENAXIOM_C_EXPORT int fill_buf(openaxiom_sio*, openaxiom_byte*, int,
const char*);
-OPENAXIOM_EXPORT int sock_get_int(int);
-OPENAXIOM_EXPORT int get_ints(openaxiom_sio*, int*, int);
-OPENAXIOM_EXPORT int sock_get_ints(int, int*, int);
-OPENAXIOM_EXPORT int send_int(openaxiom_sio*, int);
-OPENAXIOM_EXPORT int sock_send_int(int, int);
-OPENAXIOM_EXPORT int send_ints(openaxiom_sio*, const int*, int);
-OPENAXIOM_EXPORT int sock_send_ints(int, const int*, int);
-OPENAXIOM_EXPORT int send_string(openaxiom_sio*, const char*);
-OPENAXIOM_EXPORT int send_string_len(openaxiom_sio*, const char*, int);
-OPENAXIOM_EXPORT int sock_send_string(int, const char*);
-OPENAXIOM_EXPORT int sock_send_string_len(int, const char*, int);
-OPENAXIOM_EXPORT int send_strings(openaxiom_sio*, const char**, int);
-OPENAXIOM_EXPORT int sock_send_strings(int, const char**, int);
-OPENAXIOM_EXPORT char* sock_get_string(int);
-OPENAXIOM_EXPORT char* get_string_buf(openaxiom_sio*, char*, int);
-OPENAXIOM_EXPORT char* sock_get_string_buf(int, char*, int);
-OPENAXIOM_EXPORT int get_strings(openaxiom_sio*, char**, int);
-OPENAXIOM_EXPORT int sock_get_strings(int, char**, int);
-OPENAXIOM_EXPORT int send_float(openaxiom_sio*, double);
-OPENAXIOM_EXPORT int sock_send_float(int, double);
-OPENAXIOM_EXPORT int send_sfloats(openaxiom_sio*, const float*, int);
-OPENAXIOM_EXPORT int sock_send_sfloats(int, const float*, int);
-OPENAXIOM_EXPORT int send_floats(openaxiom_sio*, const double*, int);
-OPENAXIOM_EXPORT int sock_send_floats(int, const double*, int);
-OPENAXIOM_EXPORT int sock_get_sfloats(int, float*, int);
-OPENAXIOM_EXPORT int get_floats(openaxiom_sio*, double*, int);
-OPENAXIOM_EXPORT int sock_get_floats(int, double*, int);
-OPENAXIOM_EXPORT int wait_for_client_kill(openaxiom_sio*, int);
-OPENAXIOM_EXPORT int sock_get_remote_fd(int);
-OPENAXIOM_EXPORT int send_signal(openaxiom_sio*, int);
-OPENAXIOM_EXPORT int sock_send_signal(int, int);
-OPENAXIOM_EXPORT int send_wakeup(openaxiom_sio*);
-OPENAXIOM_EXPORT int sock_send_wakeup(int);
-OPENAXIOM_EXPORT void remote_stdio(openaxiom_sio*);
-OPENAXIOM_EXPORT void init_purpose_table(void);
-OPENAXIOM_EXPORT void get_socket_type(openaxiom_sio*);
-OPENAXIOM_EXPORT int sock_accept_connection(int);
-OPENAXIOM_EXPORT void redirect_stdio(openaxiom_sio*);
-OPENAXIOM_EXPORT void init_socks(void);
-OPENAXIOM_EXPORT int server_switch(void);
-OPENAXIOM_EXPORT void flush_stdout(void);
-OPENAXIOM_EXPORT void print_line(const char*);
-
+OPENAXIOM_C_EXPORT int sock_get_int(int);
+OPENAXIOM_C_EXPORT int get_ints(openaxiom_sio*, int*, int);
+OPENAXIOM_C_EXPORT int sock_get_ints(int, int*, int);
+OPENAXIOM_C_EXPORT int send_int(openaxiom_sio*, int);
+OPENAXIOM_C_EXPORT int sock_send_int(int, int);
+OPENAXIOM_C_EXPORT int send_ints(openaxiom_sio*, const int*, int);
+OPENAXIOM_C_EXPORT int sock_send_ints(int, const int*, int);
+OPENAXIOM_C_EXPORT int send_string(openaxiom_sio*, const char*);
+OPENAXIOM_C_EXPORT int send_string_len(openaxiom_sio*, const char*, int);
+OPENAXIOM_C_EXPORT int sock_send_string(int, const char*);
+OPENAXIOM_C_EXPORT int sock_send_string_len(int, const char*, int);
+OPENAXIOM_C_EXPORT int send_strings(openaxiom_sio*, const char**, int);
+OPENAXIOM_C_EXPORT int sock_send_strings(int, const char**, int);
+OPENAXIOM_C_EXPORT char* sock_get_string(int);
+OPENAXIOM_C_EXPORT char* get_string_buf(openaxiom_sio*, char*, int);
+OPENAXIOM_C_EXPORT char* sock_get_string_buf(int, char*, int);
+OPENAXIOM_C_EXPORT int get_strings(openaxiom_sio*, char**, int);
+OPENAXIOM_C_EXPORT int sock_get_strings(int, char**, int);
+OPENAXIOM_C_EXPORT int send_float(openaxiom_sio*, double);
+OPENAXIOM_C_EXPORT int sock_send_float(int, double);
+OPENAXIOM_C_EXPORT int send_sfloats(openaxiom_sio*, const float*, int);
+OPENAXIOM_C_EXPORT int sock_send_sfloats(int, const float*, int);
+OPENAXIOM_C_EXPORT int send_floats(openaxiom_sio*, const double*, int);
+OPENAXIOM_C_EXPORT int sock_send_floats(int, const double*, int);
+OPENAXIOM_C_EXPORT int sock_get_sfloats(int, float*, int);
+OPENAXIOM_C_EXPORT int get_floats(openaxiom_sio*, double*, int);
+OPENAXIOM_C_EXPORT int sock_get_floats(int, double*, int);
+OPENAXIOM_C_EXPORT int wait_for_client_kill(openaxiom_sio*, int);
+OPENAXIOM_C_EXPORT int sock_get_remote_fd(int);
+OPENAXIOM_C_EXPORT int send_signal(openaxiom_sio*, int);
+OPENAXIOM_C_EXPORT int sock_send_signal(int, int);
+OPENAXIOM_C_EXPORT int send_wakeup(openaxiom_sio*);
+OPENAXIOM_C_EXPORT int sock_send_wakeup(int);
+OPENAXIOM_C_EXPORT void remote_stdio(openaxiom_sio*);
+OPENAXIOM_C_EXPORT void init_purpose_table(void);
+OPENAXIOM_C_EXPORT void get_socket_type(openaxiom_sio*);
+OPENAXIOM_C_EXPORT int sock_accept_connection(int);
+OPENAXIOM_C_EXPORT void redirect_stdio(openaxiom_sio*);
+OPENAXIOM_C_EXPORT void init_socks(void);
+OPENAXIOM_C_EXPORT int server_switch(void);
+OPENAXIOM_C_EXPORT void flush_stdout(void);
+OPENAXIOM_C_EXPORT void print_line(const char*);
#define MaxClients 150
@@ -219,15 +213,10 @@ OPENAXIOM_EXPORT void print_line(const char*);
/* table of dedicated socket types */
-OPENAXIOM_EXPORT extern openaxiom_sio *purpose_table[];
-OPENAXIOM_EXPORT extern openaxiom_sio server[];
-OPENAXIOM_EXPORT extern openaxiom_sio clients[];
-OPENAXIOM_EXPORT extern fd_set socket_mask;
-OPENAXIOM_EXPORT extern fd_set server_mask;
-
-
-#ifdef __cplusplus
-}
-#endif
+OPENAXIOM_C_EXPORT openaxiom_sio *purpose_table[];
+OPENAXIOM_C_EXPORT openaxiom_sio server[];
+OPENAXIOM_C_EXPORT openaxiom_sio clients[];
+OPENAXIOM_C_EXPORT fd_set socket_mask;
+OPENAXIOM_C_EXPORT fd_set server_mask;
#endif /* OPENAXIOM_SOCKIO_included */
diff --git a/src/include/spadcolors.h b/src/include/spadcolors.h
index c244cc6f..63621599 100644
--- a/src/include/spadcolors.h
+++ b/src/include/spadcolors.h
@@ -1,6 +1,8 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
+ Copyright (C) 2007-2010, Gabriel Dos Reis
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -37,10 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <X11/Xlib.h>
#include "rgb.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define numOfColors 240
#define totalHuesConst 27
#define totalShadesConst 5
@@ -80,11 +78,4 @@ extern int scrn;
#define maxColors DisplayCells(dsply,scrn)-1
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
#endif /* OPENAXIOM_SPADCOLORS_included */
diff --git a/src/include/util.H1 b/src/include/util.H1
index c60bd374..bed0da32 100644
--- a/src/include/util.H1
+++ b/src/include/util.H1
@@ -1,14 +1,6 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern int checker(int , int , char * );
extern char * getmemWithLine(int , char * , int );
extern char * saymemWithLine(char * , int , int , int );
extern void myfree(void * , int );
extern XPoint getWindowPositionXY(Display * , Window );
extern XPoint getWindowSizeXY(Display * , Window );
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/src/include/view.h b/src/include/view.h
index 196a6019..3a02a187 100644
--- a/src/include/view.h
+++ b/src/include/view.h
@@ -1,7 +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
diff --git a/src/include/wct.h b/src/include/wct.h
index b61cd233..bc7a3604 100644
--- a/src/include/wct.h
+++ b/src/include/wct.h
@@ -36,10 +36,6 @@
#ifndef OPENAXIOM_wct_INCLUDED
#define OPENAXIOM_wct_INCLUDED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern time_t ftime(char * );
extern void fatal(char * , char * );
extern off_t fsize(char * );
@@ -66,9 +62,4 @@ extern void skim_wct(void);
extern void rescan_wct(void);
extern void find_wct(void);
-
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_wct_INCLUDED */
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"