source: trunk/lang/octave/rpLib.cc @ 1044

Last change on this file since 1044 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.6 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Octave Rappture Library Source
4 *
5 *    [libHandle,err] = 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
16/**********************************************************************/
17// METHOD: [libHandle,err] = rpLib (fileName)
18/// Opens a Rappture Library Object based on the xml file 'fileName'.
19/**
20 * Usually called in the beginning of a program to load an xml file
21 * for future reading.
22 */
23
24DEFUN_DLD (rpLib, args, ,
25"-*- texinfo -*-\n\
26[libHandle, err] = rpLib (@var{fileName})\n\
27\n\
28Opens a Rappture Library Object based on the xml file @var{fileName}.\n\
29Returns a handle to the Rappture Library Object and an error flag.\n\
30err = 0 is success, anything else is failure.")
31{
32    static std::string who = "rpLib";
33
34    // The list of values to return.
35    octave_value_list retval;
36
37    int nargin = args.length ();
38    std::string path = "";
39    RpLibrary* lib = NULL;
40    int libIndex = 0;
41    int err = 1;
42
43    retval(0) = -1;
44    retval(1) = err;
45
46    if (nargin == 1) {
47        if (args(0).is_string ()) {
48            path = args(0).string_value ();
49            lib = new RpLibrary(path);
50            if (lib != NULL) {
51                err = 0;
52            }
53        }
54    }
55    else {
56        print_usage ("rpLib");
57    }
58
59    retval(0) = storeObject_Lib(lib);
60    retval(1) = err;
61
62  return retval;
63}
Note: See TracBrowser for help on using the repository browser.