From 7948eb8eb5e9954307d70a9ba4e506b105e37051 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 02:10:51 +0000 Subject: [PATCH] lilypond-1.5.14 --- lily/include/symbol-cache.hh | 79 ------------------------------------ lily/symbol-cache.cc | 77 ----------------------------------- 2 files changed, 156 deletions(-) delete mode 100644 lily/include/symbol-cache.hh delete mode 100644 lily/symbol-cache.cc diff --git a/lily/include/symbol-cache.hh b/lily/include/symbol-cache.hh deleted file mode 100644 index 82023eeec4..0000000000 --- a/lily/include/symbol-cache.hh +++ /dev/null @@ -1,79 +0,0 @@ -/* - symbol-cache.hh -- declare Symbol cacher. - - source file of the GNU LilyPond music typesetter - - (c) 2000--2001 Han-Wen Nienhuys - - */ - -#ifndef SYMBOL_CACHE_HH -#define SYMBOL_CACHE_HH - -#if 1 - -/* - A per file cache: for each compilation unit, there is a separate - cache that maps the address of a string directly to a SCM value - - */ -struct Symbol_cache_pair{ - const char * key; - SCM val ; -}; - -static Symbol_cache_pair *private_symbol_cache; -static Symbol_cache_pair *private_symbol_cache_end; - -static SCM -symbol (const char *ch) __attribute__ ((unused)); - - SCM -symbol (const char *ch) -{ - Symbol_cache_pair * lo = private_symbol_cache; - Symbol_cache_pair * hi = private_symbol_cache_end -1; - - if (lo) - { - do - { - Symbol_cache_pair * mid = lo + (hi - lo) / 2 ; - if (mid->key > ch) - hi = mid; - else - lo = mid; - } - while ((hi - lo) > 1); - if (lo->key== ch) - return lo->val; - } - - - Symbol_cache_pair * p = private_symbol_cache; - for (; p < private_symbol_cache_end - && p->key < ch ; p++) - ; - - int idx = p - private_symbol_cache; - - SCM sym = gh_symbol2scm ((char*) ch); - scm_permanent_object (sym); - - int sz = private_symbol_cache_end - private_symbol_cache; - sz ++ ; - private_symbol_cache - = (Symbol_cache_pair*) realloc (private_symbol_cache, - sizeof (Symbol_cache_pair)* sz); - private_symbol_cache_end = private_symbol_cache + sz; - for (p = private_symbol_cache_end -1; - p != private_symbol_cache + idx; p --) - *p = * (p - 1); - - p->key = ch; - p->val = sym; - - return sym; -} -#endif /* SYMBOL_CACHE_HH */ -#endif diff --git a/lily/symbol-cache.cc b/lily/symbol-cache.cc deleted file mode 100644 index d247ccd3d5..0000000000 --- a/lily/symbol-cache.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - symbol-cache.cc -- implement a cache for literal symbols, eg - symbol ("foo-bar") - - - source file of the GNU LilyPond music typesetter - - (c) 2000--2001 Han-Wen Nienhuys - - */ - -#include -#include "lily-guile.hh" - -#if 0 - -typedef map Literal_symbol_map; -Literal_symbol_map literal_map; - - -SCM -symbol (const char*s) -{ - Literal_symbol_map::const_iterator i = literal_map.find (s); - if (i != literal_map.end ()) - return (*i).second; - - SCM sym = gh_symbol2scm ((char*)s); - scm_permanent_object (sym); - literal_map[s] = sym; - return sym; -} - - -/* - This is a gory trick to cache the value gh_symbol2scm (), without - cluttering up the C code with snarf macros. - - You should *ONLY* use symbol () for arguments that are literal - strings! - - without (wtk1-fugue2) - - real 0m20.157s - user 0m19.800s - sys 0m0.140s - - with: (per file.) - - real 0m19.284s - user 0m18.630s - sys 0m0.190s - - - global with STL map - - real 0m20.616s - user 0m19.360s - sys 0m0.080s - - global with binsearch. - - real 0m19.352s - user 0m18.710s - sys 0m0.230s - - local binsearch - - user 18.8 - - local with binsearch, and other optimizations. - - 17.7 -*/ -#endif - - -- 2.39.5