source: trunk/src/octave/rpResult.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.9 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Octave Rappture Library Source
4 *
5 *    [err] = rpResult(libHandle)
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
16/**********************************************************************/
17// METHOD: [err] = rpResult (libHandle)
18/// Write Rappture Library to run.xml and signal end of processing.
19/**
20 * Usually the last call of the program, this function signals to the gui
21 * telling it that processing has completed and the output is ready to be
22 * displayed
23 */
24
25DEFUN_DLD (rpResult, args, ,
26"-*- texinfo -*-\n\
27[err] = rpResult (@var{libHandle})\n\
28\n\
29Usually the last call of the program, this function signals to the gui\n\
30telling it that processing has completed and the output is ready to be\n\
31displayed\n\
32Error Codes: @var{err} = 0 is success, anything else is failure.")
33{
34    static std::string who = "rpResult";
35
36    // The list of values to return.
37    octave_value_list retval;
38
39    int nargin = args.length ();
40    RpLibrary* lib = NULL;
41    int libHandle = 0;
42    int err = 0;
43
44    if (nargin == 1) {
45        if (args(0).is_real_scalar ()) {
46            libHandle= args(0).int_value ();
47            /* Call the C subroutine. */
48            if (libHandle > 0) {
49                lib = getObject_Lib(libHandle);
50                if (lib) {
51                    lib->result();
52                    // cleanLibDict();
53                    err = 0;
54                }
55            }
56        }
57        else {
58            // wrong argument type
59            print_usage ("rpLib");
60        }
61    }
62    else {
63        // wrong number of arguments
64        print_usage ("rpLib");
65    }
66
67    retval(0) = err;
68
69  return retval;
70}
Note: See TracBrowser for help on using the repository browser.