source: trunk/src/octave/RpOctaveInterface.cc @ 122

Last change on this file since 122 was 122, checked in by dkearney, 17 years ago

added initial version of octave language bindings.
1) no claiming language bindings work, but will happily take credit if they do.
2) bindings are untested
3) bindings happen to work with mystery example that happens to be located in examples/app-fermi/matlab/fermi_rp.m and happens to be invokable with examples/app-fermi/matlab/tool_rp.xml
4) bindings need octave2.1-headers installed (in debian: apt-get install octave2.1-headers) to get the mkoctfile program
5) binding function names might be changing to be more discriptive and more tightly bound to either the lib or units module.
6) adjusted Makefile to add octave bindings compilation.

File size: 1.3 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    libHandle = rpLib(fileName)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2005
10 *  Purdue Research Foundation, West Lafayette, IN
11 * ======================================================================
12 */
13
14#include "RpOctaveInterface.h"
15
16DEFUN_DLD (rpLib, args, ,
17  "[libHandle, err] = rpLib (fileName)\n\
18\n\
19Opens a Rappture Library Object based on the xml file 'fileName'.\n\
20Returns a handle to the Rappture Library Object and an error flag.\n\
21err = 0 is success, anything else is failure.")
22{
23    static std::string who = "rpLib";
24
25    // The list of values to return.
26    octave_value_list retval;
27
28    int nargin = args.length ();
29    std::string path = "";
30    RpLibrary* lib = NULL;
31    int libIndex = 0;
32
33    retval(1) = 1;
34    retval(0) = -1;
35
36    if (nargin == 1) {
37        if (args(0).is_string ()) {
38            path = args(0).string_value ();
39            if (!path.empty()) {
40                lib = new RpLibrary(path);
41                retval(1) = 0;
42            }
43        }
44    }
45    else {
46        print_usage ("fopen");
47    }
48
49    retval(0) = storeObject_Lib(lib);
50
51  return retval;
52}
Note: See TracBrowser for help on using the repository browser.