source: trunk/lang/octave/rpLibResult.cc @ 1095

Last change on this file since 1095 was 1085, checked in by dkearney, 16 years ago

adjusting matlab and octave bindings to use the void* bindings dictionary instead of the lib* dictionary in hopes that we can phase out the lib* dictionary.

File size: 2.2 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Octave Rappture Library Source
4 *
5 *    [err] = rpLibResult(libHandle)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick S. Kearney, Purdue University
9 *  Copyright (c) 2005-2008
10 *  Purdue Research Foundation, West Lafayette, IN
11 * ======================================================================
12 */
13
14#include "RpOctaveInterface.h"
15
16/**********************************************************************/
17// METHOD: [err] = rpLibResult (libHandle,status)
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 * that processing has completed and the output is ready to be
22 * displayed
23 */
24
25DEFUN_DLD (rpLibResult, args, ,
26"-*- texinfo -*-\n\
27[err] = rpLibResult (@var{libHandle},@var{status})\n\
28\n\
29Usually the last call of the program, this function signals to the gui\n\
30that 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 = "rpLibResult";
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 status = 0;
43    int err = 0;
44
45    if ((nargin < 1) || (nargin > 2)) {
46        // wrong number of arguments
47        print_usage ("rpLibResult");
48        goto done;
49    }
50
51    if (! args(0).is_real_scalar()) {
52        // wrong argument type
53        print_usage ("rpLibResult");
54        goto done;
55    }
56
57    libHandle = args(0).int_value();
58
59    if (nargin == 2) {
60        if (! args(1).is_real_scalar()) {
61            // wrong argument type
62            print_usage ("rpLibResult");
63            goto done;
64        }
65
66        status = args(1).int_value();
67    }
68
69    /* Call the C subroutine. */
70    if (libHandle > 0) {
71        lib = (RpLibrary*) getObject_Void(libHandle);
72        if (lib) {
73            lib->put("tool.version.rappture.language", "octave");
74            lib->result(status);
75            // cleanLibDict();
76            err = 0;
77        }
78    }
79
80done:
81    retval(0) = err;
82    return retval;
83}
Note: See TracBrowser for help on using the repository browser.