+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.
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)
+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...
.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
#include "libguile/strings.h"
#include "libguile/validate.h"
+#include "libguile/lang.h"
#include "libguile/backtrace.h"
#include "libguile/filesys.h"
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;
#include "win32-socket.h"
#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
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)
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
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);
\f
}
#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 ()
{
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);