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/cfuns-c.c | |
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/cfuns-c.c')
-rw-r--r-- | src/lib/cfuns-c.c | 68 |
1 files changed, 34 insertions, 34 deletions
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; |