[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problematic TeX
From: |
Han-Wen Nienhuys |
Subject: |
Problematic TeX |
Date: |
Sat, 15 Mar 2003 01:36:32 +0100 |
address@hidden writes:
> The attached file gives an error when ly2dvi is running the TeX
> produced by lilypond 1.6.8, but ly2dvi seems to cope with it ok.
> However, if I use it in a lilypond-book input file, lilypond-book
> crashes.
Try this patch:
*** scm-hash.cc.~1.22.~ 2003-01-12 23:01:30.000000000 +0100
--- scm-hash.cc 2003-03-15 00:36:33.000000000 +0100
***************
*** 11,24 ****
#include "scm-hash.hh"
#include "ly-smobs.icc"
! void
copy_scm_hashes (SCM dest, SCM src)
{
! for (int i = SCM_SYMBOL_LENGTH (src); i--;)
for (SCM s = scm_vector_ref (src, SCM_MAKINUM (i)); ly_pair_p(s); s =
ly_cdr (s))
{
scm_hashq_set_x (dest, ly_caar (s), ly_cdar (s));
}
}
--- 11,30 ----
#include "scm-hash.hh"
#include "ly-smobs.icc"
! /*
! Return: number of objects.
! */
! int
copy_scm_hashes (SCM dest, SCM src)
{
! int k = 0;
! for (int i = SCM_VECTOR_LENGTH (src); i--;)
for (SCM s = scm_vector_ref (src, SCM_MAKINUM (i)); ly_pair_p(s); s =
ly_cdr (s))
{
scm_hashq_set_x (dest, ly_caar (s), ly_cdar (s));
+ k++;
}
+ return k ;
}
***************
*** 35,45 ****
{
hash_tab_ = SCM_EOL;
! elt_count_ = src.elt_count_;
smobify_self ();
hash_tab_ = scm_make_vector (gh_int2scm (src.elt_count_ >? 11 ), SCM_EOL);
! copy_scm_hashes (hash_tab_, src.hash_tab_);
}
void
--- 41,51 ----
{
hash_tab_ = SCM_EOL;
! elt_count_ = 0;
smobify_self ();
hash_tab_ = scm_make_vector (gh_int2scm (src.elt_count_ >? 11 ), SCM_EOL);
! elt_count_ = copy_scm_hashes (hash_tab_, src.hash_tab_);
}
void
***************
*** 48,56 ****
if (&src == this)
return;
- elt_count_ = src.elt_count_;
hash_tab_ = scm_make_vector (gh_int2scm (src.elt_count_ >? 11), SCM_EOL);
! copy_scm_hashes (hash_tab_, src.hash_tab_);
}
SCM
--- 54,61 ----
if (&src == this)
return;
hash_tab_ = scm_make_vector (gh_int2scm (src.elt_count_ >? 11), SCM_EOL);
! elt_count_ = copy_scm_hashes (hash_tab_, src.hash_tab_);
}
SCM
***************
*** 108,120 ****
/*
resize if getting too large.
*/
! if (elt_count_ > 2 * SCM_SYMBOL_LENGTH (hash_tab_))
{
SCM nh = scm_make_vector (gh_int2scm (3* elt_count_+1), SCM_EOL);
! copy_scm_hashes (nh, hash_tab_);
hash_tab_ = nh;
}
-
}
// UGH.
--- 113,124 ----
/*
resize if getting too large.
*/
! if (elt_count_ > 2 * SCM_VECTOR_LENGTH (hash_tab_))
{
SCM nh = scm_make_vector (gh_int2scm (3* elt_count_+1), SCM_EOL);
! elt_count_ = copy_scm_hashes (nh, hash_tab_);
hash_tab_ = nh;
}
}
// UGH.
***************
*** 131,137 ****
Scheme_hash_table::remove (SCM k)
{
scm_hashq_remove_x (hash_tab_, k);
! elt_count_ --;
}
Scheme_hash_table::~Scheme_hash_table ()
--- 135,144 ----
Scheme_hash_table::remove (SCM k)
{
scm_hashq_remove_x (hash_tab_, k);
! /*
! don't decrease elt_count_ , as this may cause underflow. The exact
! value of elt_count_ is not important.
! */
}
Scheme_hash_table::~Scheme_hash_table ()
***************
*** 142,148 ****
Scheme_hash_table::to_alist () const
{
SCM l = SCM_EOL;
! for (int i = SCM_SYMBOL_LENGTH (hash_tab_); i--;)
for (SCM s = scm_vector_ref (hash_tab_, gh_int2scm (i)); ly_pair_p(s); s
= ly_cdr (s))
{
l = scm_acons (ly_caar (s), ly_cdar (s), l);
--- 149,155 ----
Scheme_hash_table::to_alist () const
{
SCM l = SCM_EOL;
! for (int i = SCM_VECTOR_LENGTH (hash_tab_); i--;)
for (SCM s = scm_vector_ref (hash_tab_, gh_int2scm (i)); ly_pair_p(s); s
= ly_cdr (s))
{
l = scm_acons (ly_caar (s), ly_cdar (s), l);
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen