Changeset 962 for trunk/src/octave


Ignore:
Timestamp:
Mar 25, 2008, 12:19:50 PM (17 years ago)
Author:
dkearney
Message:

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.

Location:
trunk/src/octave
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/octave/rpLib.cc

    r156 r962  
    4747        if (args(0).is_string ()) {
    4848            path = args(0).string_value ();
    49             if (!path.empty()) {
    50                 lib = new RpLibrary(path);
     49            lib = new RpLibrary(path);
     50            if (lib != NULL) {
    5151                err = 0;
    5252            }
  • trunk/src/octave/rpLibResult.cc

    r789 r962  
    66 *
    77 * ======================================================================
    8  *  AUTHOR:  Derrick Kearney, Purdue University
    9  *  Copyright (c) 2005
     8 *  AUTHOR:  Derrick S. Kearney, Purdue University
     9 *  Copyright (c) 2005-2008
    1010 *  Purdue Research Foundation, West Lafayette, IN
    1111 * ======================================================================
     
    1515
    1616/**********************************************************************/
    17 // METHOD: [err] = rpLibResult (libHandle)
     17// METHOD: [err] = rpLibResult (libHandle,status)
    1818/// Write Rappture Library to run.xml and signal end of processing.
    1919/**
     
    2525DEFUN_DLD (rpLibResult, args, ,
    2626"-*- texinfo -*-\n\
    27 [err] = rpLibResult (@var{libHandle})\n\
     27[err] = rpLibResult (@var{libHandle},@var{status})\n\
    2828\n\
    2929Usually the last call of the program, this function signals to the gui\n\
     
    3737    octave_value_list retval;
    3838
    39     int nargin = args.length ();
     39    int nargin = args.length();
    4040    RpLibrary* lib = NULL;
    4141    int libHandle = 0;
     42    int status = 0;
    4243    int err = 0;
    4344
    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->put("tool.version.rappture.language", "octave");
    52                     lib->result();
    53                     // cleanLibDict();
    54                     err = 0;
    55                 }
    56             }
     45    if ((nargin < 1) || (nargin > 2)) {
     46        // wrong number of arguments
     47        print_usage ("rpLibResult");
     48        goto done;
     49    }
     50
     51    if (! args(0).is_real_scalar()) {
     52        // wrong argument type
     53        print_usage ("rpLibResult");
     54        goto done;
     55    }
     56
     57    libHandle = args(0).int_value();
     58
     59    if (nargin == 2) {
     60        if (! args(1).is_real_scalar()) {
     61            // wrong argument type
     62            print_usage ("rpLibResult");
     63            goto done;
    5764        }
    58         else {
    59             // wrong argument type
    60             print_usage ("rpLib");
     65
     66        status = args(1).int_value();
     67    }
     68
     69    /* Call the C subroutine. */
     70    if (libHandle > 0) {
     71        lib = getObject_Lib(libHandle);
     72        if (lib) {
     73            lib->put("tool.version.rappture.language", "octave");
     74            lib->result(status);
     75            // cleanLibDict();
     76            err = 0;
    6177        }
    6278    }
    63     else {
    64         // wrong number of arguments
    65         print_usage ("rpLib");
    66     }
    6779
     80done:
    6881    retval(0) = err;
    69 
    70   return retval;
     82    return retval;
    7183}
Note: See TracChangeset for help on using the changeset viewer.