]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/file-cache.scm
* scm/file-cache.scm (cached-file-contents): add file. Read each
[lilypond.git] / scm / file-cache.scm
diff --git a/scm/file-cache.scm b/scm/file-cache.scm
new file mode 100644 (file)
index 0000000..6399623
--- /dev/null
@@ -0,0 +1,17 @@
+;;;; file-cache.scm --
+;;;;
+;;;;  source file of the GNU LilyPond music typesetter
+;;;;
+;;;; (c)  2005 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))