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 | |
---|
24 | DEFUN_DLD (rpLib, args, , |
---|
25 | "-*- texinfo -*-\n\ |
---|
26 | [libHandle, err] = rpLib (@var{fileName})\n\ |
---|
27 | \n\ |
---|
28 | Opens a Rappture Library Object based on the xml file @var{fileName}.\n\ |
---|
29 | Returns a handle to the Rappture Library Object and an error flag.\n\ |
---|
30 | err = 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 | } |
---|