root / gr-run-waveform / gr-run-waveform.cc @ b00008cb
History | View | Annotate | Download (2.2 kB)
| 1 | c31f12f2 | Rob Savoye | /* -*- c++ -*- */
|
|---|---|---|---|
| 2 | c31f12f2 | Rob Savoye | /*
|
| 3 | 09dc1cd6 | Eric Blossom | * Copyright 2010 Free Software Foundation, Inc. |
| 4 | c31f12f2 | Rob Savoye | * |
| 5 | c31f12f2 | Rob Savoye | * This file is part of GNU Radio |
| 6 | c31f12f2 | Rob Savoye | * |
| 7 | c31f12f2 | Rob Savoye | * GNU Radio is free software; you can redistribute it and/or modify |
| 8 | c31f12f2 | Rob Savoye | * it under the terms of the GNU General Public License as published by |
| 9 | c31f12f2 | Rob Savoye | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | c31f12f2 | Rob Savoye | * any later version. |
| 11 | c31f12f2 | Rob Savoye | * |
| 12 | c31f12f2 | Rob Savoye | * GNU Radio is distributed in the hope that it will be useful, |
| 13 | c31f12f2 | Rob Savoye | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | c31f12f2 | Rob Savoye | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | c31f12f2 | Rob Savoye | * GNU General Public License for more details. |
| 16 | c31f12f2 | Rob Savoye | * |
| 17 | c31f12f2 | Rob Savoye | * You should have received a copy of the GNU General Public License |
| 18 | c31f12f2 | Rob Savoye | * along with GNU Radio; see the file COPYING. If not, write to |
| 19 | c31f12f2 | Rob Savoye | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | c31f12f2 | Rob Savoye | * Boston, MA 02110-1301, USA. |
| 21 | c31f12f2 | Rob Savoye | */ |
| 22 | c31f12f2 | Rob Savoye | |
| 23 | cd8a20ef | Eric Blossom | #include <stdio.h> |
| 24 | cd8a20ef | Eric Blossom | #include <stdlib.h> |
| 25 | a0ae40af | Rob Savoye | #include <libguile.h> |
| 26 | a0ae40af | Rob Savoye | |
| 27 | cd8a20ef | Eric Blossom | #include "xyzzy.h" |
| 28 | 3a344433 | Rob Savoye | |
| 29 | cd8a20ef | Eric Blossom | /*
|
| 30 | cd8a20ef | Eric Blossom | * Load and run a waveform defined with define-waveform |
| 31 | cd8a20ef | Eric Blossom | * usage: gr-run-waveform filename.wfd [args...] |
| 32 | cd8a20ef | Eric Blossom | */ |
| 33 | b00008cb | Eric Blossom | static const char *code = "\ |
| 34 | b00008cb | Eric Blossom | (set! %load-verbosely #t) \n\ |
| 35 | b00008cb | Eric Blossom | \n\ |
| 36 | b00008cb | Eric Blossom | (save-module-excursion \n\ |
| 37 | b00008cb | Eric Blossom | (lambda () \n\ |
| 38 | b00008cb | Eric Blossom | (set-current-module (resolve-module '(guile))) \n\ |
| 39 | b00008cb | Eric Blossom | (set! primitive-load xyzzy-primitive-load) \n\ |
| 40 | b00008cb | Eric Blossom | (set! primitive-load-path xyzzy-primitive-load-path) \n\ |
| 41 | b00008cb | Eric Blossom | (set! search-path xyzzy-search-path) \n\ |
| 42 | b00008cb | Eric Blossom | (set! %search-load-path %xyzzy-search-load-path))) \n\ |
| 43 | b00008cb | Eric Blossom | \n\ |
| 44 | b00008cb | Eric Blossom | (primitive-load-path \"gnuradio/run-waveform\") \n\ |
| 45 | b00008cb | Eric Blossom | \n\ |
| 46 | b00008cb | Eric Blossom | (define (main args) \n\ |
| 47 | b00008cb | Eric Blossom | (if (not (>= (length args) 2)) \n\ |
| 48 | b00008cb | Eric Blossom | (let ((port (current-error-port))) \n\ |
| 49 | b00008cb | Eric Blossom | (display \"usage: \" port) \n\ |
| 50 | b00008cb | Eric Blossom | (display (car args) port) \n\ |
| 51 | b00008cb | Eric Blossom | (display \" filename.wfd [args...]\n\" port) \n\ |
| 52 | b00008cb | Eric Blossom | (exit 1))) \n\ |
| 53 | b00008cb | Eric Blossom | (apply run-waveform (cdr args))) \n\ |
| 54 | b00008cb | Eric Blossom | \n\ |
| 55 | b00008cb | Eric Blossom | (main (command-line)) \n\ |
| 56 | b00008cb | Eric Blossom | ";
|
| 57 | b00008cb | Eric Blossom | |
| 58 | 3a344433 | Rob Savoye | |
| 59 | a0ae40af | Rob Savoye | |
| 60 | a0ae40af | Rob Savoye | static void |
| 61 | a0ae40af | Rob Savoye | inner_main (void *data, int argc, char **argv) |
| 62 | a0ae40af | Rob Savoye | {
|
| 63 | cd8a20ef | Eric Blossom | if (!xyzzy_init(0)) // use compiled-in install path |
| 64 | cd8a20ef | Eric Blossom | exit(1);
|
| 65 | 3a344433 | Rob Savoye | |
| 66 | cd8a20ef | Eric Blossom | scm_xyzzy_init(); |
| 67 | cd8a20ef | Eric Blossom | scm_c_eval_string(code); |
| 68 | a0ae40af | Rob Savoye | } |
| 69 | c31f12f2 | Rob Savoye | |
| 70 | c31f12f2 | Rob Savoye | int
|
| 71 | c31f12f2 | Rob Savoye | main(int argc, char *argv[]) |
| 72 | c31f12f2 | Rob Savoye | {
|
| 73 | cd8a20ef | Eric Blossom | setenv("GUILE_WARN_DEPRECATED", "no", 1); |
| 74 | cd8a20ef | Eric Blossom | // setenv("LTDL_LIBRARY_PATH", "/home/eb/install/lib64", 1);
|
| 75 | cd8a20ef | Eric Blossom | |
| 76 | a0ae40af | Rob Savoye | scm_boot_guile (argc, argv, inner_main, 0);
|
| 77 | c31f12f2 | Rob Savoye | |
| 78 | a0ae40af | Rob Savoye | return 0; // never reached |
| 79 | c31f12f2 | Rob Savoye | } |