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

Last change on this file since 1722 was 1262, checked in by dkearney, 15 years ago

attempting to fix compiler warning for octave's print_usage function
this seems to work for octave3.0
also adding checks to configure for more header files

File size: 1.7 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_Void((void*)lib);
60    retval(1) = err;
61
62  return retval;
63}
Note: See TracBrowser for help on using the repository browser.