Ignore:
Timestamp:
Sep 24, 2013, 11:57:53 AM (11 years ago)
Author:
gah
Message:

sync with trunk

Location:
branches/blt4/lang/tcl/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/lang/tcl/src/Makefile.in

    r2936 r3949  
    3939  -I$(srcdir)/../../../src/objects \
    4040  -I$(includedir)
    41 version         = @PACKAGE_VERSION@
    42 DEFINES         = -DPACKAGE_VERSION=\"$(version)\"
     41RAPPTURE_VERSION = @PACKAGE_VERSION@
     42SVN_VERSION     := $(shell svnversion $(srcdir))
     43DEFINES         = -DSVN_VERSION=\"$(SVN_VERSION)\" \
     44                  -DRAPPTURE_VERSION=\"$(RAPPTURE_VERSION)\"
    4345
    4446RANLIB          = @RANLIB@
     
    7981# Not using     RpLibraryTclInterface.o \
    8082
    81 name        = Rappture$(version)
     83name        = Rappture$(RAPPTURE_VERSION)
    8284libname     = $(name)
    8385lib         = $(libname)$(SHLIB_SUFFIX)
  • branches/blt4/lang/tcl/src/Rappture_Init.c

    r2936 r3949  
    77 * ======================================================================
    88 *  AUTHOR:  Derrick Kearney, Purdue University
    9  *  Copyright (c) 2004-2006  Purdue Research Foundation
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1010 *
    1111 *  See the file "license.terms" for information on usage and
     
    2626extern Tcl_AppInitProc RpRusage_Init;
    2727extern Tcl_AppInitProc RpSignal_Init;
    28 extern Tcl_AppInitProc RpSplit_Init;
     28extern Tcl_AppInitProc RpSlice_Init;
    2929extern Tcl_AppInitProc RpSysinfo_Init;
    3030extern Tcl_AppInitProc RpDaemon_Init;
     
    5050        return TCL_ERROR;
    5151    }
    52     if (Tcl_PkgProvide(interp, "Rappture", PACKAGE_VERSION) != TCL_OK) {
     52    if (Tcl_PkgProvide(interp, "Rappture", RAPPTURE_VERSION) != TCL_OK) {
    5353        return TCL_ERROR;
    5454    }
  • branches/blt4/lang/tcl/src/RpCurses.c

    r2676 r3949  
    1616 * ======================================================================
    1717 *  AUTHOR:  Michael McLennan, Purdue University
    18  *  Copyright (c) 2004-2011  Purdue Research Foundation
     18 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1919 *
    2020 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpDaemon.c

    r1328 r3949  
    77 * ======================================================================
    88 *  AUTHOR:  Michael McLennan, Purdue University
    9  *  Copyright (c) 2004-2007  Purdue Research Foundation
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1010 *
    1111 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpEncodeTclInterface.cc

    r2966 r3949  
    66 * ======================================================================
    77 *  AUTHOR:  Derrick Kearney, Purdue University
    8  *  Copyright (c) 2004-2007  Purdue Research Foundation
     8 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    99 *
    1010 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpLibraryTclInterface.cc

    r1388 r3949  
    88 * ======================================================================
    99 *  AUTHOR:  Derrick Kearney, Purdue University
    10  *  Copyright (c) 2004-2006  Purdue Research Foundation
     10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1111 *
    1212 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpRlimit.c

    r1286 r3949  
    99 * ======================================================================
    1010 *  AUTHOR:  Michael McLennan, Purdue University
    11  *  Copyright (c) 2004-2006  Purdue Research Foundation
     11 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1212 *
    1313 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpRusage.c

    r2210 r3949  
    99 * ======================================================================
    1010 *  AUTHOR:  Michael McLennan, Purdue University
    11  *  Copyright (c) 2004-2006  Purdue Research Foundation
     11 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1212 *
    1313 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpSignal.c

    r1018 r3949  
    88 * ======================================================================
    99 *  AUTHOR:  Michael McLennan, Purdue University
    10  *  Copyright (c) 2004-2006  Purdue Research Foundation
     10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1111 *
    1212 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpSlice.c

    r1578 r3949  
    1717 * ======================================================================
    1818 *  AUTHOR:  Michael McLennan, Purdue University
    19  *  Copyright (c) 2004-2009  Purdue Research Foundation
     19 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    2020 *
    2121 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpSysinfo.c

    r1403 r3949  
    77 * ======================================================================
    88 *  AUTHOR:  Michael McLennan, Purdue University
    9  *  Copyright (c) 2004-2006  Purdue Research Foundation
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1010 *
    1111 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpUnitsTclInterface.cc

    r1326 r3949  
    77 * ======================================================================
    88 *  AUTHOR:  Derrick Kearney, Purdue University
    9  *  Copyright (c) 2004-2006  Purdue Research Foundation
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1010 *
    1111 *  See the file "license.terms" for information on usage and
     
    3838 */
    3939
     40#include <algorithm>
     41#include <functional>
     42#include <cctype>
     43
     44// Trim from start
     45static inline std::string &ltrim(std::string &s)
     46{
     47    s.erase(s.begin(),
     48        std::find_if(s.begin(), s.end(),
     49                     std::not1(std::ptr_fun<int, int>(std::isspace))));
     50    return s;
     51}
     52
     53// Trim from end
     54static inline std::string &rtrim(std::string &s)
     55{
     56    s.erase(std::find_if(s.rbegin(), s.rend(),
     57        std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
     58    return s;
     59}
     60
     61// Trim from both ends
     62static inline std::string &trim(std::string &s)
     63{
     64    return ltrim(rtrim(s));
     65}
     66
    4067extern "C" int
    4168RpUnits_Init(Tcl_Interp *interp)
     
    7198 * provided in -context option.
    7299 */
     100
    73101
    74102int
     
    134162                        return TCL_ERROR;
    135163                    }
    136                 }
    137                 else {
     164                } else {
    138165                    // if user does not specify wishes for this option,
    139166                    // set fromUnitsName to an empty string.
    140167                    fromUnitsName = "";
    141168                }
    142             }
    143             else if ( option == "-to" ) {
     169            } else if ( option == "-to" ) {
    144170                nextarg++;
    145171                if (argv[nextarg] != NULL) {
     
    155181                        return TCL_ERROR;
    156182                    }
    157                 }
    158                 else {
     183                } else {
    159184                    // if user does not specify wishes for this option,
    160185                    // set toUnitsName to an empty string.
    161186                    toUnitsName = "";
    162187                }
    163             }
    164             else if ( option == "-units" ) {
     188            } else if ( option == "-units" ) {
    165189                nextarg++;
    166190                if (argv[nextarg] != NULL) {
     
    173197                        return TCL_ERROR;
    174198                    }
    175                 }
    176                 else {
     199                } else {
    177200                    // if user does not specify wishes for this option,
    178201                    // return error.
     
    182205                    return TCL_ERROR;
    183206                }
    184             }
    185             else {
     207            } else {
    186208                // unrecognized option
    187209                Tcl_AppendResult(interp, "bad option \"", argv[nextarg],
     
    192214
    193215            nextarg++;
    194         }
    195         else {
     216        } else {
    196217            // unrecognized input
    197218            Tcl_AppendResult(interp, "bad option \"", argv[nextarg], "\": ",
     
    208229    // or if we should use those provided in -context option
    209230
    210     double value;
    211     value = strtod(inValue.c_str(),&endptr);
     231
     232    // Trim away white space from the value. 
     233    trim(inValue);
     234
     235    strtod(inValue.c_str(), &endptr);
    212236    if (endptr == inValue.c_str()) {
    213237        // there was no numeric value that could be pulled from inValue
     
    224248                inValue.c_str(), mesg.c_str(), (char*)NULL);
    225249        return TCL_ERROR;
    226     }
    227     else if ( ((unsigned)(endptr - inValue.c_str())) == inValue.length() ) {
     250    } else if ( ((unsigned)(endptr - inValue.c_str())) == inValue.length() ) {
    228251        // add 1 because we are subtracting indicies
    229252        // there were no units at the end of the inValue string
     
    233256        if (!fromUnitsName.empty()) {
    234257            val = inValue + fromUnitsName;
    235         }
    236         else {
     258        } else {
    237259            Tcl_AppendResult(interp, "value: \"", inValue.c_str(),
    238260                    "\" has unrecognized units", (char*)NULL);
    239261            return TCL_ERROR;
    240262        }
    241     }
    242     else {
     263    } else {
    243264        // there seemed to be units at the end of the inValue string
    244265        // we will ignore the -context flag and use the units in inValue
     
    253274        Tcl_AppendResult(interp, convertedVal.c_str(), (char*)NULL);
    254275        retVal = TCL_OK;
    255     }
    256     else {
     276    } else {
    257277        // error while converting
    258278        Tcl_AppendResult(interp,
  • branches/blt4/lang/tcl/src/RpUtilsTclInterface.cc

    r1018 r3949  
    77 * ======================================================================
    88 *  AUTHOR:  Derrick Kearney, Purdue University
    9  *  Copyright (c) 2004-2006  Purdue Research Foundation
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1010 *
    1111 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpWinResource.c

    r1018 r3949  
    1212 * ======================================================================
    1313 *  AUTHOR:  Nicholas J. Kisseberth, Purdue University
    14  *  Copyright (c) 2006  Purdue Research Foundation
     14 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1515 *
    1616 *  See the file "license.terms" for information on usage and
  • branches/blt4/lang/tcl/src/RpWinResource.h

    r1018 r3949  
    1313 * ======================================================================
    1414 *  AUTHOR:  Nicholas J. Kisseberth, Purdue University
    15  *  Copyright (c) 2006  Purdue Research Foundation
     15 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1616 *
    1717 *  See the file "license.terms" for information on usage and
Note: See TracChangeset for help on using the changeset viewer.