source: trunk/lang/matlab/rpLibResult.cc @ 1082

Last change on this file since 1082 was 962, checked in by dkearney, 16 years ago

code cleanups.
adjusted gague.tcl to check the length of the string it receives for integers and reals.
modified c, matlab, and octave's lib function to handle empty string for creation of empty library.
modified matlab and octave's lib result function to handle status as a parameter.
fixed core library code to deal with incorrect order of translating xml entity references.

File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    [err] = rpLibResult(lib)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2004-2005  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16#include "RpMatlabInterface.h"
17
18/**********************************************************************/
19// METHOD: [err] = rpLibResult (libHandle,status)
20/// Write Rappture Library to run.xml and signal end of processing.
21/**
22 * Usually the last call of the program, this function signals to the gui
23 * that processing has completed and the output is ready to be
24 * displayed
25 */
26
27void mexFunction(int nlhs, mxArray *plhs[],
28                 int nrhs, const mxArray *prhs[])
29{
30    int libIndex = 0;
31    int err = 1;
32    int status = 0;
33    RpLibrary* lib = NULL;
34
35    /* Check for proper number of arguments. */
36    if (nrhs > 2) {
37        mexErrMsgTxt("At most two input allowed.");
38    }
39
40    if (nrhs < 1) {
41        mexErrMsgTxt("One input required.");
42    }
43
44    // grab the integer value of the library handle
45    libIndex = getIntInput(prhs[0]);
46
47    if (nrhs == 2) {
48        status = getIntInput(prhs[1]);
49    }
50
51    /* Call the C subroutine. */
52    if (libIndex > 0) {
53        lib = getObject_Lib(libIndex);
54        if (lib) {
55            lib->put("tool.version.rappture.language", "matlab");
56            lib->result(status);
57            err = 0;
58            // cleanLibDict();
59        }
60    }
61
62    plhs[0] = mxCreateDoubleScalar(err);
63
64    return;
65}
Note: See TracBrowser for help on using the repository browser.