OSDN Git Service

* read.scm (/cmd-include): Fix absolute path handling.
authordevans <devans>
Wed, 20 Jan 2010 14:56:59 +0000 (14:56 +0000)
committerdevans <devans>
Wed, 20 Jan 2010 14:56:59 +0000 (14:56 +0000)
cgen/ChangeLog
cgen/read.scm

index 0f38dc9..7a2409a 100644 (file)
@@ -1,3 +1,7 @@
+2010-01-19  Doug Evans  <dje@sebabeach.org>
+
+       * read.scm (/cmd-include): Fix absolute path handling.
+
 2010-01-05  Doug Evans  <dje@sebabeach.org>
 
        * mode.scm (<mode>) Rename member non-mode-c-type to c-type.
index 0695fd4..0a6217c 100644 (file)
@@ -1,5 +1,5 @@
 ; Top level file for reading and recording .cpu file contents.
-; Copyright (C) 2000, 2001, 2006, 2009 Red Hat, Inc.
+; Copyright (C) 2000, 2001, 2006, 2009, 2010 Red Hat, Inc.
 ; This file is part of CGEN.
 ; See file COPYING.CGEN for details.
 
@@ -982,12 +982,17 @@ Define a preprocessor-style macro.
   #f
 )
 
-; .cpu file include mechanism
+;; .cpu file include mechanism
+;; If FILE is not an absolute path, prepend ARCH-PATH.
 
 (define (/cmd-include file)
-  (logit 1 "Including file " (string-append arch-path "/" file) " ...\n")
-  (reader-read-file! (string-append arch-path "/" file))
-  (logit 2 "Resuming previous file ...\n")
+  (let ((full-path (if (eq? (string-ref file 0) #\/)
+                      file
+                      (string-append arch-path "/" file))))
+    (logit 1 "Including file " full-path " ...\n")
+    (reader-read-file! full-path)
+    (logit 2 "Resuming previous file ...\n"))
+  *UNSPECIFIED*
 )
 
 ; Version of `if' invokable at the top level of a description file.