1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * INTERFACE: Octave Rappture Library Source |
---|
4 | * |
---|
5 | * [err] = rpResult(libHandle) |
---|
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: [err] = rpResult (libHandle) |
---|
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 | * telling it that processing has completed and the output is ready to be |
---|
22 | * displayed |
---|
23 | */ |
---|
24 | |
---|
25 | DEFUN_DLD (rpResult, args, , |
---|
26 | "-*- texinfo -*-\n\ |
---|
27 | [err] = rpResult (@var{libHandle})\n\ |
---|
28 | \n\ |
---|
29 | Usually the last call of the program, this function signals to the gui\n\ |
---|
30 | telling it that processing has completed and the output is ready to be\n\ |
---|
31 | displayed\n\ |
---|
32 | Error Codes: @var{err} = 0 is success, anything else is failure.") |
---|
33 | { |
---|
34 | static std::string who = "rpResult"; |
---|
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 err = 0; |
---|
43 | |
---|
44 | if (nargin == 1) { |
---|
45 | if (args(0).is_real_scalar ()) { |
---|
46 | libHandle= args(0).int_value (); |
---|
47 | /* Call the C subroutine. */ |
---|
48 | if (libHandle > 0) { |
---|
49 | lib = getObject_Lib(libHandle); |
---|
50 | if (lib) { |
---|
51 | lib->result(); |
---|
52 | // cleanLibDict(); |
---|
53 | err = 0; |
---|
54 | } |
---|
55 | } |
---|
56 | } |
---|
57 | else { |
---|
58 | // wrong argument type |
---|
59 | print_usage ("rpLib"); |
---|
60 | } |
---|
61 | } |
---|
62 | else { |
---|
63 | // wrong number of arguments |
---|
64 | print_usage ("rpLib"); |
---|
65 | } |
---|
66 | |
---|
67 | retval(0) = err; |
---|
68 | |
---|
69 | return retval; |
---|
70 | } |
---|