summaryrefslogtreecommitdiff
path: root/scm/file-cache.scm
blob: 3868c40dd5d9d7151c16f472eccddd1b2d32a789 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;;;; file-cache.scm --
;;;;
;;;;  source file of the GNU LilyPond music typesetter
;;;;
;;;; (c) 2005--2006 Han-Wen Nienhuys <hanwen@cs.uu.nl>


(define cache-hash-tab  (make-hash-table 11))
(define-public (cached-file-contents filename)
  (let*
      ((contents (hash-ref cache-hash-tab filename #f)))

    (if (not (string? contents))
	(begin
	  (set! contents (ly:gulp-file filename))
	  (hash-set! cache-hash-tab filename contents)))
    contents))