diff options
author | Rob Savoye | 2010-11-29 07:57:02 -0700 |
---|---|---|
committer | Rob Savoye | 2010-11-29 07:57:02 -0700 |
commit | f3570d3fb25113d5f89bd9f258fa8cf996425b70 (patch) | |
tree | 96b76598d2e284138a7edbbbe481ca8c1e4392b0 | |
parent | 3ecf6fb2c22ecac75e70c9b1b5009cf2b5cf2b5f (diff) | |
download | gnuradio-f3570d3fb25113d5f89bd9f258fa8cf996425b70.tar.gz gnuradio-f3570d3fb25113d5f89bd9f258fa8cf996425b70.tar.bz2 gnuradio-f3570d3fb25113d5f89bd9f258fa8cf996425b70.zip |
move make port between files to reduce messy extern prototypes
-rw-r--r-- | gr-run-waveform/xyzzy-load.c | 25 | ||||
-rw-r--r-- | gr-run-waveform/xyzzy.cc | 28 |
2 files changed, 30 insertions, 23 deletions
diff --git a/gr-run-waveform/xyzzy-load.c b/gr-run-waveform/xyzzy-load.c index 65e22c561..1b3dd9f5c 100644 --- a/gr-run-waveform/xyzzy-load.c +++ b/gr-run-waveform/xyzzy-load.c @@ -283,9 +283,32 @@ SCM_DEFINE (scm_xyzzy_search_path, "xyyzy-search-path", 2, 1, 0, } #undef FUNC_NAME +SCM_DEFINE (scm_make_gnuradio, "make-gnuradio-port", 1, 0, 0, + (SCM port), + "Return a new port which reads from @var{port}") +#define FUNC_NAME s_scm_make_gnuradio +{ + SCM result; + unsigned long mode = 0; + + fprintf(stderr, "TRACE %s: %d: %s\n", __FUNCTION__, __LINE__, scm_to_locale_string(port)); + + SCM_VALIDATE_PORT (SCM_ARG1, port); + + if (scm_is_true (scm_output_port_p (port))) + mode |= SCM_WRTNG; + else if (scm_is_true (scm_input_port_p (port))) + mode |= SCM_RDNG; + + result = make_xyzzy (port, mode); + + return result; +} +#undef FUNC_NAME + void scm_xyzzy_init (void) { scm_c_define_gsubr ("xyzzy-search-path", 2, 1, 0, (SCM (*)()) scm_xyzzy_search_path); - /* scm_make_port_type("gnuradio", xyzzy_fill_input, xyzzy_write); */ + scm_c_define_gsubr ("make-gnuradio-port", 1, 0, 0, (SCM (*)()) scm_make_gnuradio); } diff --git a/gr-run-waveform/xyzzy.cc b/gr-run-waveform/xyzzy.cc index 6179fa5ab..a67cab2bc 100644 --- a/gr-run-waveform/xyzzy.cc +++ b/gr-run-waveform/xyzzy.cc @@ -106,7 +106,7 @@ XYZZY::init(const std::string &file) cout << "Loaded " << _contents.size() << " Filesystem entries" << endl; in.close(); - + return true; }; @@ -128,7 +128,6 @@ XYZZY::file_exists(const std::string &filespec) } // Return a C port that will read the file contents -// SCM make_read_only_port(handle, const std::string &filespec) SCM XYZZY::make_read_only_port(const std::string &filespec) { @@ -208,26 +207,6 @@ extern "C" { static XYZZY datafile; -SCM_DEFINE (scm_i_make_gnuradio, "%make-gnuradio-port", 1, 0, 0, - (SCM port), - "Return a new port which reads and writes to @var{port}") -#define FUNC_NAME s_scm_i_make_gnuradio -{ - SCM result; - unsigned long mode = 0; - - SCM_VALIDATE_PORT (SCM_ARG1, port); - - if (scm_is_true (scm_output_port_p (port))) - mode |= SCM_WRTNG; - else if (scm_is_true (scm_input_port_p (port))) - mode |= SCM_RDNG; - - result = make_xyzzy (port, mode); - - return result; -} - void xyzzy_flush (SCM port) { @@ -259,6 +238,8 @@ const size_t XYZZY_INPUT_BUFFER_SIZE = 4096; SCM make_xyzzy (SCM binary_port, unsigned long mode) { + fprintf(stderr, "TRACE %s: %d\n", __FUNCTION__, __LINE__); + SCM port; scm_t_port *c_port; const unsigned long mode_bits = SCM_OPN | mode; @@ -288,12 +269,15 @@ make_xyzzy (SCM binary_port, unsigned long mode) void xyzzy_write (SCM port, const void *data, size_t size) { + fprintf(stderr, "TRACE %s: %d\n", __FUNCTION__, __LINE__); // This is a read only file } int xyzzy_fill_input (SCM port) { + fprintf(stderr, "TRACE %s: %d\n", __FUNCTION__, __LINE__); + scm_t_port *gr_port = SCM_PTAB_ENTRY (port); // if (gr_port->read_pos + gr_port->read_buf_size > gr_port->read_end) { |