1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * INTERFACE: Octave Rappture Progress Source |
---|
4 | * |
---|
5 | * [err] = rpUtilsProgress(percent,message) |
---|
6 | * |
---|
7 | * ====================================================================== |
---|
8 | * AUTHOR: Derrick Kearney, Purdue University |
---|
9 | * Copyright (c) 2005-2007 |
---|
10 | * Purdue Research Foundation, West Lafayette, IN |
---|
11 | * ====================================================================== |
---|
12 | */ |
---|
13 | |
---|
14 | #include "RpOctaveInterface.h" |
---|
15 | |
---|
16 | /**********************************************************************/ |
---|
17 | // METHOD: [err] = rpUtilsProgress (percent,message) |
---|
18 | /// Print the Rappture Progress message. |
---|
19 | /** |
---|
20 | * Clients use this to generate the super secret Rappture |
---|
21 | * Progress message, and generate a progress bar in the |
---|
22 | * Rappture graphical user interface. |
---|
23 | */ |
---|
24 | |
---|
25 | DEFUN_DLD (rpUtilsProgress, args, , |
---|
26 | "-*- texinfo -*-\n\ |
---|
27 | [err] = rpUtilsProgress(@var{percent},@var{message})\n\ |
---|
28 | \n\ |
---|
29 | Clients use this to generate the super secret Rappture\n\ |
---|
30 | Progress message, and generate a progress bar in the\n\ |
---|
31 | Rappture graphical user interface.") |
---|
32 | { |
---|
33 | static std::string who = "rpUtilsProgress"; |
---|
34 | |
---|
35 | // The list of values to return. |
---|
36 | octave_value_list retval; |
---|
37 | int err = 1; |
---|
38 | int nargin = args.length (); |
---|
39 | int percent = 0; |
---|
40 | std::string message = ""; |
---|
41 | |
---|
42 | if (nargin == 2) { |
---|
43 | if ( args(0).is_real_scalar() && |
---|
44 | args(1).is_string() ) { |
---|
45 | |
---|
46 | percent = args(0).int_value (); |
---|
47 | message = args(1).string_value (); |
---|
48 | |
---|
49 | /* Call the C subroutine. */ |
---|
50 | err = Rappture::Utils::progress(percent,message.c_str()); |
---|
51 | } |
---|
52 | else { |
---|
53 | // wrong argument types |
---|
54 | _PRINT_USAGE (who.c_str()); |
---|
55 | } |
---|
56 | } |
---|
57 | else { |
---|
58 | // wrong number of arguments |
---|
59 | _PRINT_USAGE (who.c_str()); |
---|
60 | } |
---|
61 | |
---|
62 | retval(0) = err; |
---|
63 | return retval; |
---|
64 | } |
---|