mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] URGENT: Document too large?


Chronological Thread 
  • From: Joris van der Hoeven <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] URGENT: Document too large?
  • Date: Mon, 26 Jun 2006 18:12:36 +0200

On Mon, Jun 26, 2006 at 06:21:40PM +0300, Jani Huhtanen wrote:
> I'm writing my thesis on texmacs, and now at the very last chapter of my
> thesis I stumbled upon a nasty bug/feature. Texmacs does not load my
> document
> anymore. Instead of loading it throws an error:
>
> -- TeXmacs] With linked TrueType support
> ERROR: In procedure scm_allocate_string:
> ERROR: Argument 1 out of range: 28213052
>
> and by staggering coincidence 28213052 (~27Mb) just so happens to be the
> number of bytes in my document. Please tell me that there is an easy fix to
> this!
>
> Until then I'll try to break the document into parts and edit those instead
> which is going to be fun :(

This is a problem with Guile, on which TeXmacs is based,
but which is not part of TeXmacs, so to say.
In the guile source code, I found

#define SCM_STRING_MAX_LENGTH ((1UL << 24) - 1UL)
#define SCM_STRING_LENGTH(x) ((size_t) (SCM_CELL_WORD_0 (x) >> 8))
#define SCM_SET_STRING_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s),
(((long) (l)) << 8) + scm_tc7_string))

This seems to indicate that 2^24 is the maximum allowed length of
a string (about 16Mb). Of course, this is ridiculous.
If you are on a 64 bit architecture, then you may check whether
the following works (recompile Guile and TeXmacs):

#define SCM_STRING_MAX_LENGTH ((1UL << 56) - 1UL)
#define SCM_STRING_LENGTH(x) ((size_t) (SCM_CELL_WORD_0 (x) >> 8))
#define SCM_SET_STRING_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s),
(((long) (l)) << 8) + scm_tc7_string))

If that is so, then you are done. This would leave us with the question
whether the scm_tc7_string really needs to be 8 bits long,
or whether its size could be decreased to, say, 4 bits.

Best wishes, Joris



Archive powered by MHonArc 2.6.19.

Top of page