unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Fix continuation problems on IA64.
@ 2008-05-07 23:46 Neil Jerram
  2008-05-08 20:09 ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-05-07 23:46 UTC (permalink / raw)
  To: Guile Development

FYI, I finally fixed some problems on IA64 that have been outstanding
for ages (at least about 2 years).  Following is a big spiel about it,
and the actual patch (against 1.8.4 release).  If anyone has any
comments or questions, please let me know.  (And if not, I'll commit
in a couple of days' time.)

Regards,
      Neil


* Specific problems in IA64 make check

** test-unwind

Representation of the relevant dynamic context:

                  non-rewindable
           catch      frame       make cont.
  o----o-----a----------b-------------c
        \
         \             call cont.
          o-----o-----------d

A continuation is captured at (c), with a non-rewindable frame in the
dynamic context at (b).  If a rewind through that frame was attempted,
Guile would throw to the catch at (a).  Then the context unwinds back
past (a), then winds forwards again, and the captured continuation is
called at (d).

We should end up at the catch at (a).  On ia64, we get an "illegal
instruction".

The problem is that Guile does not restore the ia64 register backing
store (RBS) stack (which is saved off when the continuation is
captured) until all the unwinding and rewinding is done.  Therefore,
when the rewind code (scm_i_dowinds) hits the non-rewindable frame at
(b), the RBS stack hasn't yet been restored.  The throw finds the
jmp_buf (for the catch at (a)) correctly from the dynamic context, and
jumps back to (a), but the RBS stack is invalid, hence the illegal
instruction.

This could be fixed by restoring the RBS stack earlier, at the same
point (copy_stack) where the normal stack is restored.  But that
causes a problem in the next test...

** continuations.test

The dynamic context diagram for this case is similar:

                   non-rewindable
  catch                 frame       make cont.
    a----x-----o----------b-------------c
          \
           \    call cont.
            o-------d

The only significant difference is that the catch point (a) is
upstream of where the dynamic context forks.  This means that the RBS
stack at (d) already contains the correct RBS contents for throwing
back to (a), so it doesn't matter whether the RBS stack that was saved
off with the continuation gets restored.

This test passes with the Guile 1.8.4 code, but fails (with an
"illegal instruction") when the code is changed to restore the RBS
stack earlier as described above.

The problem now is that the RBS stack is being restored _too_ early;
specifically when there is still stuff to do that relies on the old
RBS contents.  When a continuation is called, the sequence of relevant
events is:

  (1) Grow the (normal) stack until it is bigger than the (normal)
      stack saved off in the continuation.  (scm_dynthrow, grow_stack)

  (2) scm_i_dowinds calls itself recursively, such that

      (2.1) for each rewind (from (x) to (c)) that will be needed,
            another frame is added to the stack (both normal and RBS),
            with local variables specifying the required rewind; the
            rewinds don't actually happen yet, they will happen when
            the stack unwinds again through these frames

      (2.2) required unwinds - back from where the continuation was
            called (d) to the fork point (x) - are done immediately.

  (3) The normal (i.e. non-RBS) stack that was stored in the
      continuation is restored (i.e. copied on top of the actual
      stack).

      Note that this doesn't overwrite the frames that were added in
      (2.1), because the growth in (1) ensures that the added frames
      are beyond the end of the restored stack.

  (4) ? Restore the RBS stack here too ?

  (5) Return (from copy_stack) through the (2.1) frames, which means
      that the rewinds now happen.

  (6) setcontext (or longjmp) to the context (c) where the
      continuation was captured.

The trouble is that step (1) does not create space in the RBS stack in
the same kind of way that it does for the normal stack.  Therefore, if
the saved (in the continuation) RBS stack is big enough, it can
overwrite the RBS of the (2.1) frames that still need to complete.
This causes an illegal instruction when we return through those frames
and try to perform the rewinds.

* Fix

The key to the fix is that the saved RBS stack only needs to be
restored at some point before the next setcontext call, and that doing
it as close to the setcontext call as possible will avoid bad
interactions with the pre-setcontext stack.  Therefore we do the
restoration at the last possible point, immediately before the next
setcontext call.

The situation is complicated by there being two ways that the next
setcontext call can happen.

  - If the unwinding and rewinding is all successful, the next
    setcontext will be the one from step (6) above.  This is the
    "normal" continuation invocation case.

  - If one of the rewinds throws an error, the next setcontext will
    come from the throw implementation code.  (And the one in step (6)
    will never happen.)  This is the rewind error case.

In the rewind error case, the code calling setcontext knows nothing
about the continuation.  So to cover both cases, we:

  - copy (in step (4) above) the address and length of the
    continuation's saved RBS stack to the current thread state
    (SCM_I_CURRENT_THREAD)

  - modify all setcontext callers so that they check the current
    thread state for a saved RBS stack, and restore it if so before
    calling setcontext.

* Notes

** I think rewinders cannot rely on using any stack data

Unless it can be guaranteed that the data won't go into a register.
I'm not 100% sure about this, but I think it follows from the fact
that the RBS stack is not restored until after the rewinds have
happened.

Note that this isn't a regression caused by the current fix.  In Guile
1.8.4, the RBS stack was restored _after_ the rewinds, and this is
still the case now.

** Most setcontext calls for `throw' don't need to change the RBS stack

In the absence of continuation invocation, the setcontext call in the
throw implementation code always sets context to a place higher up the
same stack (both normal and RBS), hence no stack restoration is
needed.

* Other changes

** Using setcontext for all non-local jumps (for __ia64__)

Along the way, I read a claim somewhere that setcontext was more
reliable than longjmp, in cases where the stack has been manipulated.

I don't now have any reason to believe this, but it seems reasonable
anyway to leave the __ia64__ code using getcontext/setcontext, instead
of setjmp/longjmp.

(I think the only possible argument against this would be performance -
if getcontext was significantly slower than setjmp.  It that proves to
be the case, we should revisit this.)

** Capping RBS base for non-main threads

Somewhere else along the way, I hit a problem in GC, involving the RBS
stack of a non-main thread.  The problem was, in
SCM_MARK_BACKING_STORE, that scm_ia64_register_backing_store_base was
returning a value that was massively greater than the value of
scm_ia64_ar_bsp, leading to a seg fault.  This is because the
implementation of scm_ia64_register_backing_store_base is only valid
for the main thread.  I couldn't find a neat way of getting the true
RBS base of a non-main thread, but one idea is simply to call
scm_ia64_ar_bsp when guilifying a thread, and use the value returned
as an upper bound for that thread's RBS base.  (Note that the RBS
stack grows upwards.)

(Were it not for scm_init_guile, we could be much more definitive
about this.  We could take the value of scm_ia64_ar_bsp as a
definitive base address for the part of the RBS stack that Guile cares
about.  We could also then discard
scm_ia64_register_backing_store_base.)
---
 libguile/ChangeLog       |   35 +++++++++++++++++++++++++++
 libguile/__scm.h         |   18 +++++++++++++-
 libguile/continuations.c |   58 +++++++++++++++++++++------------------------
 libguile/continuations.h |    2 -
 libguile/threads.c       |   20 ++++++++++++++-
 libguile/threads.h       |    5 ++++
 libguile/throw.c         |    6 ++++
 7 files changed, 108 insertions(+), 36 deletions(-)

diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 28c439b..58dd248 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,38 @@
+2008-05-08  Neil Jerram  <neil@ossau.uklinux.net>
+
+	* throw.c (scm_ithrow): For IA64 add a return statement, to
+	appease GCC.
+
+	* threads.h (scm_i_thread): New IA64 fields:
+	register_backing_store_base and pending_rbs_continuation.
+
+	* threads.c (guilify_self_1): For IA64: cap RBS base address at
+	the current value of scm_ia64_ar_bsp, and store the capped value
+	in thread state.
+	(SCM_MARK_BACKING_STORE): Use thread->register_backing_store_base
+	instead of scm_ia64_register_backing_store_base().
+	(scm_threads_mark_stacks): Add "&" in "&t->regs", so that the code
+	works both for jmp_buf defined as an array, and jmp_buf defined as
+	a struct.
+
+	* continuations.h (scm_t_contregs): Remove `fresh' and `ctx'
+	fields; these are now inside the IA64 definition of `jmp_buf'.
+
+	* continuations.c (scm_make_continuation): Simplify, by moving
+	some of the IA64 code inside the definition of "setjmp", and by
+	some obvious commonizations.  For IA64 register backing store
+	(RBS) stack base, use thread->register_backing_store_base instead
+	of scm_ia64_register_backing_store_base().
+	(copy_stack): For IA64, store pointer to continuation being
+	invoked in thread state, so we can restore the continuation's RBS
+	stack just before the next setcontext call.
+	(copy_stack_and_call): Don't restore RBS stack explicitly here.
+	It will be restored, if appropriate, inside the longjmp call.
+	(scm_ia64_longjmp): New function.
+
+	* __scm.h (setjmp, longjmp, jmp_buf): For IA64, implement using
+	getcontext and setcontext.
+
 2008-02-16  Ludovic Courtès  <ludo@gnu.org>
 
 	* gc_os_dep.c: Add NetBSD/alpha support.  Patch by Greg Troxel
diff --git a/libguile/__scm.h b/libguile/__scm.h
index 3d6d9a7..b198f9d 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -402,7 +402,23 @@
 #  define setjmp setjump
 #  define longjmp longjump
 # else				/* ndef _CRAY1 */
-#  include <setjmp.h>
+#  if defined (__ia64__)
+/* For IA64, emulate the setjmp API using getcontext. */
+#   include <signal.h>
+#   include <ucontext.h>
+    typedef struct {
+      ucontext_t ctx;
+      int fresh;
+    } jmp_buf;
+#   define setjmp(JB)				        \
+      ( (JB).fresh = 1,				        \
+        getcontext (&((JB).ctx)),			\
+        ((JB).fresh ? ((JB).fresh = 0, 0) : 1) )
+#   define longjmp(JB,VAL) scm_ia64_longjmp (&(JB), VAL)
+    void scm_ia64_longjmp (jmp_buf *, int);
+#  else                 	/* ndef __ia64__ */
+#   include <setjmp.h>
+#  endif			/* ndef __ia64__ */
 # endif				/* ndef _CRAY1 */
 #endif				/* ndef vms */
 
diff --git a/libguile/continuations.c b/libguile/continuations.c
index 39785a5..80a2790 100644
--- a/libguile/continuations.c
+++ b/libguile/continuations.c
@@ -124,47 +124,30 @@ scm_make_continuation (int *first)
   continuation->offset = continuation->stack - src;
   memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size);
 
-#ifdef __ia64__
-  continuation->fresh = 1;
-  getcontext (&continuation->ctx);
-  if (continuation->fresh)
+  *first = !setjmp (continuation->jmpbuf);
+  if (*first)
     {
+#ifdef __ia64__
       continuation->backing_store_size =
-	(char *) scm_ia64_ar_bsp(&continuation->ctx)
+	(char *) scm_ia64_ar_bsp(&continuation->jmpbuf.ctx)
 	-
-	(char *) scm_ia64_register_backing_store_base ();
+	(char *) thread->register_backing_store_base;
       continuation->backing_store = NULL;
       continuation->backing_store = 
         scm_gc_malloc (continuation->backing_store_size,
 		       "continuation backing store");
       memcpy (continuation->backing_store, 
-              (void *) scm_ia64_register_backing_store_base (), 
+              (void *) thread->register_backing_store_base, 
               continuation->backing_store_size);
-      *first = 1;
-      continuation->fresh = 0;
+#endif /* __ia64__ */
       return cont;
     }
   else
     {
       SCM ret = continuation->throw_value;
-      *first = 0;
       continuation->throw_value = SCM_BOOL_F;
       return ret;
     }
-#else /* !__ia64__ */
-  if (setjmp (continuation->jmpbuf))
-    {
-      SCM ret = continuation->throw_value;
-      *first = 0;
-      continuation->throw_value = SCM_BOOL_F;
-      return ret;
-    }
-  else
-    {
-      *first = 1;
-      return cont;
-    }
-#endif /* !__ia64__ */
 }
 #undef FUNC_NAME
 
@@ -218,6 +201,9 @@ copy_stack (void *data)
   copy_stack_data *d = (copy_stack_data *)data;
   memcpy (d->dst, d->continuation->stack,
 	  sizeof (SCM_STACKITEM) * d->continuation->num_stack_items);
+#ifdef __ia64__
+  SCM_I_CURRENT_THREAD->pending_rbs_continuation = d->continuation;
+#endif
 }
 
 static void
@@ -235,16 +221,26 @@ copy_stack_and_call (scm_t_contregs *continuation, SCM val,
   scm_i_set_last_debug_frame (continuation->dframe);
 
   continuation->throw_value = val;
-#ifdef __ia64__
-  memcpy (scm_ia64_register_backing_store_base (),
-          continuation->backing_store,
-          continuation->backing_store_size);
-  setcontext (&continuation->ctx);
-#else
   longjmp (continuation->jmpbuf, 1);
-#endif
 }
 
+#ifdef __ia64__
+void
+scm_ia64_longjmp (jmp_buf *JB, int VAL)
+{
+  scm_i_thread *t = SCM_I_CURRENT_THREAD;
+
+  if (t->pending_rbs_continuation)
+    {
+      memcpy (t->register_backing_store_base,
+	      t->pending_rbs_continuation->backing_store,
+	      t->pending_rbs_continuation->backing_store_size);
+      t->pending_rbs_continuation = NULL;
+    }
+  setcontext (&JB->ctx);
+}
+#endif
+
 /* Call grow_stack until the stack space is large enough, then, as the current
  * stack frame might get overwritten, let copy_stack_and_call perform the
  * actual copying and continuation calling.
diff --git a/libguile/continuations.h b/libguile/continuations.h
index 0274c1b..f6fb96a 100644
--- a/libguile/continuations.h
+++ b/libguile/continuations.h
@@ -46,8 +46,6 @@ typedef struct
   jmp_buf jmpbuf;
   SCM dynenv;
 #ifdef __ia64__
-  ucontext_t ctx;
-  int fresh;
   void *backing_store;
   unsigned long backing_store_size;
 #endif /* __ia64__ */
diff --git a/libguile/threads.c b/libguile/threads.c
index 858a1eb..609fc99 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -423,6 +423,22 @@ guilify_self_1 (SCM_STACKITEM *base)
   t->pending_asyncs = 1;
   t->last_debug_frame = NULL;
   t->base = base;
+#ifdef __ia64__
+  /* Calculate and store off the base of this thread's register
+     backing store (RBS).  Unfortunately our implementation(s) of
+     scm_ia64_register_backing_store_base are only reliable for the
+     main thread.  For other threads, therefore, find out the current
+     top of the RBS, and use that as a maximum. */
+  t->register_backing_store_base = scm_ia64_register_backing_store_base ();
+  {
+    ucontext_t ctx;
+    void *bsp;
+    getcontext (&ctx);
+    bsp = scm_ia64_ar_bsp (&ctx);
+    if (t->register_backing_store_base > bsp)
+      t->register_backing_store_base = bsp;
+  }
+#endif
   t->continuation_root = SCM_EOL;
   t->continuation_base = base;
   scm_i_pthread_cond_init (&t->sleep_cond, NULL);
@@ -1350,7 +1366,7 @@ SCM_DEFINE (scm_broadcast_condition_variable, "broadcast-condition-variable", 1,
     scm_mark_locations ((SCM_STACKITEM *) &ctx.uc_mcontext,           \
       ((size_t) (sizeof (SCM_STACKITEM) - 1 + sizeof ctx.uc_mcontext) \
        / sizeof (SCM_STACKITEM)));                                    \
-    bot = (SCM_STACKITEM *) scm_ia64_register_backing_store_base ();  \
+    bot = (SCM_STACKITEM *) SCM_I_CURRENT_THREAD->register_backing_store_base;  \
     top = (SCM_STACKITEM *) scm_ia64_ar_bsp (&ctx);                   \
     scm_mark_locations (bot, top - bot); } while (0)
 #else
@@ -1374,7 +1390,7 @@ scm_threads_mark_stacks (void)
 #else
       scm_mark_locations (t->top, t->base - t->top);
 #endif
-      scm_mark_locations ((SCM_STACKITEM *) t->regs,
+      scm_mark_locations ((SCM_STACKITEM *) &t->regs,
 			  ((size_t) sizeof(t->regs)
 			   / sizeof (SCM_STACKITEM)));
     }
diff --git a/libguile/threads.h b/libguile/threads.h
index 09939b0..d58a0fb 100644
--- a/libguile/threads.h
+++ b/libguile/threads.h
@@ -28,6 +28,7 @@
 #include "libguile/root.h"
 #include "libguile/iselect.h"
 #include "libguile/dynwind.h"
+#include "libguile/continuations.h"
 
 #if SCM_USE_PTHREAD_THREADS
 #include "libguile/pthread-threads.h"
@@ -107,6 +108,10 @@ typedef struct scm_i_thread {
   SCM_STACKITEM *base;
   SCM_STACKITEM *top;
   jmp_buf regs;
+#ifdef __ia64__
+  void *register_backing_store_base;
+  scm_t_contregs *pending_rbs_continuation;
+#endif
 
 } scm_i_thread;
 
diff --git a/libguile/throw.c b/libguile/throw.c
index 1c25463..119d0bd 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -824,6 +824,12 @@ scm_ithrow (SCM key, SCM args, int noreturn SCM_UNUSED)
   /* Otherwise, it's some random piece of junk.  */
   else
     abort ();
+
+#ifdef __ia64__
+  /* On IA64, we #define longjmp as setcontext, and GCC appears not to
+     know that that doesn't return. */
+  return SCM_UNSPECIFIED;
+#endif
 }
 
 
-- 
1.5.4.2






^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-07 23:46 [PATCH] Fix continuation problems on IA64 Neil Jerram
@ 2008-05-08 20:09 ` Ludovic Courtès
  2008-05-08 21:29   ` Neil Jerram
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-08 20:09 UTC (permalink / raw)
  To: guile-devel

Hi Neil,

Neil Jerram <neil@ossau.uklinux.net> writes:

> FYI, I finally fixed some problems on IA64 that have been outstanding
> for ages (at least about 2 years).  Following is a big spiel about it,
> and the actual patch (against 1.8.4 release).  If anyone has any
> comments or questions, please let me know.  (And if not, I'll commit
> in a couple of days' time.)

Thanks a lot for fixing this!  It just missed 1.8.5 my a few hours (my
fault).  Hopefully distributions will apply the patch by themselves
until we release a new version...

Thanks also for the nice explanation.  I must confess I didn't grasp
everything (especially since I'm not familiar with IA64 and its RBS
thing), but I'm confident you did the right thing.  ;-)

> +	* threads.h (scm_i_thread): New IA64 fields:
> +	register_backing_store_base and pending_rbs_continuation.

This breaks ABI compatibility on IA64, but if Guile wasn't usable on
IA64 (was it?) that's probably not a problem.

> +    void scm_ia64_longjmp (jmp_buf *, int);

Add `SCM_API' at the beginning and `SCM_NORETURN' at the end.  The
latter should fix this:

> +#ifdef __ia64__
> +  /* On IA64, we #define longjmp as setcontext, and GCC appears not to
> +     know that that doesn't return. */
> +  return SCM_UNSPECIFIED;
> +#endif


Thanks!

Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-08 20:09 ` Ludovic Courtès
@ 2008-05-08 21:29   ` Neil Jerram
  2008-05-09  8:15     ` Ludovic Courtès
  2008-05-12 22:18     ` [PATCH] Fix continuation problems on IA64 Neil Jerram
  0 siblings, 2 replies; 33+ messages in thread
From: Neil Jerram @ 2008-05-08 21:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Hi Neil,
>
> Neil Jerram <neil@ossau.uklinux.net> writes:
>
>> FYI, I finally fixed some problems on IA64 that have been outstanding
>> for ages (at least about 2 years).  Following is a big spiel about it,
>> and the actual patch (against 1.8.4 release).  If anyone has any
>> comments or questions, please let me know.  (And if not, I'll commit
>> in a couple of days' time.)
>
> Thanks a lot for fixing this!  It just missed 1.8.5 my a few hours (my
> fault).

Huh?  How can that have been your fault?

>  Hopefully distributions will apply the patch by themselves
> until we release a new version...

Yes, I'll forward it to Debian (who reported it) at least, once it's
committed.

> Thanks also for the nice explanation.  I must confess I didn't grasp
> everything (especially since I'm not familiar with IA64 and its RBS
> thing), but I'm confident you did the right thing.  ;-)
>
>> +	* threads.h (scm_i_thread): New IA64 fields:
>> +	register_backing_store_base and pending_rbs_continuation.
>
> This breaks ABI compatibility on IA64, but if Guile wasn't usable on
> IA64 (was it?) that's probably not a problem.

Good point, and I don't think it was completely unusable before, so
this could be an issue.  The problems were sufficient to break
Lilypond on IA64, but many simpler programs could have been fine.

Who is ABI compatibility an issue for?  If it's only the distros,
we're probably OK, as I believe they won't have promoted something
that failed "make check".

For people building their own Guile libs, can we cover this by a
sentence in the next release notes, to say that programs using
scm_i_thread should be recompiled?

>> +    void scm_ia64_longjmp (jmp_buf *, int);
>
> Add `SCM_API' at the beginning and `SCM_NORETURN' at the end.  The
> latter should fix this:
>
>> +#ifdef __ia64__
>> +  /* On IA64, we #define longjmp as setcontext, and GCC appears not to
>> +     know that that doesn't return. */
>> +  return SCM_UNSPECIFIED;
>> +#endif

I'm happy with adding SCM_NORETURN; but why the SCM_API?  I don't
think a libguile application should call scm_ia64_longjmp itself, so
do not intend to document it.

Thanks for your comments!

Regards,
     Neil





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-08 21:29   ` Neil Jerram
@ 2008-05-09  8:15     ` Ludovic Courtès
  2008-05-09 22:19       ` Neil Jerram
  2008-05-12 22:18     ` [PATCH] Fix continuation problems on IA64 Neil Jerram
  1 sibling, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-09  8:15 UTC (permalink / raw)
  To: guile-devel

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> ludo@gnu.org (Ludovic Courtès) writes:

>> This breaks ABI compatibility on IA64, but if Guile wasn't usable on
>> IA64 (was it?) that's probably not a problem.
>
> Good point, and I don't think it was completely unusable before, so
> this could be an issue.  The problems were sufficient to break
> Lilypond on IA64, but many simpler programs could have been fine.
>
> Who is ABI compatibility an issue for?  If it's only the distros,
> we're probably OK, as I believe they won't have promoted something
> that failed "make check".

If we change the ABI, we should increase `LIBGUILE_INTERFACE_CURRENT'
and set `AGE' to zero because it's not going to be
backward-compatible---and we can't do that only for IA64,
unfortunately...

> For people building their own Guile libs, can we cover this by a
> sentence in the next release notes, to say that programs using
> scm_i_thread should be recompiled?

Programs necessarily access it, through `SCM_I_CURRENT_THREAD', etc.

> I'm happy with adding SCM_NORETURN; but why the SCM_API?  I don't
> think a libguile application should call scm_ia64_longjmp itself, so
> do not intend to document it.

Right, but `SCM_API' is just `extern' (except on Windows), which is
"normal" in such a declaration; and whether declared `extern' or not,
the symbol will be exported anyway.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-09  8:15     ` Ludovic Courtès
@ 2008-05-09 22:19       ` Neil Jerram
  2008-05-11  3:06         ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-05-09 22:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:

> If we change the ABI, we should increase `LIBGUILE_INTERFACE_CURRENT'
> and set `AGE' to zero because it's not going to be
> backward-compatible---and we can't do that only for IA64,
> unfortunately...

Agreed, but I'm not sure the ABI is really changing...

> Programs necessarily access it, through `SCM_I_CURRENT_THREAD', etc.

Yes, but only as a pointer, whose only practical use is to pass back
to other libguile functions.  That usage doesn't require
recompilation.

Usages which would require recompilation are

- accessing any particular fields in the scm_i_thread structure

- declaring a scm_i_thread on the stack

- allocating a scm_i_thread on the heap (or in general, anything
  involving "sizeof(scm_i_thread)").

In my view, all of these uses are unsupported, and I think it
incredibly unlikely that anyone has done any of them in practice.

Overall, then, I think we're OK to regard this as _not_ an ABI change.

> Right, but `SCM_API' is just `extern' (except on Windows), which is
> "normal" in such a declaration;

I disagree that it is "normal" always to put `extern' on function
prototypes.  It isn't needed (as I'm sure you know), and I'm sure I
could find lots of examples of projects that don't do it.

> and whether declared `extern' or not, the symbol will be exported
> anyway.

True (except on Windows), but in my view being exported doesn't make
something a supported API.

I haven't checked again just now, but I think I've seen other cases
where SCM_API is used on a prototype of a function that I would not
regard as a supported libguile API.  I dislike this, because the name
SCM_API clearly implies that the prototype concerned is an API!  I
definitely don't think that we should create more cases like this.

FWIW, my preferred position would be that something is only a
supported API if it is documented in the manual.  It should then
follow that SCM_API can only be used on something that is documented
in the manual (including anything that is needed for the expansions of
documented macros).

Regards,
     Neil





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-09 22:19       ` Neil Jerram
@ 2008-05-11  3:06         ` Ludovic Courtès
  2008-05-12 21:02           ` Neil Jerram
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-11  3:06 UTC (permalink / raw)
  To: guile-devel

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> If we change the ABI, we should increase `LIBGUILE_INTERFACE_CURRENT'
>> and set `AGE' to zero because it's not going to be
>> backward-compatible---and we can't do that only for IA64,
>> unfortunately...
>
> Agreed, but I'm not sure the ABI is really changing...

Hmm, indeed, `scm_i_thread' is publicly visible but no public macro or
inline function uses it, so it's probably safe to change it (maybe we
should have an "internal.h" header for such things?).

> Overall, then, I think we're OK to regard this as _not_ an ABI change.

Yes, you're right.

> I disagree that it is "normal" always to put `extern' on function
> prototypes.  It isn't needed (as I'm sure you know), and I'm sure I
> could find lots of examples of projects that don't do it.

Right, that's admittedly more a matter of taste (indeed, `extern' is
equivalent to no storage-class specifier per Paragraph 5, Section 6.2.2
of C99).

> I haven't checked again just now, but I think I've seen other cases
> where SCM_API is used on a prototype of a function that I would not
> regard as a supported libguile API.  I dislike this, because the name
> SCM_API clearly implies that the prototype concerned is an API!  I
> definitely don't think that we should create more cases like this.

I'm not a Windows expert, but I think the `SCM_API' is needed in some
cases, for instance for internal `scm_i_' functions that may be called
indirectly by user programs, e.g., through macros or inline functions.

So I suppose `SCM_API' is not needed Windows-wise for `scm_ia64_longjmp'
since it's only meant to be called from within libguile.

> FWIW, my preferred position would be that something is only a
> supported API if it is documented in the manual.  It should then
> follow that SCM_API can only be used on something that is documented
> in the manual (including anything that is needed for the expansions of
> documented macros).

Agreed.

I've been thinking about leveraging GCC's `visibility' attribute to
enforce this.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-11  3:06         ` Ludovic Courtès
@ 2008-05-12 21:02           ` Neil Jerram
  2008-05-14  3:45             ` Internal visibility Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-05-12 21:02 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:

> I'm not a Windows expert, but I think the `SCM_API' is needed in some
> cases, for instance for internal `scm_i_' functions that may be called
> indirectly by user programs, e.g., through macros or inline functions.

Yes, that's correct.  (Sadly :-) I have to use Windows for my work...)

> So I suppose `SCM_API' is not needed Windows-wise for `scm_ia64_longjmp'
> since it's only meant to be called from within libguile.

Yes, correct.

I believe that means we're agreed on all points now, so I'll commit
shortly.

>> FWIW, my preferred position would be that something is only a
>> supported API if it is documented in the manual.  It should then
>> follow that SCM_API can only be used on something that is documented
>> in the manual (including anything that is needed for the expansions of
>> documented macros).
>
> Agreed.
>
> I've been thinking about leveraging GCC's `visibility' attribute to
> enforce this.

That sounds like an excellent idea.  IIUC, that would have an effect
equivalent to the Windows expansion of SCM_API (__declspec(dllextn) or
whatever), and it would solve the problem (or rather inelegance) where
you have an "internal" function but which is used by more than one of
libguile's source files, and so can't be static.

Regards,
      Neil





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-08 21:29   ` Neil Jerram
  2008-05-09  8:15     ` Ludovic Courtès
@ 2008-05-12 22:18     ` Neil Jerram
  2008-05-14  2:55       ` Ludovic Courtès
  1 sibling, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-05-12 22:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>>> +    void scm_ia64_longjmp (jmp_buf *, int);
>>
>> Add `SCM_API' at the beginning and `SCM_NORETURN' at the end.  The
>> latter should fix this:
>>
>>> +#ifdef __ia64__
>>> +  /* On IA64, we #define longjmp as setcontext, and GCC appears not to
>>> +     know that that doesn't return. */
>>> +  return SCM_UNSPECIFIED;
>>> +#endif
>
> I'm happy with adding SCM_NORETURN [...]

Actually, I tried that, and then got GCC complaining that
"scm_ia64_longjmp: function does return" - which is wrong, but I guess
occurs because the declaration (in a system header file somewhere) of
setcontext() does _not_ have __attribute__(noreturn).

So I've committed for now without this SCM_NORETURN change - but I'm
happy to update it if there is a further solution.  Is there a way of
adding __attribute__(noreturn) to a declaration (from a system header
file) that should have this attribute, but doesn't?  Also, can it be
done in a way that will work for compilers other than GCC?

Thanks,
    Neil





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] Fix continuation problems on IA64.
  2008-05-12 22:18     ` [PATCH] Fix continuation problems on IA64 Neil Jerram
@ 2008-05-14  2:55       ` Ludovic Courtès
  0 siblings, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-14  2:55 UTC (permalink / raw)
  To: guile-devel

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> So I've committed for now without this SCM_NORETURN change - but I'm
> happy to update it if there is a further solution.  Is there a way of
> adding __attribute__(noreturn) to a declaration (from a system header
> file) that should have this attribute, but doesn't?

Not to my knowledge.

> Also, can it be done in a way that will work for compilers other than
> GCC?

I don't think so.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Internal visibility
  2008-05-12 21:02           ` Neil Jerram
@ 2008-05-14  3:45             ` Ludovic Courtès
  2008-05-27 21:32               ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-14  3:45 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> I believe that means we're agreed on all points now, so I'll commit
> shortly.

Yes, great.

> That sounds like an excellent idea.  IIUC, that would have an effect
> equivalent to the Windows expansion of SCM_API (__declspec(dllextn) or
> whatever), and it would solve the problem (or rather inelegance) where
> you have an "internal" function but which is used by more than one of
> libguile's source files, and so can't be static.

Yes, exactly:

  http://gcc.gnu.org/wiki/Visibility
  http://people.redhat.com/drepper/dsohowto.pdf

Your enthusiasm gave me an incentive to go ahead and try it out (see
attached patch against `master').  This brings the number of exported
`scm_i_' symbols (as seen with "objdump -T") down from 195 to 68 here,
which should slightly reduce load time since it gives less work to the
loader.  The patch also marks the `scm_init' functions as internal.  It
uses "internal" visibility, not just "hidden" (see "Function Attributes"
node of the GCC manual).

A few functions had to be left public: those used in public macros or
inlines, some functions of `numbers.c' that are used in `srfi-60', and
`scm_i_string_{writable_,}chars ()' functions which have been used
outside (e.g., in G-Wrap, IIRC) as they're too convenient...

I know Guile-VM uses a few internal functions/macros, so Andy will have
to check whether this breaks anything (and propose a new public API if
it does :-)).  It would be great to double-check with other code that
uses Guile.  Then if that looks acceptable, we can commit it, including
to the 1.8 branch.

Thanks,
Ludovic.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: The patch --]
[-- Type: text/x-patch, Size: 101295 bytes --]

From 62161c44a624171973c319436c547b55de0e92bf Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Wed, 14 May 2008 05:20:47 +0200
Subject: [PATCH] Add `SCM_INTERNAL' macro, use it.

---
 libguile/__scm.h                |    9 ++++
 libguile/alist.h                |    4 +-
 libguile/arbiters.h             |    4 +-
 libguile/async.h                |   13 +++---
 libguile/backtrace.h            |    7 ++-
 libguile/boolean.h              |    4 +-
 libguile/chars.h                |    4 +-
 libguile/continuations.h        |   17 ++++----
 libguile/coop-pthreads.h        |    4 +-
 libguile/debug-malloc.h         |    6 +-
 libguile/debug.h                |    6 +-
 libguile/deprecation.h          |    4 +-
 libguile/dynl.h                 |    4 +-
 libguile/dynwind.h              |    8 ++--
 libguile/environments.h         |    6 +-
 libguile/eq.h                   |    4 +-
 libguile/error.h                |    4 +-
 libguile/eval.h                 |   18 ++++----
 libguile/evalext.h              |    4 +-
 libguile/extensions.h           |    4 +-
 libguile/feature.h              |    4 +-
 libguile/filesys.h              |    4 +-
 libguile/fluids.h               |    8 ++--
 libguile/fports.h               |   10 ++--
 libguile/futures.h              |    4 +-
 libguile/gc.h                   |   10 ++--
 libguile/gdbint.h               |    4 +-
 libguile/gettext.h              |    6 +-
 libguile/goops.h                |    9 ++--
 libguile/gsubr.h                |    4 +-
 libguile/guardians.h            |   10 ++--
 libguile/hash.h                 |    4 +-
 libguile/hashtab.h              |   11 +++--
 libguile/hooks.h                |    4 +-
 libguile/i18n.h                 |    2 +-
 libguile/init.h                 |    6 +-
 libguile/ioext.h                |    4 +-
 libguile/keywords.h             |    4 +-
 libguile/lang.h                 |    4 +-
 libguile/list.h                 |    6 +-
 libguile/load.h                 |    6 +-
 libguile/macros.h               |    6 +-
 libguile/mallocs.h              |    4 +-
 libguile/modules.h              |    6 +-
 libguile/net_db.h               |    4 +-
 libguile/numbers.h              |   32 ++++++++--------
 libguile/objects.h              |   10 ++--
 libguile/objprop.h              |    4 +-
 libguile/options.h              |    4 +-
 libguile/pairs.h                |    2 +-
 libguile/ports.h                |   14 +++---
 libguile/posix.h                |    6 +-
 libguile/print.h                |    6 +-
 libguile/private-gc.h           |   78 ++++++++++++++++++++++-----------------
 libguile/procprop.h             |    6 +-
 libguile/procs.h                |    6 +-
 libguile/properties.h           |    4 +-
 libguile/ramap.h                |    4 +-
 libguile/random.h               |   10 ++--
 libguile/rdelim.h               |    4 +-
 libguile/read.h                 |    8 ++--
 libguile/regex-posix.h          |    4 +-
 libguile/root.h                 |    4 +-
 libguile/rw.h                   |    6 +-
 libguile/scmsigs.h              |   10 ++--
 libguile/script.h               |    4 +-
 libguile/simpos.h               |    4 +-
 libguile/socket.h               |    4 +-
 libguile/sort.h                 |    4 +-
 libguile/srcprop.h              |    4 +-
 libguile/srfi-13.h              |    6 +-
 libguile/srfi-14.h              |    6 +-
 libguile/srfi-4.h               |   12 +++---
 libguile/stackchk.h             |    4 +-
 libguile/stacks.h               |    4 +-
 libguile/stime.h                |    4 +-
 libguile/strings.h              |   60 +++++++++++++++---------------
 libguile/strorder.h             |    4 +-
 libguile/strports.h             |    4 +-
 libguile/struct.h               |    8 ++--
 libguile/symbols.h              |    8 ++--
 libguile/threads.h              |   24 ++++++------
 libguile/throw.h                |    4 +-
 libguile/unif.h                 |   10 ++--
 libguile/values.h               |    4 +-
 libguile/variable.h             |    6 +-
 libguile/vectors.h              |   10 ++--
 libguile/version.h.in           |    4 +-
 libguile/vports.h               |    4 +-
 libguile/weaks.h                |   14 +++---
 test-suite/standalone/test-gh.c |    2 +-
 91 files changed, 373 insertions(+), 349 deletions(-)

diff --git a/libguile/__scm.h b/libguile/__scm.h
index b198f9d..76b4448 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -97,6 +97,15 @@
 #define SCM_LIKELY(_expr)    SCM_EXPECT ((_expr), 1)
 #define SCM_UNLIKELY(_expr)  SCM_EXPECT ((_expr), 0)
 
+/* The SCM_INTERNAL macro makes it possible to explicitly declare a function
+ * as having "internal" linkage.  */
+#if (defined __GNUC__) && \
+  ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ == 3))
+# define SCM_INTERNAL  __attribute__ ((__visibility__ ("internal")))
+#else
+# define SCM_INTERNAL
+#endif
+
 
 \f
 /* {Supported Options}
diff --git a/libguile/alist.h b/libguile/alist.h
index 3d1784c..76cccba 100644
--- a/libguile/alist.h
+++ b/libguile/alist.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ALIST_H
 #define SCM_ALIST_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -42,7 +42,7 @@ SCM_API SCM scm_assoc_set_x (SCM alist, SCM key, SCM val);
 SCM_API SCM scm_assq_remove_x (SCM alist, SCM key);
 SCM_API SCM scm_assv_remove_x (SCM alist, SCM key);
 SCM_API SCM scm_assoc_remove_x (SCM alist, SCM key);
-SCM_API void scm_init_alist (void);
+SCM_INTERNAL void scm_init_alist (void);
 
 #endif  /* SCM_ALIST_H */
 
diff --git a/libguile/arbiters.h b/libguile/arbiters.h
index d042449..7a7dfd3 100644
--- a/libguile/arbiters.h
+++ b/libguile/arbiters.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ARBITERS_H
 #define SCM_ARBITERS_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,7 @@
 SCM_API SCM scm_make_arbiter (SCM name);
 SCM_API SCM scm_try_arbiter (SCM arb);
 SCM_API SCM scm_release_arbiter (SCM arb);
-SCM_API void scm_init_arbiters (void);
+SCM_INTERNAL void scm_init_arbiters (void);
 
 #endif  /* SCM_ARBITERS_H */
 
diff --git a/libguile/async.h b/libguile/async.h
index a81a98d..c01bde0 100644
--- a/libguile/async.h
+++ b/libguile/async.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ASYNC_H
 #define SCM_ASYNC_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,10 +38,11 @@ SCM_API SCM scm_async (SCM thunk);
 SCM_API SCM scm_async_mark (SCM a);
 SCM_API SCM scm_system_async_mark (SCM a);
 SCM_API SCM scm_system_async_mark_for_thread (SCM a, SCM thread);
-SCM_API void scm_i_queue_async_cell (SCM cell, scm_i_thread *);
-SCM_API int scm_i_setup_sleep (scm_i_thread *,
-			       SCM obj, scm_i_pthread_mutex_t *m, int fd);
-SCM_API void scm_i_reset_sleep (scm_i_thread *);
+SCM_INTERNAL void scm_i_queue_async_cell (SCM cell, scm_i_thread *);
+SCM_INTERNAL int scm_i_setup_sleep (scm_i_thread *,
+				    SCM obj, scm_i_pthread_mutex_t *m,
+				    int fd);
+SCM_INTERNAL void scm_i_reset_sleep (scm_i_thread *);
 SCM_API SCM scm_run_asyncs (SCM list_of_a);
 SCM_API SCM scm_noop (SCM args);
 SCM_API SCM scm_call_with_blocked_asyncs (SCM proc);
@@ -77,7 +78,7 @@ extern int scm_i_critical_section_level;
     scm_async_click ();	\
   } while (0)
 
-SCM_API void scm_init_async (void);
+SCM_INTERNAL void scm_init_async (void);
 
 #if (SCM_ENABLE_DEPRECATED == 1)
 
diff --git a/libguile/backtrace.h b/libguile/backtrace.h
index b4033de..e11cb85 100644
--- a/libguile/backtrace.h
+++ b/libguile/backtrace.h
@@ -3,7 +3,7 @@
 #ifndef SCM_BACKTRACE_H
 #define SCM_BACKTRACE_H
 
-/* Copyright (C) 1996,1998,1999,2000,2001, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1998,1999,2000,2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,8 @@
 SCM_API SCM scm_the_last_stack_fluid_var;
 
 SCM_API void scm_display_error_message (SCM message, SCM args, SCM port);
-SCM_API void scm_i_display_error (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest);
+SCM_INTERNAL void scm_i_display_error (SCM stack, SCM port, SCM subr,
+				       SCM message, SCM args, SCM rest);
 SCM_API SCM scm_display_error (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest);
 SCM_API SCM scm_display_application (SCM frame, SCM port, SCM indent);
 SCM_API SCM scm_display_backtrace (SCM stack, SCM port, SCM first, SCM depth);
@@ -38,7 +39,7 @@ SCM_API SCM scm_backtrace_with_highlights (SCM highlights);
 SCM_API SCM scm_set_print_params_x (SCM params);
 #endif
 
-SCM_API void scm_init_backtrace (void);
+SCM_INTERNAL void scm_init_backtrace (void);
 
 #endif  /* SCM_BACKTRACE_H */
 
diff --git a/libguile/boolean.h b/libguile/boolean.h
index 3dc82e1..1388c2f 100644
--- a/libguile/boolean.h
+++ b/libguile/boolean.h
@@ -3,7 +3,7 @@
 #ifndef SCM_BOOLEAN_H
 #define SCM_BOOLEAN_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -43,7 +43,7 @@ SCM_API int scm_to_bool (SCM x);
 SCM_API SCM scm_not (SCM x);
 SCM_API SCM scm_boolean_p (SCM obj);
 
-SCM_API void scm_init_boolean (void);
+SCM_INTERNAL void scm_init_boolean (void);
 
 #endif  /* SCM_BOOLEAN_H */
 
diff --git a/libguile/chars.h b/libguile/chars.h
index 1a139e9..97c611a 100644
--- a/libguile/chars.h
+++ b/libguile/chars.h
@@ -3,7 +3,7 @@
 #ifndef SCM_CHARS_H
 #define SCM_CHARS_H
 
-/* Copyright (C) 1995,1996,2000,2001,2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001,2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -62,7 +62,7 @@ SCM_API SCM scm_char_upcase (SCM chr);
 SCM_API SCM scm_char_downcase (SCM chr);
 SCM_API int scm_c_upcase (unsigned int c);
 SCM_API int scm_c_downcase (unsigned int c);
-SCM_API void scm_init_chars (void);
+SCM_INTERNAL void scm_init_chars (void);
 
 #endif  /* SCM_CHARS_H */
 
diff --git a/libguile/continuations.h b/libguile/continuations.h
index f6fb96a..1a648dd 100644
--- a/libguile/continuations.h
+++ b/libguile/continuations.h
@@ -3,7 +3,7 @@
 #ifndef SCM_CONTINUATIONS_H
 #define SCM_CONTINUATIONS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -90,14 +90,15 @@ SCM_API SCM scm_make_continuation (int *first);
 SCM_API void *scm_c_with_continuation_barrier (void *(*func)(void*), void *);
 SCM_API SCM scm_with_continuation_barrier (SCM proc);
 
-SCM_API SCM scm_i_with_continuation_barrier (scm_t_catch_body body,
-					     void *body_data,
-					     scm_t_catch_handler handler,
-					     void *handler_data,
-					     scm_t_catch_handler pre_unwind_handler,
-					     void *pre_unwind_handler_data);
+SCM_INTERNAL SCM
+scm_i_with_continuation_barrier (scm_t_catch_body body,
+				 void *body_data,
+				 scm_t_catch_handler handler,
+				 void *handler_data,
+				 scm_t_catch_handler pre_unwind_handler,
+				 void *pre_unwind_handler_data);
 
-SCM_API void scm_init_continuations (void);
+SCM_INTERNAL void scm_init_continuations (void);
 
 #endif  /* SCM_CONTINUATIONS_H */
 
diff --git a/libguile/coop-pthreads.h b/libguile/coop-pthreads.h
index 9134874..cc1f75a 100644
--- a/libguile/coop-pthreads.h
+++ b/libguile/coop-pthreads.h
@@ -3,7 +3,7 @@
 #ifndef SCM_COOP_PTHREADS_H
 #define SCM_COOP_PTHREADS_H
 
-/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -70,7 +70,7 @@ SCM_API int scm_i_switch_counter;
 #define SCM_SET_THREAD_LOCAL_DATA(ptr) (scm_i_copt_set_thread_data (ptr))
 
 SCM_API void *scm_i_copt_thread_data;
-SCM_API void scm_i_copt_set_thread_data (void *data);
+SCM_INTERNAL void scm_i_copt_set_thread_data (void *data);
 
 #endif  /* SCM_COOP_PTHREAD_H */
 
diff --git a/libguile/debug-malloc.h b/libguile/debug-malloc.h
index 444f06d..1aa5221 100644
--- a/libguile/debug-malloc.h
+++ b/libguile/debug-malloc.h
@@ -3,7 +3,7 @@
 #ifndef SCM_DEBUG_MALLOC_H
 #define SCM_DEBUG_MALLOC_H
 
-/* Copyright (C) 2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,8 +32,8 @@ SCM_API void scm_malloc_reregister (void *obj, void *new, const char *what);
 
 SCM_API SCM scm_malloc_stats (void);
 
-SCM_API void scm_debug_malloc_prehistory (void);
-SCM_API void scm_init_debug_malloc (void);
+SCM_INTERNAL void scm_debug_malloc_prehistory (void);
+SCM_INTERNAL void scm_init_debug_malloc (void);
 
 #endif  /* SCM_DEBUG_MALLOC_H */
 
diff --git a/libguile/debug.h b/libguile/debug.h
index 79afa4d..6077162 100644
--- a/libguile/debug.h
+++ b/libguile/debug.h
@@ -3,7 +3,7 @@
 #ifndef SCM_DEBUG_H
 #define SCM_DEBUG_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2004
+/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2004,2008
  * Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -150,8 +150,8 @@ SCM_API SCM scm_evaluator_traps (SCM setting);
 SCM_API SCM scm_debug_options (SCM setting);
 SCM_API SCM scm_make_debugobj (scm_t_debug_frame *debug);
 
-SCM_API SCM scm_i_unmemoize_expr (SCM memoized);
-SCM_API void scm_init_debug (void);
+SCM_INTERNAL SCM scm_i_unmemoize_expr (SCM memoized);
+SCM_INTERNAL void scm_init_debug (void);
 
 #ifdef GUILE_DEBUG
 SCM_API SCM scm_memcons (SCM car, SCM cdr, SCM env);
diff --git a/libguile/deprecation.h b/libguile/deprecation.h
index 53500ee..7885327 100644
--- a/libguile/deprecation.h
+++ b/libguile/deprecation.h
@@ -3,7 +3,7 @@
 #ifndef SCM_DEPRECATION_H
 #define SCM_DEPRECATION_H
 
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@ SCM_API SCM scm_issue_deprecation_warning (SCM msgs);
 #endif
 
 SCM_API SCM scm_include_deprecated_features (void);
-SCM_API void scm_init_deprecation (void);
+SCM_INTERNAL void scm_init_deprecation (void);
 
 #endif  /* SCM_DEPRECATION_H */
 
diff --git a/libguile/dynl.h b/libguile/dynl.h
index 6936afd..72dc92e 100644
--- a/libguile/dynl.h
+++ b/libguile/dynl.h
@@ -3,7 +3,7 @@
 #ifndef SCM_DYNL_H
 #define SCM_DYNL_H
 
-/* Copyright (C) 1996,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@ SCM_API SCM scm_dynamic_func (SCM symb, SCM dobj);
 SCM_API SCM scm_dynamic_call (SCM symb, SCM dobj);
 SCM_API SCM scm_dynamic_args_call (SCM symb, SCM dobj, SCM args);
 
-SCM_API void scm_init_dynamic_linking (void);
+SCM_INTERNAL void scm_init_dynamic_linking (void);
 
 #endif  /* SCM_DYNL_H */
 
diff --git a/libguile/dynwind.h b/libguile/dynwind.h
index 9e5390b..dd39dae 100644
--- a/libguile/dynwind.h
+++ b/libguile/dynwind.h
@@ -3,7 +3,7 @@
 #ifndef SCM_DYNWIND_H
 #define SCM_DYNWIND_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2003,2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2003,2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,9 +36,9 @@ SCM_API SCM scm_internal_dynamic_wind (scm_t_guard before,
 				       void *inner_data,
 				       void *guard_data);
 SCM_API void scm_dowinds (SCM to, long delta);
-SCM_API void scm_i_dowinds (SCM to, long delta,
-			    void (*turn_func) (void *), void *data);
-SCM_API void scm_init_dynwind (void);
+SCM_INTERNAL void scm_i_dowinds (SCM to, long delta,
+				 void (*turn_func) (void *), void *data);
+SCM_INTERNAL void scm_init_dynwind (void);
 
 SCM_API void scm_swap_bindings (SCM vars, SCM vals);
 
diff --git a/libguile/environments.h b/libguile/environments.h
index dd698b7..10d42a7 100644
--- a/libguile/environments.h
+++ b/libguile/environments.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ENVIRONMENTS_H
 #define SCM_ENVIRONMENTS_H
 
-/* Copyright (C) 1999,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -122,8 +122,8 @@ SCM_API SCM scm_environment_observe_weak (SCM env, SCM proc);
 SCM_API SCM scm_c_environment_observe (SCM env, scm_environment_observer proc, SCM data, int weak_p);
 SCM_API SCM scm_environment_unobserve (SCM token);
 
-SCM_API void scm_environments_prehistory (void);
-SCM_API void scm_init_environments (void);
+SCM_INTERNAL void scm_environments_prehistory (void);
+SCM_INTERNAL void scm_init_environments (void);
 
 \f
 
diff --git a/libguile/eq.h b/libguile/eq.h
index da5a71c..af6959f 100644
--- a/libguile/eq.h
+++ b/libguile/eq.h
@@ -3,7 +3,7 @@
 #ifndef SCM_EQ_H
 #define SCM_EQ_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,7 @@
 SCM_API SCM scm_eq_p (SCM x, SCM y);
 SCM_API SCM scm_eqv_p (SCM x, SCM y);
 SCM_API SCM scm_equal_p (SCM x, SCM y);
-SCM_API void scm_init_eq (void);
+SCM_INTERNAL void scm_init_eq (void);
 
 #endif  /* SCM_EQ_H */
 
diff --git a/libguile/error.h b/libguile/error.h
index 7ba0c4b..042fb4d 100644
--- a/libguile/error.h
+++ b/libguile/error.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ERROR_H
 #define SCM_ERROR_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -57,7 +57,7 @@ SCM_API void scm_wrong_type_arg_msg (const char *subr, int pos,
 SCM_API void scm_memory_error (const char *subr) SCM_NORETURN;
 SCM_API void scm_misc_error (const char *subr, const char *message,
 			     SCM args) SCM_NORETURN;
-SCM_API void scm_init_error (void);
+SCM_INTERNAL void scm_init_error (void);
 
 #endif  /* SCM_ERROR_H */
 
diff --git a/libguile/eval.h b/libguile/eval.h
index 247cf16..bf6279b 100644
--- a/libguile/eval.h
+++ b/libguile/eval.h
@@ -3,7 +3,7 @@
 #ifndef SCM_EVAL_H
 #define SCM_EVAL_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003,2004
+/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003,2004,2008
  * Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -152,7 +152,7 @@ SCM_API SCM scm_apply_0 (SCM proc, SCM args);
 SCM_API SCM scm_apply_1 (SCM proc, SCM arg1, SCM args);
 SCM_API SCM scm_apply_2 (SCM proc, SCM arg1, SCM arg2, SCM args);
 SCM_API SCM scm_apply_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM args);
-SCM_API SCM scm_i_call_closure_0 (SCM proc);
+SCM_INTERNAL SCM scm_i_call_closure_0 (SCM proc);
 SCM_API scm_t_trampoline_0 scm_trampoline_0 (SCM proc);
 SCM_API scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
 SCM_API scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
@@ -167,18 +167,18 @@ SCM_API SCM scm_force (SCM x);
 SCM_API SCM scm_promise_p (SCM x);
 SCM_API SCM scm_cons_source (SCM xorig, SCM x, SCM y);
 SCM_API SCM scm_copy_tree (SCM obj);
-SCM_API SCM scm_i_eval_x (SCM exp, SCM env);
-SCM_API SCM scm_i_eval (SCM exp, SCM env);
+SCM_API SCM scm_i_eval_x (SCM exp, SCM env) /* not internal */;
+SCM_INTERNAL SCM scm_i_eval (SCM exp, SCM env);
 SCM_API SCM scm_primitive_eval (SCM exp);
 SCM_API SCM scm_primitive_eval_x (SCM exp);
 SCM_API SCM scm_eval (SCM exp, SCM module);
 SCM_API SCM scm_eval_x (SCM exp, SCM module);
 
-SCM_API void scm_i_print_iloc (SCM /*iloc*/, SCM /*port*/);
-SCM_API void scm_i_print_isym (SCM /*isym*/, SCM /*port*/);
-SCM_API SCM scm_i_unmemocopy_expr (SCM expr, SCM env);
-SCM_API SCM scm_i_unmemocopy_body (SCM forms, SCM env);
-SCM_API void scm_init_eval (void);
+SCM_INTERNAL void scm_i_print_iloc (SCM /*iloc*/, SCM /*port*/);
+SCM_INTERNAL void scm_i_print_isym (SCM /*isym*/, SCM /*port*/);
+SCM_INTERNAL SCM scm_i_unmemocopy_expr (SCM expr, SCM env);
+SCM_INTERNAL SCM scm_i_unmemocopy_body (SCM forms, SCM env);
+SCM_INTERNAL void scm_init_eval (void);
 
 
 #if (SCM_ENABLE_DEPRECATED == 1)
diff --git a/libguile/evalext.h b/libguile/evalext.h
index e9b442e..a6a4a9f 100644
--- a/libguile/evalext.h
+++ b/libguile/evalext.h
@@ -3,7 +3,7 @@
 #ifndef SCM_EVALEXT_H
 #define SCM_EVALEXT_H
 
-/* Copyright (C) 1998,1999,2000, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2000, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@
 
 SCM_API SCM scm_defined_p (SCM sym, SCM env);
 SCM_API SCM scm_self_evaluating_p (SCM obj);
-SCM_API void scm_init_evalext (void);
+SCM_INTERNAL void scm_init_evalext (void);
 
 #if (SCM_ENABLE_DEPRECATED == 1)
 
diff --git a/libguile/extensions.h b/libguile/extensions.h
index 294dcad..596b43a 100644
--- a/libguile/extensions.h
+++ b/libguile/extensions.h
@@ -3,7 +3,7 @@
 #ifndef SCM_EXTENSIONS_H
 #define SCM_EXTENSIONS_H
 
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,7 @@ SCM_API void scm_c_register_extension (const char *lib, const char *init,
 SCM_API void scm_c_load_extension (const char *lib, const char *init);
 SCM_API SCM scm_load_extension (SCM lib, SCM init);
 
-SCM_API void scm_init_extensions (void);
+SCM_INTERNAL void scm_init_extensions (void);
 
 #endif  /* SCM_EXTENSIONS_H */
 
diff --git a/libguile/feature.h b/libguile/feature.h
index 9c61f8c..8c6371e 100644
--- a/libguile/feature.h
+++ b/libguile/feature.h
@@ -3,7 +3,7 @@
 #ifndef SCM_FEATURE_H
 #define SCM_FEATURE_H
 
-/* Copyright (C) 1995,1996,1999,2000,2001, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1999,2000,2001, 2006, 2007, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@ SCM_API void scm_add_feature (const char* str);
 SCM_API SCM scm_program_arguments (void);
 SCM_API void scm_set_program_arguments (int argc, char **argv, char *first);
 SCM_API SCM scm_set_program_arguments_scm (SCM lst);
-SCM_API void scm_init_feature (void);
+SCM_INTERNAL void scm_init_feature (void);
 
 #endif  /* SCM_FEATURE_H */
 
diff --git a/libguile/filesys.h b/libguile/filesys.h
index 6534da9..a38a5b5 100644
--- a/libguile/filesys.h
+++ b/libguile/filesys.h
@@ -3,7 +3,7 @@
 #ifndef SCM_FILESYS_H
 #define SCM_FILESYS_H
 
-/* Copyright (C) 1995,1997,1998,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -65,7 +65,7 @@ SCM_API SCM scm_copy_file (SCM oldfile, SCM newfile);
 SCM_API SCM scm_dirname (SCM filename);
 SCM_API SCM scm_basename (SCM filename, SCM suffix);
 
-SCM_API void scm_init_filesys (void);
+SCM_INTERNAL void scm_init_filesys (void);
 
 #endif  /* SCM_FILESYS_H */
 
diff --git a/libguile/fluids.h b/libguile/fluids.h
index cabce46..c48a8c3 100644
--- a/libguile/fluids.h
+++ b/libguile/fluids.h
@@ -3,7 +3,7 @@
 #ifndef SCM_FLUIDS_H
 #define SCM_FLUIDS_H
 
-/* Copyright (C) 1996,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -82,10 +82,10 @@ SCM_API void *scm_c_with_dynamic_state (SCM state,
 					void *(*func)(void *), void *data);
 SCM_API SCM scm_with_dynamic_state (SCM state, SCM proc);
 
-SCM_API SCM scm_i_make_initial_dynamic_state (void);
+SCM_INTERNAL SCM scm_i_make_initial_dynamic_state (void);
 
-SCM_API void scm_fluids_prehistory (void);
-SCM_API void scm_init_fluids (void);
+SCM_INTERNAL void scm_fluids_prehistory (void);
+SCM_INTERNAL void scm_init_fluids (void);
 
 #endif  /* SCM_FLUIDS_H */
 
diff --git a/libguile/fports.h b/libguile/fports.h
index 6341067..c737b1e 100644
--- a/libguile/fports.h
+++ b/libguile/fports.h
@@ -3,7 +3,7 @@
 #ifndef SCM_FPORTS_H
 #define SCM_FPORTS_H
 
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -53,13 +53,13 @@ SCM_API void scm_evict_ports (int fd);
 SCM_API SCM scm_open_file (SCM filename, SCM modes);
 SCM_API SCM scm_fdes_to_port (int fdes, char *mode, SCM name);
 SCM_API SCM scm_file_port_p (SCM obj);
-SCM_API void scm_init_fports (void);
+SCM_INTERNAL void scm_init_fports (void);
 
 /* internal functions */
 
-SCM_API SCM scm_i_fdes_to_port (int fdes, long mode_bits, SCM name);
-SCM_API int scm_i_fport_truncate (SCM, SCM);
-SCM_API SCM scm_i_fport_seek (SCM, SCM, int);
+SCM_INTERNAL SCM scm_i_fdes_to_port (int fdes, long mode_bits, SCM name);
+SCM_INTERNAL int scm_i_fport_truncate (SCM, SCM);
+SCM_INTERNAL SCM scm_i_fport_seek (SCM, SCM, int);
 
 
 #endif  /* SCM_FPORTS_H */
diff --git a/libguile/futures.h b/libguile/futures.h
index dffb38d..95916f3 100644
--- a/libguile/futures.h
+++ b/libguile/futures.h
@@ -3,7 +3,7 @@
 #ifndef SCM_FUTURES_H
 #define SCM_FUTURES_H
 
-/* Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -73,7 +73,7 @@ SCM_API scm_t_bits scm_tc16_future;
 
 extern SCM *scm_loc_sys_thread_handler;
 
-SCM_API SCM scm_i_make_future (SCM thunk);
+SCM_INTERNAL SCM scm_i_make_future (SCM thunk);
 SCM_API SCM scm_make_future (SCM thunk);
 SCM_API SCM scm_future_ref (SCM future);
 
diff --git a/libguile/gc.h b/libguile/gc.h
index d3c9959..05412bc 100644
--- a/libguile/gc.h
+++ b/libguile/gc.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GC_H
 #define SCM_GC_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -241,10 +241,10 @@ SCM_API int scm_debug_cells_gc_interval ;
 void scm_i_expensive_validation_check (SCM cell);
 #endif
 
-SCM_API scm_i_pthread_mutex_t scm_i_gc_admin_mutex;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_gc_admin_mutex;
 
 #define scm_gc_running_p (SCM_I_CURRENT_THREAD->gc_running_p)
-SCM_API scm_i_pthread_mutex_t scm_i_sweep_mutex;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_sweep_mutex;
 
 #ifdef __ia64__
 void *scm_ia64_register_backing_store_base (void);
@@ -320,7 +320,7 @@ SCM_API SCM scm_gc_live_object_stats (void);
 SCM_API SCM scm_gc (void);
 SCM_API void scm_gc_for_alloc (struct scm_t_cell_type_statistics *freelist);
 SCM_API SCM scm_gc_for_newcell (struct scm_t_cell_type_statistics *master, SCM *freelist);
-SCM_API void scm_i_gc (const char *what);
+SCM_INTERNAL void scm_i_gc (const char *what);
 SCM_API void scm_gc_mark (SCM p);
 SCM_API void scm_gc_mark_dependencies (SCM p);
 SCM_API void scm_mark_locations (SCM_STACKITEM x[], unsigned long n);
@@ -384,7 +384,7 @@ SCM_API void scm_gc_unregister_roots (SCM *b, unsigned long n);
 SCM_API void scm_storage_prehistory (void);
 SCM_API int scm_init_storage (void);
 SCM_API void *scm_get_stack_base (void);
-SCM_API void scm_init_gc (void);
+SCM_INTERNAL void scm_init_gc (void);
 
 #if SCM_ENABLE_DEPRECATED == 1
 
diff --git a/libguile/gdbint.h b/libguile/gdbint.h
index d6511f7..64b9559 100644
--- a/libguile/gdbint.h
+++ b/libguile/gdbint.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GDBINT_H
 #define SCM_GDBINT_H
 
-/* Copyright (C) 1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@
 
 SCM_API int scm_print_carefully_p;
 
-SCM_API void scm_init_gdbint (void);
+SCM_INTERNAL void scm_init_gdbint (void);
 
 #endif  /* SCM_GDBINT_H */
 
diff --git a/libguile/gettext.h b/libguile/gettext.h
index 4d91358..8a13307 100644
--- a/libguile/gettext.h
+++ b/libguile/gettext.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GETTEXT_H
 #define SCM_GETTEXT_H
 
-/* Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,9 +28,9 @@ SCM_API SCM scm_textdomain (SCM domainname);
 SCM_API SCM scm_bindtextdomain (SCM domainname, SCM directory);
 SCM_API SCM scm_bind_textdomain_codeset (SCM domainname, SCM encoding);
 
-SCM_API int scm_i_to_lc_category (SCM category, int allow_lc_all);
+SCM_INTERNAL int scm_i_to_lc_category (SCM category, int allow_lc_all);
 
-SCM_API void scm_init_gettext (void);
+SCM_INTERNAL void scm_init_gettext (void);
 
 #endif  /* SCM_GETTEXT_H */
 
diff --git a/libguile/goops.h b/libguile/goops.h
index 3fc8788..80ba985 100644
--- a/libguile/goops.h
+++ b/libguile/goops.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GOOPS_H
 #define SCM_GOOPS_H
 
-/* Copyright (C) 1998,1999,2000,2001,2002,2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2000,2001,2002,2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -254,7 +254,8 @@ SCM_API SCM scm_pure_generic_p (SCM obj);
 #endif
 
 SCM_API SCM scm_sys_compute_slots (SCM c);
-SCM_API SCM scm_i_get_keyword (SCM key, SCM l, long len, SCM default_value, const char *subr);
+SCM_INTERNAL SCM scm_i_get_keyword (SCM key, SCM l, long len,
+				    SCM default_value, const char *subr);
 SCM_API SCM scm_get_keyword (SCM key, SCM l, SCM default_value);
 SCM_API SCM scm_sys_initialize_object (SCM obj, SCM initargs);
 SCM_API SCM scm_sys_prep_layout_x (SCM c);
@@ -297,8 +298,8 @@ SCM_API SCM scm_make (SCM args);
 SCM_API SCM scm_find_method (SCM args);
 SCM_API SCM scm_sys_method_more_specific_p (SCM m1, SCM m2, SCM targs);
 
-SCM_API SCM scm_init_goops_builtins (void);
-SCM_API void scm_init_goops (void);
+SCM_INTERNAL SCM scm_init_goops_builtins (void);
+SCM_INTERNAL void scm_init_goops (void);
 
 #if (SCM_ENABLE_DEPRECATED == 1)
 
diff --git a/libguile/gsubr.h b/libguile/gsubr.h
index e748805..4185649 100644
--- a/libguile/gsubr.h
+++ b/libguile/gsubr.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GSUBR_H
 #define SCM_GSUBR_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -51,7 +51,7 @@ SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
 					     SCM (*fcn) (), SCM *gf);
 
 SCM_API SCM scm_gsubr_apply (SCM args);
-SCM_API void scm_init_gsubr (void);
+SCM_INTERNAL void scm_init_gsubr (void);
 
 #endif  /* SCM_GSUBR_H */
 
diff --git a/libguile/guardians.h b/libguile/guardians.h
index 735f960..295092e 100644
--- a/libguile/guardians.h
+++ b/libguile/guardians.h
@@ -3,7 +3,7 @@
 #ifndef SCM_GUARDIANS_H
 #define SCM_GUARDIANS_H
 
-/* Copyright (C) 1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,11 +26,11 @@
 
 SCM_API SCM scm_make_guardian (void);
 
-SCM_API void scm_i_init_guardians_for_gc (void);
-SCM_API void scm_i_identify_inaccessible_guardeds (void);
-SCM_API int scm_i_mark_inaccessible_guardeds (void);
+SCM_INTERNAL void scm_i_init_guardians_for_gc (void);
+SCM_INTERNAL void scm_i_identify_inaccessible_guardeds (void);
+SCM_INTERNAL int scm_i_mark_inaccessible_guardeds (void);
 
-SCM_API void scm_init_guardians (void);
+SCM_INTERNAL void scm_init_guardians (void);
 
 #endif  /* SCM_GUARDIANS_H */
 
diff --git a/libguile/hash.h b/libguile/hash.h
index a2d00c2..bbf9b25 100644
--- a/libguile/hash.h
+++ b/libguile/hash.h
@@ -3,7 +3,7 @@
 #ifndef SCM_HASH_H
 #define SCM_HASH_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@ SCM_API unsigned long scm_ihashv (SCM obj, unsigned long n);
 SCM_API SCM scm_hashv (SCM obj, SCM n);
 SCM_API unsigned long scm_ihash (SCM obj, unsigned long n);
 SCM_API SCM scm_hash (SCM obj, SCM n);
-SCM_API void scm_init_hash (void);
+SCM_INTERNAL void scm_init_hash (void);
 
 #endif  /* SCM_HASH_H */
 
diff --git a/libguile/hashtab.h b/libguile/hashtab.h
index 1017354..4220b86 100644
--- a/libguile/hashtab.h
+++ b/libguile/hashtab.h
@@ -3,7 +3,7 @@
 #ifndef SCM_HASHTAB_H
 #define SCM_HASHTAB_H
 
-/* Copyright (C) 1995,1996,1999,2000,2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1999,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -96,8 +96,9 @@ SCM_API SCM scm_weak_key_hash_table_p (SCM h);
 SCM_API SCM scm_weak_value_hash_table_p (SCM h);
 SCM_API SCM scm_doubly_weak_hash_table_p (SCM h);
 
-SCM_API void scm_i_rehash (SCM table, unsigned long (*hash_fn)(), void *closure, const char*func_name);
-SCM_API void scm_i_scan_weak_hashtables (void);
+SCM_INTERNAL void scm_i_rehash (SCM table, unsigned long (*hash_fn)(),
+				void *closure, const char *func_name);
+SCM_INTERNAL void scm_i_scan_weak_hashtables (void);
 
 SCM_API SCM scm_hash_fn_get_handle (SCM table, SCM obj, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure);
 SCM_API SCM scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure);
@@ -132,8 +133,8 @@ SCM_API SCM scm_hash_fold (SCM proc, SCM init, SCM hash);
 SCM_API SCM scm_hash_for_each (SCM proc, SCM hash);
 SCM_API SCM scm_hash_for_each_handle (SCM proc, SCM hash);
 SCM_API SCM scm_hash_map_to_list (SCM proc, SCM hash);
-SCM_API void scm_hashtab_prehistory (void);
-SCM_API void scm_init_hashtab (void);
+SCM_INTERNAL void scm_hashtab_prehistory (void);
+SCM_INTERNAL void scm_init_hashtab (void);
 
 #endif  /* SCM_HASHTAB_H */
 
diff --git a/libguile/hooks.h b/libguile/hooks.h
index 69972c3..49ea553 100644
--- a/libguile/hooks.h
+++ b/libguile/hooks.h
@@ -3,7 +3,7 @@
 #ifndef SCM_HOOKS_H
 #define SCM_HOOKS_H
 
-/* Copyright (C) 1995,1996,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -87,7 +87,7 @@ SCM_API SCM scm_reset_hook_x (SCM hook);
 SCM_API SCM scm_run_hook (SCM hook, SCM args);
 SCM_API void scm_c_run_hook (SCM hook, SCM args);
 SCM_API SCM scm_hook_to_list (SCM hook);
-SCM_API void scm_init_hooks (void);
+SCM_INTERNAL void scm_init_hooks (void);
 
 #endif  /* SCM_HOOKS_H */
 
diff --git a/libguile/i18n.h b/libguile/i18n.h
index 17dc240..57f1654 100644
--- a/libguile/i18n.h
+++ b/libguile/i18n.h
@@ -3,7 +3,7 @@
 #ifndef SCM_I18N_H
 #define SCM_I18N_H
 
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/libguile/init.h b/libguile/init.h
index ec083da..3ae27d8 100644
--- a/libguile/init.h
+++ b/libguile/init.h
@@ -3,7 +3,7 @@
 #ifndef SCM_INIT_H
 #define SCM_INIT_H
 
-/* Copyright (C) 1995,1996,1997,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@
 #include "libguile/threads.h"
 
 \f
-SCM_API scm_i_pthread_mutex_t scm_i_init_mutex;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_init_mutex;
 SCM_API int scm_initialized_p;
 
 SCM_API void scm_init_guile (void);
@@ -37,7 +37,7 @@ SCM_API void scm_boot_guile (int argc, char **argv,
 						char **argv),
 			     void *closure);
 
-SCM_API void scm_i_init_guile (SCM_STACKITEM *base);
+SCM_INTERNAL void scm_i_init_guile (SCM_STACKITEM *base);
 
 SCM_API void scm_load_startup_files (void);
 
diff --git a/libguile/ioext.h b/libguile/ioext.h
index 7ced2af..18289ea 100644
--- a/libguile/ioext.h
+++ b/libguile/ioext.h
@@ -3,7 +3,7 @@
 #ifndef SCM_IOEXT_H
 #define SCM_IOEXT_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@ SCM_API SCM scm_isatty_p (SCM port);
 SCM_API SCM scm_fdopen (SCM fdes, SCM modes);
 SCM_API SCM scm_primitive_move_to_fdes (SCM port, SCM fd);
 SCM_API SCM scm_fdes_to_ports (SCM fd);
-SCM_API void scm_init_ioext (void);
+SCM_INTERNAL void scm_init_ioext (void);
 
 #endif  /* SCM_IOEXT_H */
 
diff --git a/libguile/keywords.h b/libguile/keywords.h
index d11c0e3..a80e31b 100644
--- a/libguile/keywords.h
+++ b/libguile/keywords.h
@@ -3,7 +3,7 @@
 #ifndef SCM_KEYWORDS_H
 #define SCM_KEYWORDS_H
 
-/* Copyright (C) 1995,1996,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@ SCM_API int scm_is_keyword (SCM val);
 SCM_API SCM scm_from_locale_keyword (const char *str);
 SCM_API SCM scm_from_locale_keywordn (const char *str, size_t len);
 
-SCM_API void scm_init_keywords (void);
+SCM_INTERNAL void scm_init_keywords (void);
 
 #endif  /* SCM_KEYWORDS_H */
 
diff --git a/libguile/lang.h b/libguile/lang.h
index 886bb34..991e9ca 100644
--- a/libguile/lang.h
+++ b/libguile/lang.h
@@ -3,7 +3,7 @@
 #ifndef SCM_LANG_H
 #define SCM_LANG_H
 
-/* Copyright (C) 1998, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 
 #define SCM_NILP(x) (scm_is_eq ((x), SCM_ELISP_NIL))
 
-SCM_API void scm_init_lang (void);
+SCM_INTERNAL void scm_init_lang (void);
 
 #else  /* ! SCM_ENABLE_ELISP */
 
diff --git a/libguile/list.h b/libguile/list.h
index 749e65d..733432d 100644
--- a/libguile/list.h
+++ b/libguile/list.h
@@ -3,7 +3,7 @@
 #ifndef SCM_LIST_H
 #define SCM_LIST_H
 
-/* Copyright (C) 1995,1996,1997,2000,2001,2003,2004,2005,2006
+/* Copyright (C) 1995,1996,1997,2000,2001,2003,2004,2005,2006,2008
  * Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -71,8 +71,8 @@ SCM_API SCM scm_filter_x (SCM pred, SCM list);
 
 /* Guile internal functions */
 
-SCM_API SCM scm_i_finite_list_copy (SCM /* a list known to be finite */);
-SCM_API void scm_init_list (void);
+SCM_INTERNAL SCM scm_i_finite_list_copy (SCM /* a list known to be finite */);
+SCM_INTERNAL void scm_init_list (void);
 
 #endif  /* SCM_LIST_H */
 
diff --git a/libguile/load.h b/libguile/load.h
index 9b45d40..57cc7e8 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -3,7 +3,7 @@
 #ifndef SCM_LOAD_H
 #define SCM_LOAD_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,6 @@
 
 \f
 SCM_API SCM scm_parse_path (SCM path, SCM tail);
-SCM_API void scm_init_load_path (void);
 SCM_API SCM scm_primitive_load (SCM filename);
 SCM_API SCM scm_c_primitive_load (const char *filename);
 SCM_API SCM scm_sys_package_data_dir (void);
@@ -36,7 +35,8 @@ SCM_API SCM scm_search_path (SCM path, SCM filename, SCM exts);
 SCM_API SCM scm_sys_search_load_path (SCM filename);
 SCM_API SCM scm_primitive_load_path (SCM filename);
 SCM_API SCM scm_c_primitive_load_path (const char *filename);
-SCM_API void scm_init_load (void);
+SCM_INTERNAL void scm_init_load_path (void);
+SCM_INTERNAL void scm_init_load (void);
 
 #endif  /* SCM_LOAD_H */
 
diff --git a/libguile/macros.h b/libguile/macros.h
index 0ad8757..e1de77f 100644
--- a/libguile/macros.h
+++ b/libguile/macros.h
@@ -3,7 +3,7 @@
 #ifndef SCM_MACROS_H
 #define SCM_MACROS_H
 
-/* Copyright (C) 1998,2000,2001,2002,2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2001,2002,2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@
 
 SCM_API scm_t_bits scm_tc16_macro;
 
-SCM_API SCM scm_i_makbimacro (SCM code);
+SCM_INTERNAL SCM scm_i_makbimacro (SCM code);
 SCM_API SCM scm_makmmacro (SCM code);
 SCM_API SCM scm_makacro (SCM code);
 SCM_API SCM scm_macro_p (SCM obj);
@@ -46,7 +46,7 @@ SCM_API SCM scm_macro_transformer (SCM m);
 SCM_API SCM scm_make_synt (const char *name,
 			   SCM (*macroizer) (SCM),
 			   SCM (*fcn) ());
-SCM_API void scm_init_macros (void);
+SCM_INTERNAL void scm_init_macros (void);
 
 #if SCM_ENABLE_DEPRECATED == 1
 SCM_API SCM scm_makmacro (SCM code);
diff --git a/libguile/mallocs.h b/libguile/mallocs.h
index cae4d1f..f711ddb 100644
--- a/libguile/mallocs.h
+++ b/libguile/mallocs.h
@@ -3,7 +3,7 @@
 #ifndef SCM_MALLOCS_H
 #define SCM_MALLOCS_H
 
-/* Copyright (C) 1995,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@ SCM_API scm_t_bits scm_tc16_malloc;
 \f
 
 SCM_API SCM scm_malloc_obj (size_t n);
-SCM_API void scm_init_mallocs (void);
+SCM_INTERNAL void scm_init_mallocs (void);
 
 #endif  /* SCM_MALLOCS_H */
 
diff --git a/libguile/modules.h b/libguile/modules.h
index 6e4f4d9..afac9f4 100644
--- a/libguile/modules.h
+++ b/libguile/modules.h
@@ -3,7 +3,7 @@
 #ifndef SCM_MODULES_H
 #define SCM_MODULES_H
 
-/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -116,8 +116,8 @@ SCM_API SCM scm_env_module (SCM env);
 SCM_API SCM scm_top_level_env (SCM thunk);
 SCM_API SCM scm_system_module_env_p (SCM env);
 
-SCM_API void scm_modules_prehistory (void);
-SCM_API void scm_init_modules (void);
+SCM_INTERNAL void scm_modules_prehistory (void);
+SCM_INTERNAL void scm_init_modules (void);
 
 #endif  /* SCM_MODULES_H */
 
diff --git a/libguile/net_db.h b/libguile/net_db.h
index ae8e8aa..df1f030 100644
--- a/libguile/net_db.h
+++ b/libguile/net_db.h
@@ -3,7 +3,7 @@
 #ifndef SCM_NET_DB_H
 #define SCM_NET_DB_H
 
-/* Copyright (C) 1995,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@ SCM_API SCM scm_sethost (SCM arg);
 SCM_API SCM scm_setnet (SCM arg);
 SCM_API SCM scm_setproto (SCM arg);
 SCM_API SCM scm_setserv (SCM arg);
-SCM_API void scm_init_net_db (void);
+SCM_INTERNAL void scm_init_net_db (void);
 
 #endif  /* SCM_NET_DB_H */
 
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 2c2fdcf..e139dac 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -3,7 +3,7 @@
 #ifndef SCM_NUMBERS_H
 #define SCM_NUMBERS_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -261,15 +261,15 @@ SCM_API SCM scm_exp (SCM z);
 SCM_API SCM scm_sqrt (SCM z);
 
 /* bignum internal functions */
-SCM_API SCM scm_i_mkbig (void);
-SCM_API SCM scm_i_normbig (SCM x);
-SCM_API int scm_i_bigcmp (SCM a, SCM b);
-SCM_API SCM scm_i_dbl2big (double d);
-SCM_API SCM scm_i_dbl2num (double d);
-SCM_API double scm_i_big2dbl (SCM b);
-SCM_API SCM scm_i_long2big (long n);
-SCM_API SCM scm_i_ulong2big (unsigned long n);
-SCM_API SCM scm_i_clonebig (SCM src_big, int same_sign_p);
+SCM_INTERNAL SCM scm_i_mkbig (void);
+SCM_API /* FIXME: not internal */ SCM scm_i_normbig (SCM x);
+SCM_INTERNAL int scm_i_bigcmp (SCM a, SCM b);
+SCM_INTERNAL SCM scm_i_dbl2big (double d);
+SCM_INTERNAL SCM scm_i_dbl2num (double d);
+SCM_API /* FIXME: not internal */ double scm_i_big2dbl (SCM b);
+SCM_API /* FIXME: not internal */ SCM scm_i_long2big (long n);
+SCM_API /* FIXME: not internal */ SCM scm_i_ulong2big (unsigned long n);
+SCM_API /* FIXME: not internal */ SCM scm_i_clonebig (SCM src_big, int same_sign_p);
 
 /* ratio functions */
 SCM_API SCM scm_rationalize (SCM x, SCM err);
@@ -277,13 +277,13 @@ SCM_API SCM scm_numerator (SCM z);
 SCM_API SCM scm_denominator (SCM z);
 
 /* fraction internal functions */
-SCM_API double scm_i_fraction2double (SCM z);
-SCM_API SCM scm_i_fraction_equalp (SCM x, SCM y);
-SCM_API int scm_i_print_fraction (SCM sexp, SCM port, scm_print_state *pstate);
+SCM_INTERNAL double scm_i_fraction2double (SCM z);
+SCM_INTERNAL SCM scm_i_fraction_equalp (SCM x, SCM y);
+SCM_INTERNAL int scm_i_print_fraction (SCM sexp, SCM port, scm_print_state *pstate);
 
 /* general internal functions */
-SCM_API void scm_i_print_double (double val, SCM port);
-SCM_API void scm_i_print_complex (double real, double imag, SCM port);
+SCM_INTERNAL void scm_i_print_double (double val, SCM port);
+SCM_INTERNAL void scm_i_print_complex (double real, double imag, SCM port);
 
 /* conversion functions for integers */
 
@@ -480,7 +480,7 @@ SCM_API double scm_c_angle (SCM z);
 
 SCM_API int scm_is_number (SCM val);
 
-SCM_API void scm_init_numbers (void);
+SCM_INTERNAL void scm_init_numbers (void);
 
 #endif  /* SCM_NUMBERS_H */
 
diff --git a/libguile/objects.h b/libguile/objects.h
index fdd8e28..68996d2 100644
--- a/libguile/objects.h
+++ b/libguile/objects.h
@@ -3,7 +3,7 @@
 #ifndef SCM_OBJECTS_H
 #define SCM_OBJECTS_H
 
-/* Copyright (C) 1996,1999,2000,2001, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1999,2000,2001, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -181,7 +181,7 @@ SCM_API SCM scm_metaclass_operator;
 
 /* Goops functions. */
 SCM_API SCM scm_make_extended_class (char const *type_name, int applicablep);
-SCM_API void scm_i_inherit_applicable (SCM c);
+SCM_INTERNAL void scm_i_inherit_applicable (SCM c);
 SCM_API void scm_make_port_classes (long ptobnum, char *type_name);
 SCM_API void scm_change_object_class (SCM, SCM, SCM);
 SCM_API SCM scm_memoize_method (SCM x, SCM args);
@@ -205,9 +205,9 @@ SCM_API SCM scm_object_procedure (SCM obj);
 SCM_API SCM scm_make_class_object (SCM metaclass, SCM layout);
 SCM_API SCM scm_make_subclass_object (SCM c, SCM layout);
 
-SCM_API SCM scm_i_make_class_object (SCM metaclass, SCM layout_string,
-				     unsigned long flags);
-SCM_API void scm_init_objects (void);
+SCM_INTERNAL SCM scm_i_make_class_object (SCM metaclass, SCM layout_string,
+					  unsigned long flags);
+SCM_INTERNAL void scm_init_objects (void);
 
 #endif  /* SCM_OBJECTS_H */
 
diff --git a/libguile/objprop.h b/libguile/objprop.h
index edf2d95..7e5365a 100644
--- a/libguile/objprop.h
+++ b/libguile/objprop.h
@@ -3,7 +3,7 @@
 #ifndef SCM_OBJPROP_H
 #define SCM_OBJPROP_H
 
-/* Copyright (C) 1995,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ SCM_API SCM scm_object_properties (SCM obj);
 SCM_API SCM scm_set_object_properties_x (SCM obj, SCM plist);
 SCM_API SCM scm_object_property (SCM obj, SCM key);
 SCM_API SCM scm_set_object_property_x (SCM obj, SCM key, SCM val);
-SCM_API void scm_init_objprop (void);
+SCM_INTERNAL void scm_init_objprop (void);
 
 #endif  /* SCM_OBJPROP_H */
 
diff --git a/libguile/options.h b/libguile/options.h
index 5b96649..4facdce 100644
--- a/libguile/options.h
+++ b/libguile/options.h
@@ -3,7 +3,7 @@
 #ifndef SCM_OPTIONS_H
 #define SCM_OPTIONS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -43,7 +43,7 @@ typedef struct scm_t_option
 SCM_API SCM scm_options_try (SCM args, scm_t_option options[], const char *s, int dry_run);
 SCM_API SCM scm_options (SCM, scm_t_option [], const char*);
 SCM_API void scm_init_opts (SCM (*) (SCM), scm_t_option []);
-SCM_API void scm_init_options (void);
+SCM_INTERNAL void scm_init_options (void);
 
 #endif  /* SCM_OPTIONS_H */
 
diff --git a/libguile/pairs.h b/libguile/pairs.h
index dd22ff3..61af24e 100644
--- a/libguile/pairs.h
+++ b/libguile/pairs.h
@@ -148,7 +148,7 @@ SCM_API SCM scm_i_chase_pairs (SCM x, scm_t_uint32 pattern);
 #define scm_caaadr(x) scm_i_chase_pairs ((x), SCM_I_AAAD_PAT)
 #define scm_caaaar(x) scm_i_chase_pairs ((x), SCM_I_AAAA_PAT)
 
-SCM_API void scm_init_pairs (void);
+SCM_INTERNAL void scm_init_pairs (void);
 
 #endif  /* SCM_PAIRS_H */
 
diff --git a/libguile/ports.h b/libguile/ports.h
index fb0ef4e..084a555 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -109,8 +109,8 @@ typedef struct
 } scm_t_port;
 
 
-SCM_API scm_i_pthread_mutex_t scm_i_port_table_mutex;
-SCM_API SCM scm_i_port_weak_hash;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_port_table_mutex;
+SCM_INTERNAL SCM scm_i_port_weak_hash;
 
 
 #define SCM_READ_BUFFER_EMPTY_P(c_port) (c_port->read_pos >= c_port->read_end)
@@ -195,7 +195,7 @@ typedef struct scm_t_ptob_descriptor
 
 SCM_API scm_t_ptob_descriptor *scm_ptobs;
 SCM_API long scm_numptob;
-SCM_API long scm_i_port_table_room;
+SCM_INTERNAL long scm_i_port_table_room;
 
 \f
 
@@ -241,7 +241,7 @@ SCM_API void scm_dynwind_current_input_port (SCM port);
 SCM_API void scm_dynwind_current_output_port (SCM port);
 SCM_API void scm_dynwind_current_error_port (SCM port);
 SCM_API SCM scm_new_port_table_entry (scm_t_bits tag);
-SCM_API void scm_i_remove_port (SCM port);
+SCM_INTERNAL void scm_i_remove_port (SCM port);
 SCM_API void scm_grow_port_cbuf (SCM port, size_t requested);
 SCM_API SCM scm_pt_size (void);
 SCM_API SCM scm_pt_member (SCM member);
@@ -288,7 +288,7 @@ SCM_API void scm_print_port_mode (SCM exp, SCM port);
 SCM_API void scm_ports_prehistory (void);
 SCM_API SCM scm_void_port (char * mode_str);
 SCM_API SCM scm_sys_make_void_port (SCM mode);
-SCM_API void scm_init_ports (void);
+SCM_INTERNAL void scm_init_ports (void);
 
 
 #if SCM_ENABLE_DEPRECATED==1
@@ -302,8 +302,8 @@ SCM_API SCM scm_pt_member (SCM member);
 
 /* internal */
 
-SCM_API long scm_i_mode_bits (SCM modes);
-SCM_API void scm_i_dynwind_current_load_port (SCM port);
+SCM_INTERNAL long scm_i_mode_bits (SCM modes);
+SCM_INTERNAL void scm_i_dynwind_current_load_port (SCM port);
 
 
 #endif  /* SCM_PORTS_H */
diff --git a/libguile/posix.h b/libguile/posix.h
index 871bba8..d51da94 100644
--- a/libguile/posix.h
+++ b/libguile/posix.h
@@ -3,7 +3,7 @@
 #ifndef SCM_POSIX_H
 #define SCM_POSIX_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -84,9 +84,9 @@ SCM_API SCM scm_getpass (SCM prompt);
 SCM_API SCM scm_flock (SCM file, SCM operation);
 SCM_API SCM scm_sethostname (SCM name);
 SCM_API SCM scm_gethostname (void);
-SCM_API void scm_init_posix (void);
+SCM_INTERNAL void scm_init_posix (void);
 
-SCM_API scm_i_pthread_mutex_t scm_i_locale_mutex;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_locale_mutex;
 
 #endif  /* SCM_POSIX_H */
 
diff --git a/libguile/print.h b/libguile/print.h
index 740aa28..8974a75 100644
--- a/libguile/print.h
+++ b/libguile/print.h
@@ -3,7 +3,7 @@
 #ifndef SCM_PRINT_H
 #define SCM_PRINT_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -75,7 +75,7 @@ SCM_API scm_t_bits scm_tc16_port_with_ps;
 SCM_API SCM scm_print_options (SCM setting);
 SCM_API SCM scm_make_print_state (void);
 SCM_API void scm_free_print_state (SCM print_state);
-SCM scm_i_port_with_print_state (SCM port, SCM print_state);
+SCM_INTERNAL SCM scm_i_port_with_print_state (SCM port, SCM print_state);
 SCM_API void scm_intprint (scm_t_intmax n, int radix, SCM port);
 SCM_API void scm_uintprint (scm_t_uintmax n, int radix, SCM port);
 SCM_API void scm_ipruk (char *hdr, SCM ptr, SCM port);
@@ -92,7 +92,7 @@ SCM_API SCM scm_printer_apply (SCM proc, SCM exp, SCM port, scm_print_state *);
 SCM_API SCM scm_port_with_print_state (SCM port, SCM pstate);
 SCM_API SCM scm_get_print_state (SCM port);
 SCM_API int scm_valid_oport_value_p (SCM val);
-SCM_API void scm_init_print (void);
+SCM_INTERNAL void scm_init_print (void);
 
 #ifdef GUILE_DEBUG
 SCM_API SCM scm_current_pstate (void);
diff --git a/libguile/private-gc.h b/libguile/private-gc.h
index 34d789b..ce60cbb 100644
--- a/libguile/private-gc.h
+++ b/libguile/private-gc.h
@@ -1,7 +1,7 @@
 /*
  * private-gc.h - private declarations for garbage collection.
  * 
- * Copyright (C) 2002, 03, 04, 05, 06, 07 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 03, 04, 05, 06, 07, 08 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -163,10 +163,13 @@ typedef struct scm_sweep_statistics
 extern scm_t_cell_type_statistics scm_i_master_freelist;
 extern scm_t_cell_type_statistics scm_i_master_freelist2;
 
+SCM_INTERNAL
 void scm_i_adjust_min_yield (scm_t_cell_type_statistics *freelist,
 			     scm_t_sweep_statistics sweep_stats,
 			     scm_t_sweep_statistics sweep_stats_1);
+SCM_INTERNAL
 void scm_i_gc_sweep_freelist_reset (scm_t_cell_type_statistics *freelist);
+SCM_INTERNAL
 int scm_i_gc_grow_heap_p (scm_t_cell_type_statistics * freelist);
 
 
@@ -263,39 +266,46 @@ extern scm_t_heap_segment ** scm_i_heap_segment_table;
 extern size_t scm_i_heap_segment_table_size;
 
 
-int scm_i_init_card_freelist (scm_t_cell * card, SCM *free_list,scm_t_heap_segment*);
-int scm_i_sweep_card (scm_t_cell * card, SCM *free_list, scm_t_heap_segment*);
-void scm_i_card_statistics (scm_t_cell *p, SCM hashtab, scm_t_heap_segment *seg);
-char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
-
-int scm_i_initialize_heap_segment_data (scm_t_heap_segment * segment, size_t requested);
-int scm_i_segment_card_count (scm_t_heap_segment * seg);
-int scm_i_segment_cell_count (scm_t_heap_segment * seg);
-
-void scm_i_clear_segment_mark_space (scm_t_heap_segment *seg);
-scm_t_heap_segment * scm_i_make_empty_heap_segment (scm_t_cell_type_statistics*);
-SCM scm_i_sweep_some_cards (scm_t_heap_segment *seg,
-			    scm_t_sweep_statistics *sweep_stats);
-void scm_i_sweep_segment (scm_t_heap_segment *seg,
-			  scm_t_sweep_statistics *sweep_stats);
-
-void scm_i_heap_segment_statistics (scm_t_heap_segment *seg, SCM tab);
-
-     
-int scm_i_insert_segment (scm_t_heap_segment * seg);
-long int scm_i_find_heap_segment_containing_object (SCM obj);
-int scm_i_get_new_heap_segment (scm_t_cell_type_statistics *,
-				scm_t_sweep_statistics,
-				policy_on_error);
-void scm_i_clear_mark_space (void);
-void scm_i_sweep_segments (void);
-SCM scm_i_sweep_some_segments (scm_t_cell_type_statistics *fl,
-			       scm_t_sweep_statistics *sweep_stats);
-void scm_i_reset_segments (void);
-void scm_i_sweep_all_segments (char const *reason,
-			       scm_t_sweep_statistics *sweep_stats);
-SCM scm_i_all_segments_statistics (SCM hashtab);
-void scm_i_make_initial_segment (int init_heap_size, scm_t_cell_type_statistics *freelist);
+SCM_INTERNAL int scm_i_init_card_freelist (scm_t_cell * card, SCM *free_list,
+					   scm_t_heap_segment*);
+SCM_INTERNAL int scm_i_sweep_card (scm_t_cell *card, SCM *free_list,
+				   scm_t_heap_segment *);
+SCM_INTERNAL void scm_i_card_statistics (scm_t_cell *p, SCM hashtab,
+					 scm_t_heap_segment *seg);
+SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
+
+SCM_INTERNAL int scm_i_initialize_heap_segment_data (scm_t_heap_segment *seg,
+						     size_t requested);
+SCM_INTERNAL int scm_i_segment_card_count (scm_t_heap_segment *seg);
+SCM_INTERNAL int scm_i_segment_cell_count (scm_t_heap_segment *seg);
+
+SCM_INTERNAL void scm_i_clear_segment_mark_space (scm_t_heap_segment *seg);
+SCM_INTERNAL scm_t_heap_segment *
+scm_i_make_empty_heap_segment (scm_t_cell_type_statistics*);
+SCM_INTERNAL SCM scm_i_sweep_some_cards (scm_t_heap_segment *seg,
+					 scm_t_sweep_statistics *sweep_stats);
+SCM_INTERNAL void scm_i_sweep_segment (scm_t_heap_segment *seg,
+				       scm_t_sweep_statistics *sweep_stats);
+
+SCM_INTERNAL void scm_i_heap_segment_statistics (scm_t_heap_segment *seg,
+						 SCM tab);
+
+
+SCM_INTERNAL int scm_i_insert_segment (scm_t_heap_segment *seg);
+SCM_INTERNAL long int scm_i_find_heap_segment_containing_object (SCM obj);
+SCM_INTERNAL int scm_i_get_new_heap_segment (scm_t_cell_type_statistics *,
+					     scm_t_sweep_statistics,
+					     policy_on_error);
+SCM_INTERNAL void scm_i_clear_mark_space (void);
+SCM_INTERNAL void scm_i_sweep_segments (void);
+SCM_INTERNAL SCM scm_i_sweep_some_segments (scm_t_cell_type_statistics *fl,
+					    scm_t_sweep_statistics *sweep_stats);
+SCM_INTERNAL void scm_i_reset_segments (void);
+SCM_INTERNAL void scm_i_sweep_all_segments (char const *reason,
+					    scm_t_sweep_statistics *sweep_stats);
+SCM_INTERNAL SCM scm_i_all_segments_statistics (SCM hashtab);
+SCM_INTERNAL void scm_i_make_initial_segment (int init_heap_size,
+					      scm_t_cell_type_statistics *fl);
 
 extern long int scm_i_deprecated_memory_return;
 
diff --git a/libguile/procprop.h b/libguile/procprop.h
index dffdfd7..bf27dba 100644
--- a/libguile/procprop.h
+++ b/libguile/procprop.h
@@ -3,7 +3,7 @@
 #ifndef SCM_PROCPROP_H
 #define SCM_PROCPROP_H
 
-/* Copyright (C) 1995,1996,1998,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,12 +32,12 @@ SCM_API SCM scm_sym_system_procedure;
 
 \f
 
-SCM_API SCM scm_i_procedure_arity (SCM proc);
+SCM_INTERNAL SCM scm_i_procedure_arity (SCM proc);
 SCM_API SCM scm_procedure_properties (SCM proc);
 SCM_API SCM scm_set_procedure_properties_x (SCM proc, SCM new_val);
 SCM_API SCM scm_procedure_property (SCM p, SCM k);
 SCM_API SCM scm_set_procedure_property_x (SCM p, SCM k, SCM v);
-SCM_API void scm_init_procprop (void);
+SCM_INTERNAL void scm_init_procprop (void);
 
 #endif  /* SCM_PROCPROP_H */
 
diff --git a/libguile/procs.h b/libguile/procs.h
index 060c8ee..cf9cdf1 100644
--- a/libguile/procs.h
+++ b/libguile/procs.h
@@ -3,7 +3,7 @@
 #ifndef SCM_PROCS_H
 #define SCM_PROCS_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -154,8 +154,8 @@ SCM_API SCM scm_procedure_with_setter_p (SCM obj);
 SCM_API SCM scm_make_procedure_with_setter (SCM procedure, SCM setter);
 SCM_API SCM scm_procedure (SCM proc);
 SCM_API SCM scm_setter (SCM proc);
-SCM_API void scm_init_subr_table (void);
-SCM_API void scm_init_procs (void);
+SCM_INTERNAL void scm_init_subr_table (void);
+SCM_INTERNAL void scm_init_procs (void);
 
 #ifdef GUILE_DEBUG
 SCM_API SCM scm_make_cclo (SCM proc, SCM len);
diff --git a/libguile/properties.h b/libguile/properties.h
index 3f8cb6d..54feb01 100644
--- a/libguile/properties.h
+++ b/libguile/properties.h
@@ -3,7 +3,7 @@
 #ifndef SCM_PROPERTIES_H
 #define SCM_PROPERTIES_H
 
-/* Copyright (C) 1995,1996,1998,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,7 @@ SCM_API SCM scm_primitive_property_ref (SCM prop, SCM obj);
 SCM_API SCM scm_primitive_property_set_x (SCM prop, SCM obj, SCM val);
 SCM_API SCM scm_primitive_property_del_x (SCM prop, SCM obj);
 
-SCM_API void scm_init_properties (void);
+SCM_INTERNAL void scm_init_properties (void);
 
 #endif  /* SCM_PROPERTIES_H */
 
diff --git a/libguile/ramap.h b/libguile/ramap.h
index 8383649..9d87038 100644
--- a/libguile/ramap.h
+++ b/libguile/ramap.h
@@ -3,7 +3,7 @@
 #ifndef SCM_RAMAP_H
 #define SCM_RAMAP_H
 
-/* Copyright (C) 1995,1996,1997,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ SCM_API SCM scm_array_for_each (SCM proc, SCM ra0, SCM lra);
 SCM_API SCM scm_array_index_map_x (SCM ra, SCM proc);
 SCM_API SCM scm_raequal (SCM ra0, SCM ra1);
 SCM_API SCM scm_array_equal_p (SCM ra0, SCM ra1);
-SCM_API void scm_init_ramap (void);
+SCM_INTERNAL void scm_init_ramap (void);
 
 #endif  /* SCM_RAMAP_H */
 
diff --git a/libguile/random.h b/libguile/random.h
index 6ec43ff..ae44092 100644
--- a/libguile/random.h
+++ b/libguile/random.h
@@ -3,7 +3,7 @@
 #ifndef SCM_RANDOM_H
 #define SCM_RANDOM_H
 
-/* Copyright (C) 1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -62,9 +62,9 @@ typedef struct scm_t_i_rstate {
   unsigned long c;
 } scm_t_i_rstate;
 
-SCM_API unsigned long scm_i_uniform32 (scm_t_i_rstate *);
-SCM_API void scm_i_init_rstate (scm_t_i_rstate *, const char *seed, int n);
-SCM_API scm_t_i_rstate *scm_i_copy_rstate (scm_t_i_rstate *);
+SCM_INTERNAL unsigned long scm_i_uniform32 (scm_t_i_rstate *);
+SCM_INTERNAL void scm_i_init_rstate (scm_t_i_rstate *, const char *seed, int n);
+SCM_INTERNAL scm_t_i_rstate *scm_i_copy_rstate (scm_t_i_rstate *);
 
 \f
 /*
@@ -99,7 +99,7 @@ SCM_API SCM scm_random_hollow_sphere_x (SCM v, SCM state);
 SCM_API SCM scm_random_normal (SCM state);
 SCM_API SCM scm_random_normal_vector_x (SCM v, SCM state);
 SCM_API SCM scm_random_exp (SCM state);
-SCM_API void scm_init_random (void);
+SCM_INTERNAL void scm_init_random (void);
 
 #endif  /* SCM_RANDOM_H */
 
diff --git a/libguile/rdelim.h b/libguile/rdelim.h
index b211bb2..17efb4f 100644
--- a/libguile/rdelim.h
+++ b/libguile/rdelim.h
@@ -3,7 +3,7 @@
 #ifndef SCM_RDELIM_H
 #define SCM_RDELIM_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ SCM_API SCM scm_read_line (SCM port);
 SCM_API SCM scm_write_line (SCM obj, SCM port);
 SCM_API SCM scm_init_rdelim_builtins (void);
 
-SCM_API void scm_init_rdelim (void);
+SCM_INTERNAL void scm_init_rdelim (void);
 
 #endif  /* SCM_RDELIM_H */
 
diff --git a/libguile/read.h b/libguile/read.h
index 128ba3d..4253622 100644
--- a/libguile/read.h
+++ b/libguile/read.h
@@ -3,7 +3,7 @@
 #ifndef SCM_READ_H
 #define SCM_READ_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -56,11 +56,11 @@ SCM_API SCM scm_read (SCM port);
 SCM_API size_t scm_read_token (int ic, SCM * tok_buf, SCM port, int weird);
 SCM_API SCM scm_read_hash_extend (SCM chr, SCM proc);
 
-SCM_API void scm_i_input_error (const char *func, SCM port,
-				const char *message, SCM arg)
+SCM_INTERNAL void scm_i_input_error (const char *func, SCM port,
+				     const char *message, SCM arg)
   SCM_NORETURN;
 
-SCM_API void scm_init_read (void);
+SCM_INTERNAL void scm_init_read (void);
 
 #endif  /* SCM_READ_H */
 
diff --git a/libguile/regex-posix.h b/libguile/regex-posix.h
index c382136..2863b05 100644
--- a/libguile/regex-posix.h
+++ b/libguile/regex-posix.h
@@ -3,7 +3,7 @@
 #ifndef SCM_REGEX_POSIX_H
 #define SCM_REGEX_POSIX_H
 
-/* Copyright (C) 1997,1998,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,7 @@ SCM_API scm_t_bits scm_tc16_regex;
 SCM_API SCM scm_make_regexp (SCM pat, SCM flags);
 SCM_API SCM scm_regexp_p (SCM x);
 SCM_API SCM scm_regexp_exec (SCM rx, SCM str, SCM start, SCM flags);
-SCM_API void scm_init_regex_posix (void);
+SCM_INTERNAL void scm_init_regex_posix (void);
 
 #endif  /* SCM_REGEX_POSIX_H */
 
diff --git a/libguile/root.h b/libguile/root.h
index 6c7800f..11f6b4f 100644
--- a/libguile/root.h
+++ b/libguile/root.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ROOT_H
 #define SCM_ROOT_H
 
-/* Copyright (C) 1996,1998,2000,2001, 2002, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1998,2000,2001, 2002, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -55,7 +55,7 @@ SCM_API SCM scm_internal_cwdr (scm_t_catch_body body,
 SCM_API SCM scm_call_with_dynamic_root (SCM thunk, SCM handler);
 SCM_API SCM scm_dynamic_root (void);
 SCM_API SCM scm_apply_with_dynamic_root (SCM proc, SCM a1, SCM args, SCM handler);
-SCM_API void scm_init_root (void);
+SCM_INTERNAL void scm_init_root (void);
 
 #endif  /* SCM_ROOT_H */
 
diff --git a/libguile/rw.h b/libguile/rw.h
index 108104c..b526051 100644
--- a/libguile/rw.h
+++ b/libguile/rw.h
@@ -3,7 +3,7 @@
 #ifndef SCM_RW_H
 #define SCM_RW_H
 
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -29,8 +29,8 @@ SCM_API SCM scm_read_string_x_partial (SCM str, SCM port_or_fdes, SCM start,
 SCM_API SCM scm_write_string_partial (SCM str, SCM port_or_fdes, SCM start,
 				      SCM end);
 
-SCM_API SCM scm_init_rw_builtins (void);
-SCM_API void scm_init_rw (void);
+SCM_INTERNAL SCM scm_init_rw_builtins (void);
+SCM_INTERNAL void scm_init_rw (void);
 
 #endif  /* SCM_RW_H */
 
diff --git a/libguile/scmsigs.h b/libguile/scmsigs.h
index 2aced3a..bcbf825 100644
--- a/libguile/scmsigs.h
+++ b/libguile/scmsigs.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SCMSIGS_H
 #define SCM_SCMSIGS_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000, 2002, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000, 2002, 2006, 2007, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -40,12 +40,12 @@ SCM_API SCM scm_pause (void);
 SCM_API SCM scm_sleep (SCM i);
 SCM_API SCM scm_usleep (SCM i);
 SCM_API SCM scm_raise (SCM sig);
-SCM_API void scm_init_scmsigs (void);
+SCM_INTERNAL void scm_init_scmsigs (void);
 
-SCM_API void scm_i_close_signal_pipe (void);
-SCM_API void scm_i_ensure_signal_delivery_thread (void);
+SCM_INTERNAL void scm_i_close_signal_pipe (void);
+SCM_INTERNAL void scm_i_ensure_signal_delivery_thread (void);
 
-SCM_API scm_i_thread *scm_i_signal_delivery_thread;
+SCM_INTERNAL scm_i_thread *scm_i_signal_delivery_thread;
 
 #endif  /* SCM_SCMSIGS_H */
 
diff --git a/libguile/script.h b/libguile/script.h
index 37ebdde..6c02f8d 100644
--- a/libguile/script.h
+++ b/libguile/script.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SCRIPT_H
 #define SCM_SCRIPT_H
 
-/* Copyright (C) 1997,1998,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@ SCM_API void scm_shell_usage (int fatal, char *message);
 SCM_API SCM scm_compile_shell_switches (int argc, char **argv);
 SCM_API void scm_shell (int argc, char **argv);
 SCM_API char *scm_usage_name;
-SCM_API void scm_init_script (void);
+SCM_INTERNAL void scm_init_script (void);
 
 #endif  /* SCM_SCRIPT_H */
 
diff --git a/libguile/simpos.h b/libguile/simpos.h
index 1ce207b..6df8bb1 100644
--- a/libguile/simpos.h
+++ b/libguile/simpos.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SIMPOS_H
 #define SCM_SIMPOS_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,7 @@ SCM_API SCM scm_system_star (SCM cmds);
 SCM_API SCM scm_getenv (SCM nam);
 SCM_API SCM scm_primitive_exit (SCM status);
 SCM_API SCM scm_primitive__exit (SCM status);
-SCM_API void scm_init_simpos (void);
+SCM_INTERNAL void scm_init_simpos (void);
 
 #endif  /* SCM_SIMPOS_H */
 
diff --git a/libguile/socket.h b/libguile/socket.h
index 146d283..133dbf7 100644
--- a/libguile/socket.h
+++ b/libguile/socket.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SOCKET_H
 #define SCM_SOCKET_H
 
-/* Copyright (C) 1995,1996,1997,2000,2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000,2001, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -52,7 +52,7 @@ SCM_API SCM scm_recv (SCM sockfd, SCM buff_or_size, SCM flags);
 SCM_API SCM scm_send (SCM sockfd, SCM message, SCM flags);
 SCM_API SCM scm_recvfrom (SCM sockfd, SCM buff_or_size, SCM flags, SCM offset, SCM length);
 SCM_API SCM scm_sendto (SCM sockfd, SCM message, SCM fam, SCM address, SCM args_and_flags);
-SCM_API void scm_init_socket (void);
+SCM_INTERNAL void scm_init_socket (void);
 
 /* Wrapping/unwrapping address objects.  */
 struct sockaddr;
diff --git a/libguile/sort.h b/libguile/sort.h
index b8bf4ce..51f292a 100644
--- a/libguile/sort.h
+++ b/libguile/sort.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SORT_H
 #define SCM_SORT_H
 
-/* Copyright (C) 1999,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -39,7 +39,7 @@ SCM_API SCM scm_stable_sort (SCM ls, SCM less);
 SCM_API SCM scm_stable_sort_x (SCM ls, SCM less);
 SCM_API SCM scm_sort_list (SCM ls, SCM less);
 SCM_API SCM scm_sort_list_x (SCM ls, SCM less);
-SCM_API void scm_init_sort (void);
+SCM_INTERNAL void scm_init_sort (void);
 
 #endif  /* SCM_SORT_H */
 
diff --git a/libguile/srcprop.h b/libguile/srcprop.h
index 87e5fde..a467aa3 100644
--- a/libguile/srcprop.h
+++ b/libguile/srcprop.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SRCPROP_H
 #define SCM_SRCPROP_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -70,7 +70,7 @@ SCM_API SCM scm_set_source_property_x (SCM obj, SCM key, SCM datum);
 SCM_API SCM scm_source_properties (SCM obj);
 SCM_API SCM scm_set_source_properties_x (SCM obj, SCM props);
 SCM_API void scm_finish_srcprop (void);
-SCM_API void scm_init_srcprop (void);
+SCM_INTERNAL void scm_init_srcprop (void);
 
 #if SCM_ENABLE_DEPRECATED == 1
 #define SRCBRKP(x) (scm_source_property_breakpoint_p (x))
diff --git a/libguile/srfi-13.h b/libguile/srfi-13.h
index 833586a..f8221dd 100644
--- a/libguile/srfi-13.h
+++ b/libguile/srfi-13.h
@@ -3,7 +3,7 @@
 
 /* srfi-13.c --- SRFI-13 procedures for Guile
  *
- * 	Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+ * 	Copyright (C) 2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -113,7 +113,7 @@ SCM_API SCM scm_string_split (SCM s, SCM chr);
 SCM_API SCM scm_string_filter (SCM s, SCM char_pred, SCM start, SCM end);
 SCM_API SCM scm_string_delete (SCM s, SCM char_pred, SCM start, SCM end);
 
-SCM_API void scm_init_srfi_13 (void);
-SCM_API void scm_init_srfi_13_14 (void);
+SCM_INTERNAL void scm_init_srfi_13 (void);
+SCM_INTERNAL void scm_init_srfi_13_14 (void);
 
 #endif /* SCM_SRFI_13_H */
diff --git a/libguile/srfi-14.h b/libguile/srfi-14.h
index 516c510..ea8027a 100644
--- a/libguile/srfi-14.h
+++ b/libguile/srfi-14.h
@@ -3,7 +3,7 @@
 
 /* srfi-14.c --- SRFI-14 procedures for Guile
  *
- * 	Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+ * 	Copyright (C) 2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -106,7 +106,7 @@ SCM_API SCM scm_char_set_ascii;
 SCM_API SCM scm_char_set_empty;
 SCM_API SCM scm_char_set_full;
 
-SCM_API void scm_srfi_14_compute_char_sets (void);
-SCM_API void scm_init_srfi_14 (void);
+SCM_INTERNAL void scm_srfi_14_compute_char_sets (void);
+SCM_INTERNAL void scm_init_srfi_14 (void);
 
 #endif /* SCM_SRFI_14_H */
diff --git a/libguile/srfi-4.h b/libguile/srfi-4.h
index 7abbac8..3c340d9 100644
--- a/libguile/srfi-4.h
+++ b/libguile/srfi-4.h
@@ -2,7 +2,7 @@
 #define SCM_SRFI_4_H
 /* srfi-4.c --- Homogeneous numeric vector datatypes.
  *
- * 	Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+ * 	Copyright (C) 2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -303,10 +303,10 @@ SCM_API double *scm_c64vector_writable_elements (SCM uvec,
 						 size_t *lenp,
 						 ssize_t *incp);
 
-SCM_API SCM scm_i_generalized_vector_type (SCM vec);
-SCM_API const char *scm_i_uniform_vector_tag (SCM uvec);
-SCM_API scm_i_t_array_ref scm_i_uniform_vector_ref_proc (SCM uvec);
-SCM_API scm_i_t_array_set scm_i_uniform_vector_set_proc (SCM uvec);
+SCM_INTERNAL SCM scm_i_generalized_vector_type (SCM vec);
+SCM_INTERNAL const char *scm_i_uniform_vector_tag (SCM uvec);
+SCM_INTERNAL scm_i_t_array_ref scm_i_uniform_vector_ref_proc (SCM uvec);
+SCM_INTERNAL scm_i_t_array_set scm_i_uniform_vector_set_proc (SCM uvec);
 
 #if SCM_ENABLE_DEPRECATED
 
@@ -318,6 +318,6 @@ SCM_API size_t scm_uniform_element_size (SCM obj);
 
 #endif
 
-SCM_API void scm_init_srfi_4 (void);
+SCM_INTERNAL void scm_init_srfi_4 (void);
 
 #endif /* SCM_SRFI_4_H */
diff --git a/libguile/stackchk.h b/libguile/stackchk.h
index 9a5c59f..66582e9 100644
--- a/libguile/stackchk.h
+++ b/libguile/stackchk.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STACKCHK_H
 #define SCM_STACKCHK_H
 
-/* Copyright (C) 1995,1996,1998,2000, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -60,7 +60,7 @@ SCM_API int scm_stack_checking_enabled_p;
 SCM_API void scm_report_stack_overflow (void);
 SCM_API long scm_stack_size (SCM_STACKITEM *start);
 SCM_API void scm_stack_report (void);
-SCM_API void scm_init_stackchk (void);
+SCM_INTERNAL void scm_init_stackchk (void);
 
 #endif  /* SCM_STACKCHK_H */
 
diff --git a/libguile/stacks.h b/libguile/stacks.h
index e44bb1c..53633bc 100644
--- a/libguile/stacks.h
+++ b/libguile/stacks.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STACKS_H
 #define SCM_STACKS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -106,7 +106,7 @@ SCM_API SCM scm_frame_procedure_p (SCM frame);
 SCM_API SCM scm_frame_evaluating_args_p (SCM frame);
 SCM_API SCM scm_frame_overflow_p (SCM frame);
 
-SCM_API void scm_init_stacks (void);
+SCM_INTERNAL void scm_init_stacks (void);
 
 #endif  /* SCM_STACKS_H */
 
diff --git a/libguile/stime.h b/libguile/stime.h
index 52acc2f..c64c60e 100644
--- a/libguile/stime.h
+++ b/libguile/stime.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STIME_H
 #define SCM_STIME_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -64,7 +64,7 @@ SCM_API SCM scm_tzset (void);
 SCM_API SCM scm_times (void);
 SCM_API SCM scm_strftime (SCM format, SCM stime);
 SCM_API SCM scm_strptime (SCM format, SCM string);
-SCM_API void scm_init_stime (void);
+SCM_INTERNAL void scm_init_stime (void);
 
 #endif  /* SCM_STIME_H */
 
diff --git a/libguile/strings.h b/libguile/strings.h
index f96457e..04ae552 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STRINGS_H
 #define SCM_STRINGS_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -110,47 +110,47 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv);
 
 /* internal accessor functions.  Arguments must be valid. */
 
-SCM_API SCM scm_i_make_string (size_t len, char **datap);
-SCM_API SCM scm_i_substring (SCM str, size_t start, size_t end);
-SCM_API SCM scm_i_substring_read_only (SCM str, size_t start, size_t end);
-SCM_API SCM scm_i_substring_shared (SCM str, size_t start, size_t end);
-SCM_API SCM scm_i_substring_copy (SCM str, size_t start, size_t end);
-SCM_API size_t scm_i_string_length (SCM str);
-SCM_API const char *scm_i_string_chars (SCM str);
-SCM_API char *scm_i_string_writable_chars (SCM str);
-SCM_API void scm_i_string_stop_writing (void);
+SCM_INTERNAL SCM scm_i_make_string (size_t len, char **datap);
+SCM_INTERNAL SCM scm_i_substring (SCM str, size_t start, size_t end);
+SCM_INTERNAL SCM scm_i_substring_read_only (SCM str, size_t start, size_t end);
+SCM_INTERNAL SCM scm_i_substring_shared (SCM str, size_t start, size_t end);
+SCM_INTERNAL SCM scm_i_substring_copy (SCM str, size_t start, size_t end);
+SCM_INTERNAL size_t scm_i_string_length (SCM str);
+SCM_API /* FIXME: not internal */ const char *scm_i_string_chars (SCM str);
+SCM_API /* FIXME: not internal */ char *scm_i_string_writable_chars (SCM str);
+SCM_INTERNAL void scm_i_string_stop_writing (void);
 
 /* internal functions related to symbols. */
 
-SCM_API SCM scm_i_make_symbol (SCM name, scm_t_bits flags, 
-			       unsigned long hash, SCM props);
-SCM_API SCM
+SCM_INTERNAL SCM scm_i_make_symbol (SCM name, scm_t_bits flags,
+				    unsigned long hash, SCM props);
+SCM_INTERNAL SCM
 scm_i_c_make_symbol (const char *name, size_t len,
 		     scm_t_bits flags, unsigned long hash, SCM props);
-SCM_API SCM
+SCM_INTERNAL SCM
 scm_i_c_take_symbol (char *name, size_t len,
 		     scm_t_bits flags, unsigned long hash, SCM props);
-SCM_API const char *scm_i_symbol_chars (SCM sym);
-SCM_API size_t scm_i_symbol_length (SCM sym);
-SCM_API SCM scm_i_symbol_substring (SCM sym, size_t start, size_t end);
+SCM_INTERNAL const char *scm_i_symbol_chars (SCM sym);
+SCM_INTERNAL size_t scm_i_symbol_length (SCM sym);
+SCM_INTERNAL SCM scm_i_symbol_substring (SCM sym, size_t start, size_t end);
 
 /* internal GC functions. */
 
-SCM_API SCM scm_i_string_mark (SCM str);
-SCM_API SCM scm_i_stringbuf_mark (SCM buf);
-SCM_API SCM scm_i_symbol_mark (SCM buf);
-SCM_API void scm_i_string_free (SCM str);
-SCM_API void scm_i_stringbuf_free (SCM buf);
-SCM_API void scm_i_symbol_free (SCM sym);
+SCM_INTERNAL SCM scm_i_string_mark (SCM str);
+SCM_INTERNAL SCM scm_i_stringbuf_mark (SCM buf);
+SCM_INTERNAL SCM scm_i_symbol_mark (SCM buf);
+SCM_INTERNAL void scm_i_string_free (SCM str);
+SCM_INTERNAL void scm_i_stringbuf_free (SCM buf);
+SCM_INTERNAL void scm_i_symbol_free (SCM sym);
 
 /* internal utility functions. */
 
-SCM_API char **scm_i_allocate_string_pointers (SCM list);
-SCM_API void scm_i_free_string_pointers (char **pointers);
-SCM_API void scm_i_get_substring_spec (size_t len,
-				       SCM start, size_t *cstart,
-				       SCM end, size_t *cend);
-SCM_API SCM scm_i_take_stringbufn (char *str, size_t len);
+SCM_INTERNAL char **scm_i_allocate_string_pointers (SCM list);
+SCM_INTERNAL void scm_i_free_string_pointers (char **pointers);
+SCM_INTERNAL void scm_i_get_substring_spec (size_t len,
+					    SCM start, size_t *cstart,
+					    SCM end, size_t *cend);
+SCM_INTERNAL SCM scm_i_take_stringbufn (char *str, size_t len);
 
 /* deprecated stuff */
 
@@ -167,7 +167,7 @@ SCM_API size_t scm_i_deprecated_string_length (SCM str);
 
 #endif
 
-SCM_API void scm_init_strings (void);
+SCM_INTERNAL void scm_init_strings (void);
 
 #endif  /* SCM_STRINGS_H */
 
diff --git a/libguile/strorder.h b/libguile/strorder.h
index 51168e0..1711863 100644
--- a/libguile/strorder.h
+++ b/libguile/strorder.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STRORDER_H
 #define SCM_STRORDER_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@ SCM_API SCM scm_string_ci_less_p (SCM s1, SCM s2);
 SCM_API SCM scm_string_ci_leq_p (SCM s1, SCM s2);
 SCM_API SCM scm_string_ci_gr_p (SCM s1, SCM s2);
 SCM_API SCM scm_string_ci_geq_p (SCM s1, SCM s2);
-SCM_API void scm_init_strorder (void);
+SCM_INTERNAL void scm_init_strorder (void);
 
 #endif  /* SCM_STRORDER_H */
 
diff --git a/libguile/strports.h b/libguile/strports.h
index 2ca5fb5..58ca71f 100644
--- a/libguile/strports.h
+++ b/libguile/strports.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STRPORTS_H
 #define SCM_STRPORTS_H
 
-/* Copyright (C) 1995,1996,2000,2001,2002, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001,2002, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -55,7 +55,7 @@ SCM_API SCM scm_c_eval_string (const char *expr);
 SCM_API SCM scm_c_eval_string_in_module (const char *expr, SCM module);
 SCM_API SCM scm_eval_string (SCM string);
 SCM_API SCM scm_eval_string_in_module (SCM string, SCM module);
-SCM_API void scm_init_strports (void);
+SCM_INTERNAL void scm_init_strports (void);
 
 #endif  /* SCM_STRPORTS_H */
 
diff --git a/libguile/struct.h b/libguile/struct.h
index 4b263d2..f00a8d8 100644
--- a/libguile/struct.h
+++ b/libguile/struct.h
@@ -3,7 +3,7 @@
 #ifndef SCM_STRUCT_H
 #define SCM_STRUCT_H
 
-/* Copyright (C) 1995,1997,1999,2000,2001, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999,2000,2001, 2006, 2007, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -79,7 +79,7 @@ SCM_API SCM scm_struct_table;
 
 #define SCM_STRUCT_GC_CHAIN(X) SCM_CELL_OBJECT_3 (X)
 #define SCM_SET_STRUCT_GC_CHAIN(X, Y) SCM_SET_CELL_OBJECT_3 (X, Y)
-SCM_API SCM scm_i_structs_to_free;
+SCM_INTERNAL SCM scm_i_structs_to_free;
 
 \f
 
@@ -95,7 +95,7 @@ SCM_API SCM scm_struct_vtable_p (SCM x);
 SCM_API SCM scm_make_struct (SCM vtable, SCM tail_array_size, SCM init);
 SCM_API SCM scm_make_vtable (SCM fields, SCM printer);
 SCM_API SCM scm_make_vtable_vtable (SCM extra_fields, SCM tail_array_size, SCM init);
-SCM_API SCM scm_i_struct_equalp (SCM s1, SCM s2);
+SCM_INTERNAL SCM scm_i_struct_equalp (SCM s1, SCM s2);
 SCM_API SCM scm_struct_ref (SCM handle, SCM pos);
 SCM_API SCM scm_struct_set_x (SCM handle, SCM pos, SCM val);
 SCM_API SCM scm_struct_vtable (SCM handle);
@@ -106,7 +106,7 @@ SCM_API SCM scm_struct_vtable_name (SCM vtable);
 SCM_API SCM scm_set_struct_vtable_name_x (SCM vtable, SCM name);
 SCM_API void scm_print_struct (SCM exp, SCM port, scm_print_state *);
 SCM_API void scm_struct_prehistory (void);
-SCM_API void scm_init_struct (void);
+SCM_INTERNAL void scm_init_struct (void);
 
 #endif  /* SCM_STRUCT_H */
 
diff --git a/libguile/symbols.h b/libguile/symbols.h
index f70d655..c2dc183 100644
--- a/libguile/symbols.h
+++ b/libguile/symbols.h
@@ -3,7 +3,7 @@
 #ifndef SCM_SYMBOLS_H
 #define SCM_SYMBOLS_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -61,11 +61,11 @@ SCM_API SCM scm_take_locale_symboln (char *sym, size_t len);
 
 /* internal functions. */
 
-SCM_API unsigned long scm_i_hash_symbol (SCM obj, unsigned long n,
+SCM_INTERNAL unsigned long scm_i_hash_symbol (SCM obj, unsigned long n,
 					 void *closure);
 
-SCM_API void scm_symbols_prehistory (void);
-SCM_API void scm_init_symbols (void);
+SCM_INTERNAL void scm_symbols_prehistory (void);
+SCM_INTERNAL void scm_init_symbols (void);
 
 #endif  /* SCM_SYMBOLS_H */
 
diff --git a/libguile/threads.h b/libguile/threads.h
index 49d1f2e..c9992b4 100644
--- a/libguile/threads.h
+++ b/libguile/threads.h
@@ -137,23 +137,23 @@ SCM_API SCM scm_spawn_thread (scm_t_catch_body body, void *body_data,
 SCM_API void *scm_without_guile (void *(*func)(void *), void *data);
 SCM_API void *scm_with_guile (void *(*func)(void *), void *data);
 
-SCM_API void *scm_i_with_guile_and_parent (void *(*func)(void *), void *data,
-					   SCM parent);
+SCM_INTERNAL void *scm_i_with_guile_and_parent (void *(*func)(void *),
+						void *data, SCM parent);
 
 
 extern int scm_i_thread_go_to_sleep;
 
-void scm_i_thread_put_to_sleep (void);
-void scm_i_thread_wake_up (void);
-void scm_i_thread_invalidate_freelists (void);
+SCM_INTERNAL void scm_i_thread_put_to_sleep (void);
+SCM_INTERNAL void scm_i_thread_wake_up (void);
+SCM_INTERNAL void scm_i_thread_invalidate_freelists (void);
 void scm_i_thread_sleep_for_gc (void);
 
-void scm_threads_prehistory (SCM_STACKITEM *);
-void scm_threads_init_first_thread (void);
-SCM_API void scm_threads_mark_stacks (void);
-SCM_API void scm_init_threads (void);
-SCM_API void scm_init_thread_procs (void);
-SCM_API void scm_init_threads_default_dynamic_state (void);
+SCM_INTERNAL void scm_threads_prehistory (SCM_STACKITEM *);
+SCM_INTERNAL void scm_threads_init_first_thread (void);
+SCM_INTERNAL void scm_threads_mark_stacks (void);
+SCM_INTERNAL void scm_init_threads (void);
+SCM_INTERNAL void scm_init_thread_procs (void);
+SCM_INTERNAL void scm_init_threads_default_dynamic_state (void);
 
 
 #define SCM_THREAD_SWITCHING_CODE \
@@ -208,7 +208,7 @@ SCM_API scm_i_pthread_key_t scm_i_thread_key;
 #define scm_i_set_last_debug_frame(f) \
                                  (SCM_I_CURRENT_THREAD->last_debug_frame = (f))
 
-SCM_API scm_i_pthread_mutex_t scm_i_misc_mutex;
+SCM_INTERNAL scm_i_pthread_mutex_t scm_i_misc_mutex;
 
 /* Convenience functions for working with the pthread API in guile
    mode.
diff --git a/libguile/throw.h b/libguile/throw.h
index 84b0aa9..3cd5572 100644
--- a/libguile/throw.h
+++ b/libguile/throw.h
@@ -3,7 +3,7 @@
 #ifndef SCM_THROW_H
 #define SCM_THROW_H
 
-/* Copyright (C) 1995,1996,1998,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -94,7 +94,7 @@ SCM_API SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
 SCM_API SCM scm_ithrow (SCM key, SCM args, int noreturn);
 
 SCM_API SCM scm_throw (SCM key, SCM args);
-SCM_API void scm_init_throw (void);
+SCM_INTERNAL void scm_init_throw (void);
 
 #endif  /* SCM_THROW_H */
 
diff --git a/libguile/unif.h b/libguile/unif.h
index 1ce3a8f..a09bfc9 100644
--- a/libguile/unif.h
+++ b/libguile/unif.h
@@ -3,7 +3,7 @@
 #ifndef SCM_UNIF_H
 #define SCM_UNIF_H
 
-/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -162,9 +162,9 @@ SCM_API scm_t_bits scm_i_tc16_enclosed_array;
 #define SCM_I_ARRAY_DIMS(a) \
   ((scm_t_array_dim *)((char *) SCM_I_ARRAY_MEM (a) + sizeof (scm_i_t_array)))
 
-SCM_API SCM scm_i_make_ra (int ndim, int enclosed);
-SCM_API SCM scm_i_cvref (SCM v, size_t p, int enclosed);
-SCM_API SCM scm_i_read_array (SCM port, int c);
+SCM_INTERNAL SCM scm_i_make_ra (int ndim, int enclosed);
+SCM_INTERNAL SCM scm_i_cvref (SCM v, size_t p, int enclosed);
+SCM_INTERNAL SCM scm_i_read_array (SCM port, int c);
 
 /* deprecated. */
 
@@ -183,7 +183,7 @@ SCM_API int scm_raprin1 (SCM exp, SCM port, scm_print_state *pstate);
 
 #endif
 
-SCM_API void scm_init_unif (void);
+SCM_INTERNAL void scm_init_unif (void);
 
 #endif  /* SCM_UNIF_H */
 
diff --git a/libguile/values.h b/libguile/values.h
index bc603c1..f05ce9f 100644
--- a/libguile/values.h
+++ b/libguile/values.h
@@ -3,7 +3,7 @@
 #ifndef SCM_VALUES_H
 #define SCM_VALUES_H
 
-/* Copyright (C) 2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ SCM_API SCM scm_values_vtable;
                         && scm_is_eq (scm_struct_vtable (x), scm_values_vtable))
 
 SCM_API SCM scm_values (SCM args);
-SCM_API void scm_init_values (void);
+SCM_INTERNAL void scm_init_values (void);
 
 #endif  /* SCM_VALUES_H */
 
diff --git a/libguile/variable.h b/libguile/variable.h
index 2f2e1a5..3f6398b 100644
--- a/libguile/variable.h
+++ b/libguile/variable.h
@@ -3,7 +3,7 @@
 #ifndef SCM_VARIABLE_H
 #define SCM_VARIABLE_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -43,9 +43,9 @@ SCM_API SCM scm_variable_ref (SCM var);
 SCM_API SCM scm_variable_set_x (SCM var, SCM val);
 SCM_API SCM scm_variable_bound_p (SCM var);
 
-SCM_API void scm_i_variable_print (SCM var, SCM port, scm_print_state *pstate);
+SCM_INTERNAL void scm_i_variable_print (SCM var, SCM port, scm_print_state *pstate);
 
-SCM_API void scm_init_variable (void);
+SCM_INTERNAL void scm_init_variable (void);
 
 #endif  /* SCM_VARIABLE_H */
 
diff --git a/libguile/vectors.h b/libguile/vectors.h
index b1def06..28a576c 100644
--- a/libguile/vectors.h
+++ b/libguile/vectors.h
@@ -3,7 +3,7 @@
 #ifndef SCM_VECTORS_H
 #define SCM_VECTORS_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001,2002,2004,2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001,2002,2004,2005, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -82,8 +82,8 @@ SCM_API void scm_generalized_vector_get_handle (SCM vec,
 #define SCM_I_VECTOR_WELTS(x)  ((SCM *) SCM_CELL_WORD_1 (x))
 #define SCM_I_VECTOR_LENGTH(x) (((size_t) SCM_CELL_WORD_0 (x)) >> 8)
 
-SCM_API void scm_i_vector_free (SCM vec);
-SCM_API SCM  scm_i_vector_equal_p (SCM x, SCM y);
+SCM_INTERNAL void scm_i_vector_free (SCM vec);
+SCM_INTERNAL SCM  scm_i_vector_equal_p (SCM x, SCM y);
 
 /* Weak vectors share implementation details with ordinary vectors,
    but no one else should.
@@ -99,9 +99,9 @@ SCM_API SCM  scm_i_vector_equal_p (SCM x, SCM y);
 #define SCM_I_WVECT_GC_CHAIN(x)         (SCM_CELL_OBJECT_3 (x))
 #define SCM_I_SET_WVECT_GC_CHAIN(x, o)  (SCM_SET_CELL_OBJECT_3 ((x), (o)))
 
-SCM_API SCM scm_i_allocate_weak_vector (scm_t_bits type, SCM size, SCM fill);
+SCM_INTERNAL SCM scm_i_allocate_weak_vector (scm_t_bits type, SCM size, SCM fill);
 
-SCM_API void scm_init_vectors (void);
+SCM_INTERNAL void scm_init_vectors (void);
 
 #endif  /* SCM_VECTORS_H */
 
diff --git a/libguile/version.h.in b/libguile/version.h.in
index 1d8f277..b565efd 100644
--- a/libguile/version.h.in
+++ b/libguile/version.h.in
@@ -3,7 +3,7 @@
 #ifndef SCM_VERSION_H
 #define SCM_VERSION_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@ SCM_API SCM scm_minor_version (void);
 SCM_API SCM scm_micro_version (void);
 SCM_API SCM scm_effective_version (void);
 SCM_API SCM scm_version (void);
-SCM_API void scm_init_version (void);
+SCM_INTERNAL void scm_init_version (void);
 
 #endif  /* SCM_VERSION_H */
 
diff --git a/libguile/vports.h b/libguile/vports.h
index c25f90f..365303b 100644
--- a/libguile/vports.h
+++ b/libguile/vports.h
@@ -3,7 +3,7 @@
 #ifndef SCM_VPORTS_H
 #define SCM_VPORTS_H
 
-/* Copyright (C) 1995,1996,2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,7 @@
 \f
 
 SCM_API SCM scm_make_soft_port (SCM pv, SCM modes);
-SCM_API void scm_init_vports (void);
+SCM_INTERNAL void scm_init_vports (void);
 
 #endif  /* SCM_VPORTS_H */
 
diff --git a/libguile/weaks.h b/libguile/weaks.h
index bf854d5..34c44a9 100644
--- a/libguile/weaks.h
+++ b/libguile/weaks.h
@@ -3,7 +3,7 @@
 #ifndef SCM_WEAKS_H
 #define SCM_WEAKS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2003, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -62,13 +62,13 @@ SCM_API SCM scm_make_doubly_weak_alist_vector (SCM k);
 SCM_API SCM scm_weak_key_alist_vector_p (SCM x);
 SCM_API SCM scm_weak_value_alist_vector_p (SCM x);
 SCM_API SCM scm_doubly_weak_alist_vector_p (SCM x);
-SCM_API SCM scm_init_weaks_builtins (void);
-SCM_API void scm_init_weaks (void);
+SCM_INTERNAL SCM scm_init_weaks_builtins (void);
+SCM_INTERNAL void scm_init_weaks (void);
 
-SCM_API void scm_i_init_weak_vectors_for_gc (void);
-SCM_API void scm_i_mark_weak_vector (SCM w);
-SCM_API int scm_i_mark_weak_vectors_non_weaks (void);
-SCM_API void scm_i_remove_weaks_from_weak_vectors (void);
+SCM_INTERNAL void scm_i_init_weak_vectors_for_gc (void);
+SCM_INTERNAL void scm_i_mark_weak_vector (SCM w);
+SCM_INTERNAL int scm_i_mark_weak_vectors_non_weaks (void);
+SCM_INTERNAL void scm_i_remove_weaks_from_weak_vectors (void);
 
 
 #endif  /* SCM_WEAKS_H */
diff --git a/test-suite/standalone/test-gh.c b/test-suite/standalone/test-gh.c
index 4d91cce..b273b44 100644
--- a/test-suite/standalone/test-gh.c
+++ b/test-suite/standalone/test-gh.c
@@ -31,7 +31,7 @@ string_equal (SCM str, char *lit)
   int len = strlen (lit);
   int result;
  
-  result = ((scm_i_string_length (str) == len)
+  result = ((scm_c_string_length (str) == len)
             && (!memcmp (scm_i_string_chars (str), lit, len)));
   scm_remember_upto_here_1 (str);
   return result;
-- 
1.5.5


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-05-14  3:45             ` Internal visibility Ludovic Courtès
@ 2008-05-27 21:32               ` Ludovic Courtès
  2008-05-31 21:23                 ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-27 21:32 UTC (permalink / raw)
  To: guile-devel

Hi,

ludo@gnu.org (Ludovic Courtès) writes:

> Your enthusiasm gave me an incentive to go ahead and try it out (see
> attached patch against `master').  This brings the number of exported
> `scm_i_' symbols (as seen with "objdump -T") down from 195 to 68 here,
> which should slightly reduce load time since it gives less work to the
> loader.  The patch also marks the `scm_init' functions as internal.  It
> uses "internal" visibility, not just "hidden" (see "Function Attributes"
> node of the GCC manual).
>
> A few functions had to be left public: those used in public macros or
> inlines, some functions of `numbers.c' that are used in `srfi-60', and
> `scm_i_string_{writable_,}chars ()' functions which have been used
> outside (e.g., in G-Wrap, IIRC) as they're too convenient...
>
> I know Guile-VM uses a few internal functions/macros, so Andy will have
> to check whether this breaks anything (and propose a new public API if
> it does :-)).  It would be great to double-check with other code that
> uses Guile.  Then if that looks acceptable, we can commit it, including
> to the 1.8 branch.

I'd like to push the patch within the next few days if nobody complains,
alright?

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-05-27 21:32               ` Ludovic Courtès
@ 2008-05-31 21:23                 ` Ludovic Courtès
  2008-06-01  8:00                   ` Neil Jerram
  2008-06-01 20:24                   ` Han-Wen Nienhuys
  0 siblings, 2 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-05-31 21:23 UTC (permalink / raw)
  To: guile-devel

Hi,

ludo@gnu.org (Ludovic Courtès) writes:

> I'd like to push the patch within the next few days if nobody complains,
> alright?

Done!

Opinions about making `scm_i_{string,symbol}_chars' internal as well?

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-05-31 21:23                 ` Ludovic Courtès
@ 2008-06-01  8:00                   ` Neil Jerram
  2008-06-01 11:05                     ` Ludovic Courtès
  2008-06-01 20:24                   ` Han-Wen Nienhuys
  1 sibling, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-06-01  8:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

2008/5/31 Ludovic Courtès <ludo@gnu.org>:
>
> Opinions about making `scm_i_{string,symbol}_chars' internal as well?

Is that a more controversial case?  (I have a vague recollection that
it is, but can't remember the detail.)

     Neil




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-01  8:00                   ` Neil Jerram
@ 2008-06-01 11:05                     ` Ludovic Courtès
  2008-06-01 20:48                       ` Neil Jerram
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-01 11:05 UTC (permalink / raw)
  To: guile-devel

Hello,

"Neil Jerram" <neiljerram@googlemail.com> writes:

> 2008/5/31 Ludovic Courtès <ludo@gnu.org>:
>>
>> Opinions about making `scm_i_{string,symbol}_chars' internal as well?
>
> Is that a more controversial case?  (I have a vague recollection that
> it is, but can't remember the detail.)

It's just that it's convenient and equivalent to 1.6's `SCM_STRING_CHARS ()',
so people have come to use it...  According to Google's codesearch,
`scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND and
a few others.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-05-31 21:23                 ` Ludovic Courtès
  2008-06-01  8:00                   ` Neil Jerram
@ 2008-06-01 20:24                   ` Han-Wen Nienhuys
  2008-06-09 18:10                     ` Neil Jerram
  1 sibling, 1 reply; 33+ messages in thread
From: Han-Wen Nienhuys @ 2008-06-01 20:24 UTC (permalink / raw)
  To: guile-devel

Ludovic Courtès escreveu:
> Hi,
> 
> ludo@gnu.org (Ludovic Courtès) writes:
> 
>> I'd like to push the patch within the next few days if nobody complains,
>> alright?
> 
> Done!
> 
> Opinions about making `scm_i_{string,symbol}_chars' internal as well?

Can someone explain to me why accessing the underlying (const char*)
of a string should be internal? If you are writing C++, doing

  const char* ptr = scm_i_string_chars(scmval);
  string x(ptr);

is the most straightforward and efficient way to create a string.
Using the API incurs an additional malloc, memcpy and free.

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-01 11:05                     ` Ludovic Courtès
@ 2008-06-01 20:48                       ` Neil Jerram
  2008-06-01 22:02                         ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-06-01 20:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

2008/6/1 Ludovic Courtès <ludo@gnu.org>:
>
> It's just that it's convenient and equivalent to 1.6's `SCM_STRING_CHARS ()',
> so people have come to use it...  According to Google's codesearch,
> `scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND and
> a few others.

IMO that amounts to a strong case for making it an official API.  I
believe the argument against doing that is something to do with future
multi- and variable-byte string encodings - but perhaps we can handle
that as a transitional issue once those encodings are in place?

     Neil




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-01 20:48                       ` Neil Jerram
@ 2008-06-01 22:02                         ` Ludovic Courtès
  0 siblings, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-01 22:02 UTC (permalink / raw)
  To: guile-devel

Hi,

"Neil Jerram" <neiljerram@googlemail.com> writes:

> 2008/6/1 Ludovic Courtès <ludo@gnu.org>:
>>
>> It's just that it's convenient and equivalent to 1.6's `SCM_STRING_CHARS ()',
>> so people have come to use it...  According to Google's codesearch,
>> `scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND and
>> a few others.
>
> IMO that amounts to a strong case for making it an official API.  I
> believe the argument against doing that is something to do with future
> multi- and variable-byte string encodings - but perhaps we can handle
> that as a transitional issue once those encodings are in place?

I did not mark them as internal so as to leave them in this
"semi-official" state.  But it was always clear from 1.8.0 that the `i'
in `scm_i_' means "internal" and that applications could only use it at
their own risk, so I wouldn't want to go as far as documenting or
encouraging it.

As Clinton said, there were good reasons for these functions to be
internal in the first place, and it seems more reasonable to keep it
this way.  We *will* support Unicode eventually, right?  :-)

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-01 20:24                   ` Han-Wen Nienhuys
@ 2008-06-09 18:10                     ` Neil Jerram
  2008-06-10  1:51                       ` Han-Wen Nienhuys
  0 siblings, 1 reply; 33+ messages in thread
From: Neil Jerram @ 2008-06-09 18:10 UTC (permalink / raw)
  To: hanwen; +Cc: guile-devel

2008/6/1 Han-Wen Nienhuys <hanwen@xs4all.nl>:

>  const char* ptr = scm_i_string_chars(scmval);
>  string x(ptr);
>
> is the most straightforward and efficient way to create a string.
> Using the API incurs an additional malloc, memcpy and free.

Does "string x(ptr)" incur a malloc and memcpy?

I assume it must do, or else the code above would be unsafe (sharing
memory between the C++ and SCM strings).  So, assuming it does, why do
you think this is Guile's problem, and not C++'s?

To put it another way: can you use another form of C++ string
construction that does not do a malloc/memcpy itself, but takes
ownership of the char * that is passed to it?  Then you could use this
together with scm_to_locale_string(), and you'd still only have one
malloc/memcpy overall.

Guile's string API is aiming not to be 8-bit-assuming, and I would
guess from the code above that the C++ string class is 8-bit-assuming.
 Therefore, in the sequence

   SCM   ->   char *    ->    string

it makes sense to have the malloc/memcpy between SCM and char *, not
between char * and string.

More generally, as regards cases where people are currently using
scm_i_string_chars(), I can imagine that there are good reasons why -
e.g. searching for a particular character or substring.  But I think
we should be aiming to encapsulate those uses in new APIs that will
still work when Guile has non-8-bit strings.

Regards,
       Neil




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-09 18:10                     ` Neil Jerram
@ 2008-06-10  1:51                       ` Han-Wen Nienhuys
  2008-06-10  7:37                         ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Han-Wen Nienhuys @ 2008-06-10  1:51 UTC (permalink / raw)
  To: Neil Jerram; +Cc: guile-devel

On Mon, Jun 9, 2008 at 3:10 PM, Neil Jerram <neiljerram@googlemail.com> wrote:
> 2008/6/1 Han-Wen Nienhuys <hanwen@xs4all.nl>:
>
>>  const char* ptr = scm_i_string_chars(scmval);
>>  string x(ptr);
>>
>> is the most straightforward and efficient way to create a string.
>> Using the API incurs an additional malloc, memcpy and free.
>
> Does "string x(ptr)" incur a malloc and memcpy?
>
> I assume it must do, or else the code above would be unsafe (sharing
> memory between the C++ and SCM strings).  So, assuming it does, why do
> you think this is Guile's problem, and not C++'s?

I think there is some confusion here.  To me, a string is a sequence
of bytes. When I need higher level behavior (eg. UTF-x handling), I
convert the sequence of bytes appropriately.  Does the insistence on
not providing a const char* interface mean that there are plans to
change the representation dynamically?

> Guile's string API is aiming not to be 8-bit-assuming, and I would
> guess from the code above that the C++ string class is 8-bit-assuming.

Sorry, I guess I don't understand. What _is_the assumption for
representing strings in GUILE?

-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-10  1:51                       ` Han-Wen Nienhuys
@ 2008-06-10  7:37                         ` Ludovic Courtès
  2008-06-10  8:04                           ` Thien-Thi Nguyen
  2008-06-11  4:05                           ` Han-Wen Nienhuys
  0 siblings, 2 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-10  7:37 UTC (permalink / raw)
  To: guile-devel

Hello,

"Han-Wen Nienhuys" <hanwenn@gmail.com> writes:

> On Mon, Jun 9, 2008 at 3:10 PM, Neil Jerram <neiljerram@googlemail.com> wrote:

>> Guile's string API is aiming not to be 8-bit-assuming, and I would
>> guess from the code above that the C++ string class is 8-bit-assuming.
>
> Sorry, I guess I don't understand. What _is_the assumption for
> representing strings in GUILE?

Strings in Guile will eventually be sequences of Unicode code points (as
opposed to "bytes"), which can be represented in a variety of different
ways (UTF-8, UCS-4, etc.).  How Guile represents strings and whether
this representation "changes dynamically" (as you suggested) should not
be exposed to the applications in order to leave as much freedom as
possible to Guile's implementation strategy.

Instead, applications should be written against an encoding-oblivious
API.  This is what core R5RS constructs and SRFI-1[34] provide at the
Scheme level.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-10  7:37                         ` Ludovic Courtès
@ 2008-06-10  8:04                           ` Thien-Thi Nguyen
  2008-06-10 12:09                             ` Ludovic Courtès
  2008-06-11  4:05                           ` Han-Wen Nienhuys
  1 sibling, 1 reply; 33+ messages in thread
From: Thien-Thi Nguyen @ 2008-06-10  8:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

() ludo@gnu.org (Ludovic Courtès)
() Tue, 10 Jun 2008 09:37:39 +0200

   Instead, applications should be written against an
   encoding-oblivious API.  This is what core R5RS constructs
   and SRFI-1[34] provide at the Scheme level.

Unfortunately, that position doesn't provide a clean path
towards an encoding-knowledgable API.  Better would be to design
an encoding-knowledgable API now (or as soon as possible), with
the encoding value `unencoded' (or `8-bit-raw' or what-have-you)
as default.  This way, things are explicit and the (future)
changes to application code will be less invasive, or even
unnecessary.

In short, the current API is not actually "future proof" (yet).
Requiring obliviousness in the API makes for ugly work long term.

thi




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-10  8:04                           ` Thien-Thi Nguyen
@ 2008-06-10 12:09                             ` Ludovic Courtès
  2008-06-11  7:49                               ` Thien-Thi Nguyen
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-10 12:09 UTC (permalink / raw)
  To: guile-devel

Hi,

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> Unfortunately, that position doesn't provide a clean path
> towards an encoding-knowledgable API.

Perhaps I shouldn't have qualified the API as "encoding-oblivious".

What I really meant is that the API should not expose the *internal*
string representation.  But of course, it should allow the user to
transfer a Scheme string to a C string with a given representation.

Currently, Guile only supports `scm_to_locale_string ()', which means
the returned C string is encoded in the current locale's encoding.
Eventually, new functions may be added: `scm_to_utf8_string ()', etc.
This was Marius' original plan [0], and I think it remains valid.

Thanks,
Ludovic.

[0] http://thread.gmane.org/gmane.lisp.guile.devel/3588





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-10  7:37                         ` Ludovic Courtès
  2008-06-10  8:04                           ` Thien-Thi Nguyen
@ 2008-06-11  4:05                           ` Han-Wen Nienhuys
  2008-06-11  7:18                             ` Ludovic Courtès
                                               ` (2 more replies)
  1 sibling, 3 replies; 33+ messages in thread
From: Han-Wen Nienhuys @ 2008-06-11  4:05 UTC (permalink / raw)
  To: guile-devel

Ludovic Courtès escreveu:
>>> Guile's string API is aiming not to be 8-bit-assuming, and I would
>>> guess from the code above that the C++ string class is 8-bit-assuming.
>> Sorry, I guess I don't understand. What _is_the assumption for
>> representing strings in GUILE?
> 
> Strings in Guile will eventually be sequences of Unicode code points (as
> opposed to "bytes"), which can be represented in a variety of different
> ways (UTF-8, UCS-4, etc.).  How Guile represents strings and whether
> this representation "changes dynamically" (as you suggested) should not
> be exposed to the applications in order to leave as much freedom as
> possible to Guile's implementation strategy.

I think that a sequence of Unicode code points this is a somewhat
limited view of how strings should be used.  Among others, the
implication is that programs cannot rely on being able to index a
string in O(1) time (since the string might be UTF-x encoded).

What do I use if I want to have guaranteed O(1) indexing -that is- if
I want to manipulate strings of bytes?  

How would I read the contents of a binary file without jumping through 
encoding hoops?

FWIW, I think ttn's suggestion is an excellent one.

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  4:05                           ` Han-Wen Nienhuys
@ 2008-06-11  7:18                             ` Ludovic Courtès
  2008-06-11  7:24                             ` Clinton Ebadi
  2008-06-11  7:37                             ` Neil Jerram
  2 siblings, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-11  7:18 UTC (permalink / raw)
  To: guile-devel

Hi,

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> What do I use if I want to have guaranteed O(1) indexing -that is- if
> I want to manipulate strings of bytes?  

That's an interesting but different story: whether `string-{ref,set!}'
are O(1) doesn't influence the Scheme/C string conversion API design
since, again, it's not desirable to expose Guile's internal string
representation.

(If you really want to investigate that question, Will Clinger has a
very good page on the topic:
http://larceny.ccs.neu.edu/larceny-trac/wiki/StringRepresentations .)

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  4:05                           ` Han-Wen Nienhuys
  2008-06-11  7:18                             ` Ludovic Courtès
@ 2008-06-11  7:24                             ` Clinton Ebadi
  2008-06-11  7:39                               ` Ludovic Courtès
  2008-06-11 16:09                               ` Han-Wen Nienhuys
  2008-06-11  7:37                             ` Neil Jerram
  2 siblings, 2 replies; 33+ messages in thread
From: Clinton Ebadi @ 2008-06-11  7:24 UTC (permalink / raw)
  To: hanwen; +Cc: guile-devel

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Ludovic Courtès escreveu:
>>>> Guile's string API is aiming not to be 8-bit-assuming, and I would
>>>> guess from the code above that the C++ string class is 8-bit-assuming.
>>> Sorry, I guess I don't understand. What _is_the assumption for
>>> representing strings in GUILE?
>> 
>> Strings in Guile will eventually be sequences of Unicode code points (as
>> opposed to "bytes"), which can be represented in a variety of different
>> ways (UTF-8, UCS-4, etc.).  How Guile represents strings and whether
>> this representation "changes dynamically" (as you suggested) should not
>> be exposed to the applications in order to leave as much freedom as
>> possible to Guile's implementation strategy.
>
> I think that a sequence of Unicode code points this is a somewhat
> limited view of how strings should be used.  Among others, the
> implication is that programs cannot rely on being able to index a
> string in O(1) time (since the string might be UTF-x encoded).
>
> What do I use if I want to have guaranteed O(1) indexing -that is- if
> I want to manipulate strings of bytes?  
>
> How would I read the contents of a binary file without jumping through 
> encoding hoops?

Uniform byte vectors. If you're using C you can just read everything
into a normal C array and then use
scm_take_u8_vector()/scm_u8vector_elements().

-- 
thehurdguy: LOL you'll end up being like that urban myth
thehurdguy: the guy that thinks he's orange juice
thehurdguy: I'll be like "dude, I know a lisp programmer who did
            so much acid, he thinks he's an empty list..."




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  4:05                           ` Han-Wen Nienhuys
  2008-06-11  7:18                             ` Ludovic Courtès
  2008-06-11  7:24                             ` Clinton Ebadi
@ 2008-06-11  7:37                             ` Neil Jerram
  2 siblings, 0 replies; 33+ messages in thread
From: Neil Jerram @ 2008-06-11  7:37 UTC (permalink / raw)
  To: hanwen; +Cc: guile-devel

2008/6/11 Han-Wen Nienhuys <hanwen@xs4all.nl>:
>
> I think that a sequence of Unicode code points this is a somewhat
> limited view of how strings should be used.  Among others, the
> implication is that programs cannot rely on being able to index a
> string in O(1) time (since the string might be UTF-x encoded).
>
> What do I use if I want to have guaranteed O(1) indexing -that is- if
> I want to manipulate strings of bytes?
>
> How would I read the contents of a binary file without jumping through
> encoding hoops?

A uniform byte array?

    Neil




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  7:24                             ` Clinton Ebadi
@ 2008-06-11  7:39                               ` Ludovic Courtès
  2008-06-11 16:09                               ` Han-Wen Nienhuys
  1 sibling, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-11  7:39 UTC (permalink / raw)
  To: guile-devel

Clinton Ebadi <clinton@unknownlamer.org> writes:

> Uniform byte vectors. If you're using C you can just read everything
> into a normal C array and then use
> scm_take_u8_vector()/scm_u8vector_elements().

Ah yes, good answer.  There's also the wonderful bytevector API in
guile-r6rs-libs at http://repo.or.cz/w/guile-r6rs-libs.git .  :-)

Thanks,
Ludo'.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-10 12:09                             ` Ludovic Courtès
@ 2008-06-11  7:49                               ` Thien-Thi Nguyen
  2008-06-11 12:20                                 ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Thien-Thi Nguyen @ 2008-06-11  7:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

() ludo@gnu.org (Ludovic Courtès)
() Tue, 10 Jun 2008 14:09:33 +0200

   Currently, Guile only supports `scm_to_locale_string ()', which means
   the returned C string is encoded in the current locale's encoding.
   Eventually, new functions may be added: `scm_to_utf8_string ()', etc.
   This was Marius' original plan [0], and I think it remains valid.

Most plans are "valid" but not all plans are easy to live with.

I think the encoding of a string (or buffer or "character" array
(or subsequence thereof)) needs to be explicit; the encoding is
not purely "internal" and to treat it as such will require hoop-
jumping on both sides of the API.  (How encoding support is
implemented, on the other hand, is indeed an internal affair.)

This is from observation of how Emacs attained multibyte-ness.
Note: not just "how Emacs does it" but "how Emacs used to not do
it and through time eventually came to do it".

In PostgreSQL's multibyte support, the i/o can be tempered by
setting the "client encoding".  This can be changed cheaply (per
request).  Basing encoding on locale only is not fine-grained
enough; setting the locale can be expensive and cause unrelated
changes.

See also GNU libc support (info "(libc) Character Set Handling"),
which applies similar principles at a lower (library) level.

All these programs chose not to expose many conversion functions
in the programming interface.  Instead, they expose few functions,
each with an encoding parameter.  That is surely a cleaner design.

thi




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  7:49                               ` Thien-Thi Nguyen
@ 2008-06-11 12:20                                 ` Ludovic Courtès
  2008-06-12 20:45                                   ` Mike Gran
  0 siblings, 1 reply; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-11 12:20 UTC (permalink / raw)
  To: guile-devel

Hi,

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> I think the encoding of a string (or buffer or "character" array
> (or subsequence thereof)) needs to be explicit;

RnRS doesn't specify any encoding.  R5RS Section 6.3.5 just says
"Strings are sequences of characters."  R6RS Section 1 goes further by
saying "Strings are finite sequences of characters with fixed length and
thus represent arbitrary Unicode texts."  None of them refers to
"encoding".

> All these programs chose not to expose many conversion functions
> in the programming interface.  Instead, they expose few functions,
> each with an encoding parameter.  That is surely a cleaner design.

Yes, that's probably a good idea.  At any rate, we only have
`scm_to_locale_string ()' currently so it's not too late to add a single
function with an encoding parameter in lieu of the proposed
`scm_to_{utf8,utf16,utf32,ucs4,...}_string ()'.

But first of all, one needs to implement Unicode support.  ;-)

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11  7:24                             ` Clinton Ebadi
  2008-06-11  7:39                               ` Ludovic Courtès
@ 2008-06-11 16:09                               ` Han-Wen Nienhuys
  2008-06-23 12:18                                 ` Ludovic Courtès
  1 sibling, 1 reply; 33+ messages in thread
From: Han-Wen Nienhuys @ 2008-06-11 16:09 UTC (permalink / raw)
  To: Clinton Ebadi; +Cc: guile-devel

On Wed, Jun 11, 2008 at 4:24 AM, Clinton Ebadi <clinton@unknownlamer.org> wrote:
>>> Strings in Guile will eventually be sequences of Unicode code points (as
>>> opposed to "bytes"), which can be represented in a variety of different
>>> ways (UTF-8, UCS-4, etc.).  How Guile represents strings and whether
>>> this representation "changes dynamically" (as you suggested) should not
>>> be exposed to the applications in order to leave as much freedom as
>>> possible to Guile's implementation strategy.
>>
>> I think that a sequence of Unicode code points this is a somewhat
>> limited view of how strings should be used.  Among others, the
>> implication is that programs cannot rely on being able to index a
>> string in O(1) time (since the string might be UTF-x encoded).
>>
>> What do I use if I want to have guaranteed O(1) indexing -that is- if
>> I want to manipulate strings of bytes?
>>
>> How would I read the contents of a binary file without jumping through
>> encoding hoops?
>
> Uniform byte vectors. If you're using C you can just read everything
> into a normal C array and then use
> scm_take_u8_vector()/scm_u8vector_elements().


Are you serious? You want me to run regexes over uniform vectors?
concatenating uniform vectors? doing a scm_display and being able to
make sense of it?

What scares me of this idea of doing The Right Thing with unicode of me is that

Judging by the signature of the functions, the char* <-> string
conversion are thought to (in the future, at least) change their
behavior depending on the LC_LOCALE environment setting.  If I would
use strings rather than uniform vectors (which seems wise if I don't
want to reimplement half of guile)

* the performance of my software will be dependent on what users
happen to have in their LOCALE.  If I am unlucky, every string that
passes through the C interface will transcoded from and to UTF-x
implicitly.

* GUILE is thought to only support one locale at a time. No using
GUILE to transcode strings, for example.

Can we at least have a scm_to_locale_stringn() that takes an explicit
encoding/locale parameter, so that I can have some guarantee of how
GUILE is (not) munging my strings?

-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11 12:20                                 ` Ludovic Courtès
@ 2008-06-12 20:45                                   ` Mike Gran
  2008-06-23 12:20                                     ` Ludovic Courtès
  0 siblings, 1 reply; 33+ messages in thread
From: Mike Gran @ 2008-06-12 20:45 UTC (permalink / raw)
  To: guile-devel

Ludovic Courtès <ludo <at> gnu.org> writes:

> Yes, that's probably a good idea.  At any rate, we only have
> `scm_to_locale_string ()' currently so it's not too late to add a single
> function with an encoding parameter in lieu of the proposed
> `scm_to_{utf8,utf16,utf32,ucs4,...}_string ()'.
> 
> But first of all, one needs to implement Unicode support.  

FWIW, I have a complete unicode support library for Guile called GuICU.  It 
lives at http://gano.sourceforge.net.  It works for me, but, hasn't been 
widely tested.

It is built on the large and cumbersome IBM ICU library.  ICU encodes things 
internally as UTF16, which I always though of as a poor idea, since neither 
allows O(1) seeking of individual codepoints nor works so well with UTF-8.

Based on my experience with ICU and putting this library together, and looking 
at what r6rs claims should be the future for Unicode, I really do think that 
UTF-32 is the way to go. 

Alternately, one could build a string library where strings are represented as 
either u8 or u32 vectors.  If a string function is asked to operate on a u32 
vector, it will assume a UTF32 encoding.  If a string function is asked to 
operate on a u8 vector it will either require a locale or, as a fallback, 
treat the string as a raw byte vector.

This would be twice the work to implement, though.






^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-11 16:09                               ` Han-Wen Nienhuys
@ 2008-06-23 12:18                                 ` Ludovic Courtès
  0 siblings, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-23 12:18 UTC (permalink / raw)
  To: guile-devel

Hi,

"Han-Wen Nienhuys" <hanwenn@gmail.com> writes:

> Can we at least have a scm_to_locale_stringn() that takes an explicit
> encoding/locale parameter, so that I can have some guarantee of how
> GUILE is (not) munging my strings?

Yes, that's "future work", as mentioned in other messages.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Internal visibility
  2008-06-12 20:45                                   ` Mike Gran
@ 2008-06-23 12:20                                     ` Ludovic Courtès
  0 siblings, 0 replies; 33+ messages in thread
From: Ludovic Courtès @ 2008-06-23 12:20 UTC (permalink / raw)
  To: guile-devel

Hi,

Mike Gran <spk121@yahoo.com> writes:

> FWIW, I have a complete unicode support library for Guile called GuICU.  It 
> lives at http://gano.sourceforge.net.  It works for me, but, hasn't been 
> widely tested.

That's nice.  However, I suppose you end up having disjoint string and
char types, right?  If so, applications may need to convert back and
forth from Guile strings/chars to GuICU strings/chars.

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2008-06-23 12:20 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 23:46 [PATCH] Fix continuation problems on IA64 Neil Jerram
2008-05-08 20:09 ` Ludovic Courtès
2008-05-08 21:29   ` Neil Jerram
2008-05-09  8:15     ` Ludovic Courtès
2008-05-09 22:19       ` Neil Jerram
2008-05-11  3:06         ` Ludovic Courtès
2008-05-12 21:02           ` Neil Jerram
2008-05-14  3:45             ` Internal visibility Ludovic Courtès
2008-05-27 21:32               ` Ludovic Courtès
2008-05-31 21:23                 ` Ludovic Courtès
2008-06-01  8:00                   ` Neil Jerram
2008-06-01 11:05                     ` Ludovic Courtès
2008-06-01 20:48                       ` Neil Jerram
2008-06-01 22:02                         ` Ludovic Courtès
2008-06-01 20:24                   ` Han-Wen Nienhuys
2008-06-09 18:10                     ` Neil Jerram
2008-06-10  1:51                       ` Han-Wen Nienhuys
2008-06-10  7:37                         ` Ludovic Courtès
2008-06-10  8:04                           ` Thien-Thi Nguyen
2008-06-10 12:09                             ` Ludovic Courtès
2008-06-11  7:49                               ` Thien-Thi Nguyen
2008-06-11 12:20                                 ` Ludovic Courtès
2008-06-12 20:45                                   ` Mike Gran
2008-06-23 12:20                                     ` Ludovic Courtès
2008-06-11  4:05                           ` Han-Wen Nienhuys
2008-06-11  7:18                             ` Ludovic Courtès
2008-06-11  7:24                             ` Clinton Ebadi
2008-06-11  7:39                               ` Ludovic Courtès
2008-06-11 16:09                               ` Han-Wen Nienhuys
2008-06-23 12:18                                 ` Ludovic Courtès
2008-06-11  7:37                             ` Neil Jerram
2008-05-12 22:18     ` [PATCH] Fix continuation problems on IA64 Neil Jerram
2008-05-14  2:55       ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).