mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-22 03:30:22 +02:00
2002-01-28 Stefan Jahn <stefan@lkcc.org>
* configure.in (guile_cv_have_uint32_t): Look also in `stdint.h' for uint32_t. 2002-01-28 Stefan Jahn <stefan@lkcc.org> * symbols.c (scm_c_symbol2str): New function, replacement for `gh_scm2newsymbol()'. * strings.c (scm_c_substring2str): New function. Proper replacement for `gh_get_substr()'. * socket.c: Include `stdint.h' if available for the `uint32_t' declaration. * scmsigs.c (s_scm_sigaction): Initialize `chandler' (inhibits compiler warning). * backtrace.c: Include `lang.h' for GUILE_DEBUG conditional.
This commit is contained in:
parent
962b1f0bac
commit
af68e5e5a6
11 changed files with 105 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-01-28 Stefan Jahn <stefan@lkcc.org>
|
||||
|
||||
* configure.in (guile_cv_have_uint32_t): Look also in
|
||||
`stdint.h' for uint32_t.
|
||||
|
||||
2002-01-13 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* Makefile.am (SUBDIRS): Added lang.
|
||||
|
|
|
@ -348,7 +348,12 @@ fi
|
|||
AC_MSG_CHECKING(whether uint32_t is defined)
|
||||
AC_CACHE_VAL(guile_cv_have_uint32_t,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <netdb.h>],
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifndef __MINGW32__
|
||||
#include <netdb.h>
|
||||
#endif],
|
||||
[uint32_t a;],
|
||||
guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
|
||||
AC_MSG_RESULT($guile_cv_have_uint32_t)
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
2002-01-28 Stefan Jahn <stefan@lkcc.org>
|
||||
|
||||
* symbols.c (scm_c_symbol2str): New function, replacement for
|
||||
`gh_scm2newsymbol()'.
|
||||
|
||||
* strings.c (scm_c_substring2str): New function. Proper
|
||||
replacement for `gh_get_substr()'.
|
||||
|
||||
* socket.c: Include `stdint.h' if available for the `uint32_t'
|
||||
declaration.
|
||||
|
||||
* scmsigs.c (s_scm_sigaction): Initialize `chandler' (inhibits
|
||||
compiler warning).
|
||||
|
||||
* backtrace.c: Include `lang.h' for GUILE_DEBUG conditional.
|
||||
|
||||
2002-01-22 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
Other changes unrelated to Elisp...
|
||||
|
|
|
@ -203,7 +203,7 @@ SUFFIXES = .x .doc
|
|||
.c.doc:
|
||||
-(test -n "${AWK+set}" || AWK="@AWK@"; ${AWK} -f ./guile-func-name-check $<)
|
||||
(./guile-snarf-docs $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< | \
|
||||
./guile_filter_doc_snarfage --filter-snarfage) > $@ || { rm $@; false; }
|
||||
./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
|
||||
|
||||
$(DOT_X_FILES) $(EXTRA_DOT_DOC_FILES): snarf.h guile-snarf.in
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "libguile/strings.h"
|
||||
|
||||
#include "libguile/validate.h"
|
||||
#include "libguile/lang.h"
|
||||
#include "libguile/backtrace.h"
|
||||
#include "libguile/filesys.h"
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ SCM_DEFINE (scm_sigaction, "sigaction", 1, 2, 0,
|
|||
struct sigaction action;
|
||||
struct sigaction old_action;
|
||||
#else
|
||||
SIGRETTYPE (* chandler) (int);
|
||||
SIGRETTYPE (* chandler) (int) = SIG_DFL;
|
||||
SIGRETTYPE (* old_chandler) (int);
|
||||
#endif
|
||||
int query_only = 0;
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
#include "win32-socket.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
|
|
@ -350,12 +350,13 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
|
|||
determine the length of the returned value. However, the function always
|
||||
copies the complete contents of OBJ, and sets *LENP to the length of the
|
||||
scheme string (if LENP is non-null). */
|
||||
#define FUNC_NAME "scm_c_string2str"
|
||||
char *
|
||||
scm_c_string2str (SCM obj, char *str, size_t *lenp)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
SCM_ASSERT (SCM_STRINGP (obj), obj, SCM_ARG1, "scm_c_string2str");
|
||||
SCM_ASSERT (SCM_STRINGP (obj), obj, SCM_ARG1, FUNC_NAME);
|
||||
len = SCM_STRING_LENGTH (obj);
|
||||
|
||||
if (str == NULL)
|
||||
|
@ -376,6 +377,30 @@ scm_c_string2str (SCM obj, char *str, size_t *lenp)
|
|||
|
||||
return str;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
/* Copy LEN characters at START from the Scheme string OBJ to memory
|
||||
at STR. START is an index into OBJ; zero means the beginning of
|
||||
the string. STR has already been allocated by the caller.
|
||||
|
||||
If START + LEN is off the end of OBJ, silently truncate the source
|
||||
region to fit the string. If truncation occurs, the corresponding
|
||||
area of STR is left unchanged. */
|
||||
#define FUNC_NAME "scm_c_substring2str"
|
||||
char *
|
||||
scm_c_substring2str (SCM obj, char *str, size_t start, size_t len)
|
||||
{
|
||||
size_t src_length, effective_length;
|
||||
|
||||
SCM_ASSERT (SCM_STRINGP (obj), obj, SCM_ARG2, FUNC_NAME);
|
||||
src_length = SCM_STRING_LENGTH (obj);
|
||||
effective_length = (len + start <= src_length) ? len : src_length - start;
|
||||
memcpy (str, SCM_STRING_CHARS (obj) + start, effective_length);
|
||||
scm_remember_upto_here_1 (obj);
|
||||
return str;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -79,6 +79,7 @@ SCM_API SCM scm_substring (SCM str, SCM start, SCM end);
|
|||
SCM_API SCM scm_string_append (SCM args);
|
||||
SCM_API void scm_init_strings (void);
|
||||
SCM_API char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
|
||||
SCM_API char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -318,6 +318,50 @@ SCM_DEFINE (scm_symbol_pset_x, "symbol-pset!", 2, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
/* Converts the given Scheme symbol OBJ into a C string, containing a copy
|
||||
of OBJ's content with a trailing null byte. If LENP is non-NULL, set
|
||||
*LENP to the string's length.
|
||||
|
||||
When STR is non-NULL it receives the copy and is returned by the function,
|
||||
otherwise new memory is allocated and the caller is responsible for
|
||||
freeing it via free(). If out of memory, NULL is returned.
|
||||
|
||||
Note that Scheme symbols may contain arbitrary data, including null
|
||||
characters. This means that null termination is not a reliable way to
|
||||
determine the length of the returned value. However, the function always
|
||||
copies the complete contents of OBJ, and sets *LENP to the length of the
|
||||
scheme symbol (if LENP is non-null). */
|
||||
#define FUNC_NAME "scm_c_symbol2str"
|
||||
char *
|
||||
scm_c_symbol2str (SCM obj, char *str, size_t *lenp)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
SCM_ASSERT (SCM_SYMBOLP (obj), obj, SCM_ARG1, FUNC_NAME);
|
||||
len = SCM_SYMBOL_LENGTH (obj);
|
||||
|
||||
if (str == NULL)
|
||||
{
|
||||
/* FIXME: Should we use exported wrappers for malloc (and free), which
|
||||
* allow windows DLLs to call the correct freeing function? */
|
||||
str = (char *) malloc ((len + 1) * sizeof (char));
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy (str, SCM_SYMBOL_CHARS (obj), len);
|
||||
scm_remember_upto_here_1 (obj);
|
||||
str[len] = '\0';
|
||||
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
|
||||
return str;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
void
|
||||
scm_symbols_prehistory ()
|
||||
{
|
||||
|
|
|
@ -89,6 +89,7 @@ SCM_API SCM scm_symbol_pset_x (SCM s, SCM val);
|
|||
SCM_API SCM scm_symbol_hash (SCM s);
|
||||
SCM_API SCM scm_gensym (SCM prefix);
|
||||
|
||||
SCM_API char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
|
||||
SCM_API void scm_symbols_prehistory (void);
|
||||
SCM_API void scm_init_symbols (void);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue