diff options
-rw-r--r-- | gr-run-waveform/test_waveform.c | 2 | ||||
-rw-r--r-- | gr-run-waveform/xyzzy-load.c | 25 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gr-run-waveform/test_waveform.c b/gr-run-waveform/test_waveform.c index b99586122..29f6355bd 100644 --- a/gr-run-waveform/test_waveform.c +++ b/gr-run-waveform/test_waveform.c @@ -29,6 +29,8 @@ static void inner_main (void *data, int argc, char **argv) { + xyzzy_init("./filesystem.dat"); + scm_xyzzy_init(); scm_shell (argc, argv); diff --git a/gr-run-waveform/xyzzy-load.c b/gr-run-waveform/xyzzy-load.c index 119dcd8c7..810f5c51b 100644 --- a/gr-run-waveform/xyzzy-load.c +++ b/gr-run-waveform/xyzzy-load.c @@ -162,11 +162,11 @@ SCM_DEFINE (scm_xyzzy_search_path, "xyyzy-search-path", 2, 1, 0, size_t filename_len; SCM result = SCM_BOOL_F; - fprintf(stderr, "TRACE %s: %d: %s\n", __FUNCTION__, __LINE__, scm_to_locale_string(filename)); - if (SCM_UNBNDP (extensions)) extensions = SCM_EOL; + /* fprintf(stderr, "TRACE %s: %d %s\n", __FUNCTION__, __LINE__, scm_to_locale_string(SCM_CAR(path))); */ + scm_dynwind_begin (0); filename_chars = scm_to_locale_string (filename); filename_len = strlen (filename_chars); @@ -222,7 +222,6 @@ SCM_DEFINE (scm_xyzzy_search_path, "xyyzy-search-path", 2, 1, 0, buf.buf_len = 512; buf.buf = scm_malloc (buf.buf_len); scm_dynwind_unwind_handler (stringbuf_free, &buf, SCM_F_WIND_EXPLICITLY); - /* Try every path element. */ @@ -258,6 +257,25 @@ SCM_DEFINE (scm_xyzzy_search_path, "xyyzy-search-path", 2, 1, 0, /* If the file exists at all, we should return it. If the file is inaccessible, then that's an error. */ +#if 0 + const char *magic = "/-xyzzy-"; + if (strncmp(scm_to_locale_string(dir), magic, strlen(magic)) == 0) { + /* Look in the fake filesystem for this file. If we find it, we prepend a + magic number to the front so we can identify these special files later + on when trying to read from them. */ + if (xyzzy_file_exists(buf.buf)) { + result = scm_from_locale_string (buf.buf); + goto end; + } + } else { + if (stat (buf.buf, &mode) == 0 + && ! (mode.st_mode & S_IFDIR)) + { + result = scm_from_locale_string (buf.buf); + goto end; + } + } +#else fprintf(stderr, "TRACE %s: %d: \"%s\"\n", __FUNCTION__, __LINE__, buf.buf); @@ -268,6 +286,7 @@ SCM_DEFINE (scm_xyzzy_search_path, "xyyzy-search-path", 2, 1, 0, result = scm_from_locale_string (buf.buf); goto end; } +#endif } if (!SCM_NULL_OR_NIL_P (exts)) |