Index: trunk/src/core/RpLibrary.cc
===================================================================
--- trunk/src/core/RpLibrary.cc	(revision 408)
+++ trunk/src/core/RpLibrary.cc	(revision 424)
@@ -237,10 +237,10 @@
 
             if (!path.str().empty()) {
-                // path.str(_node2comp(snode) + "." + path.str());
-                path.str("." + _node2comp(snode) + path.str());
+                path.str(_node2comp(snode) + "." + path.str());
+                // path.str("." + _node2comp(snode) + path.str());
             }
             else {
-                // path.str(_node2comp(snode));
-                path.str("." + _node2comp(snode));
+                path.str(_node2comp(snode));
+                // path.str("." + _node2comp(snode));
             }
 
@@ -495,15 +495,26 @@
     }
 
+    /*
     if (path.empty()) {
         // an empty path returns the current RpLibrary
         return this;
     }
-
-    // get the node located at path
-    retNode = _find(path,NO_CREATE_PATH);
-
-    // if the node exists, create a rappture library object for it.
-    if (retNode) {
-        retLib = new RpLibrary( retNode,this->tree );
+    */
+
+    if (path.empty()) {
+        // this should be a smart pointer, 
+        // if someone deletes the original this->root, this object is void
+        // and will be a memory leak.
+        // retNode = this->root;
+        retLib = new RpLibrary(*this);
+    }
+    else {
+        // get the node located at path
+        retNode = _find(path,NO_CREATE_PATH);
+
+        // if the node exists, create a rappture library object for it.
+        if (retNode) {
+            retLib = new RpLibrary( retNode,this->tree );
+        }
     }
 
@@ -513,8 +524,6 @@
 /**********************************************************************/
 // METHOD: entities()
-/// Search the path of a xml tree and return its next entity.
-/**
- * It is the user's responsibility to delete the object when 
- * they are finished using it?, else i need to make this static
+/// Search the path of a xml tree and return a list of its entities.
+/**
  */
 
@@ -529,4 +538,5 @@
 
     RpLibrary* ele = NULL;
+    std::string pathBack = "";
 
     RpLibrary* child = NULL;
@@ -546,6 +556,14 @@
         child = NULL;
 
+        if ((*iter).empty()) {
+            pathBack = "";
+        }
+        else {
+            pathBack = *iter + ".";
+        }
+
         while ( ele && (child = ele->children("",child)) != NULL ) {
             childList.push_back(child->nodeComp());
+            delete child;
         }
 
@@ -556,23 +574,23 @@
 
             childType = child->nodeType();
-            childPath = child->nodePath();
+            childPath = child->nodeComp();
             if ( (childType == "group") || (childType == "phase") ) {
                 // add this path to the queue for paths to search
-                queue.push_back(childPath);
+                queue.push_back(pathBack+childPath);
             }
             else if (childType == "structure") {
                 // add this path to the return list
-                retList.push_back(child->nodeComp());
+                retList.push_back(pathBack+child->nodeComp());
 
                 // check to see if there is a ".current.parameters" node
                 // if so, add them to the queue list for paths to search
-                paramsPath = childPath + ".current.parameters";
+                paramsPath = "current.parameters";
                 if (child->element(paramsPath) != NULL) {
-                    queue.push_back(paramsPath);
+                    queue.push_back((pathBack+child->nodeComp()+"."+paramsPath));
                 }
             }
             else {
                 // add this path to the return list
-                retList.push_back(child->nodeComp());
+                retList.push_back(pathBack+child->nodeComp());
 
                 // look for embedded groups and phases
@@ -586,4 +604,5 @@
                         queue.push_back(cchildPath);
                     }
+                    delete cchild;
                 }
             }
@@ -591,4 +610,5 @@
             childList.erase(childIter);
             childIter = childList.begin();
+            delete child;
         }
 
@@ -629,4 +649,5 @@
         return retList;
     }
+
 
     thisv = this->entities(path);
@@ -642,10 +663,11 @@
         }
 
-        if (!path.empty()) {
-            thisSpath = path + "." + *thisIter;
-        }
-        else {
-            thisSpath = *thisIter;
-        }
+        //if (!path.empty()) {
+        //    thisSpath = path + "." + *thisIter;
+        //}
+        //else {
+        //    thisSpath = *thisIter;
+        //}
+        thisSpath = *thisIter;
 
         if (otherIter == otherv.end()) {
@@ -660,10 +682,11 @@
         else {
 
-            if (!path.empty()) {
-                otherSpath = path + "." + *otherIter;
-            }
-            else {
-                otherSpath = *otherIter;
-            }
+            //if (!path.empty()) {
+            //    otherSpath = path + "." + *otherIter;
+            //}
+            //else {
+            //    otherSpath = *otherIter;
+            //}
+            otherSpath = *otherIter;
 
             thisVal = this->value(thisSpath);
@@ -689,10 +712,11 @@
     while ( otherIter != otherv.end() ) {
 
-        if (!path.empty()) {
-            otherSpath = path + "." + *otherIter;
-        }
-        else {
-            otherSpath = *otherIter;
-        }
+        //if (!path.empty()) {
+        //    otherSpath = path + "." + *otherIter;
+        //}
+        //else {
+        //    otherSpath = *otherIter;
+        //}
+        otherSpath = *otherIter;
 
         otherVal = otherLib->value(otherSpath);
@@ -803,5 +827,6 @@
     RpLibrary* retLib = NULL;
     std::string parentPath = "";
-    std::string::size_type pos = 0;
+    // std::string::size_type pos = 0;
+    scew_element* ele = NULL;
     scew_element* retNode = NULL;
 
@@ -813,17 +838,13 @@
     if (path.empty()) {
         // an empty path returns the parent of the current RpLibrary
-        path = this->nodePath();
-    }
-
-    // get the path of the parent node
-    // check to see if the path lists a parent node.
-    pos = path.rfind(".",std::string::npos);
-    if (pos != std::string::npos) {
-        // there is a parent node, get the parent path.
-        parentPath = path.substr(0,pos);
-
-        // search for hte parent's node
-        retNode = _find(parentPath,NO_CREATE_PATH);
-
+        ele = this->root;
+    }
+    else {
+        // else find the node representing the provided path
+        ele = _find(path,NO_CREATE_PATH);
+    }
+
+    if (ele != NULL) {
+        retNode = scew_element_parent(ele);
         if (retNode) {
             // allocate a new rappture library object for the node
@@ -831,4 +852,8 @@
         }
     }
+    else {
+        // path was not found by _find
+    }
+
 
     return retLib;
@@ -848,5 +873,5 @@
 {
     RpLibrary* value = NULL;
-    RpLibrary* child = NULL;
+    // RpLibrary* child = NULL;
 
     if (!this->root) {
@@ -867,7 +892,6 @@
     }
 
-    while ( (child = value->children("",child)) ) {
-        this->put(toPath, child);
-    }
+    this->put(toPath, value);
+    delete value;
 
     return (*this);
@@ -880,4 +904,5 @@
 //
 // The lookup is reset when you send a NULL rpChilNode.
+// User is responsible for deleting returned values
 // 
 /**
@@ -996,5 +1021,6 @@
     // this was static so user never has to delete the retLib.
     // should be replaced by a smart pointer
-    static RpLibrary* retLib = NULL; 
+    // static RpLibrary* retLib = NULL; 
+    RpLibrary* retLib = NULL; 
     int myChildCount = 0;
     scew_element* parentNode = NULL;
@@ -1042,5 +1068,5 @@
 
     // clean up old memory
-    delete retLib;
+    // delete retLib;
 
     if ( (childNode = scew_element_next(parentNode,childNode)) ) {
@@ -1361,15 +1387,4 @@
         // path did not exist and was not created.
     }
-
-    /*
-    if (retNode) {
-        if ((new_elem = scew_element_copy(value->root))) {
-            if (scew_element_add_elem(retNode, new_elem)) {
-                retVal = 0;
-            }
-        }
-    }
-
-    */
 
     return *this;
Index: trunk/src/tcl/src/RpLibraryTclInterface.cc
===================================================================
--- trunk/src/tcl/src/RpLibraryTclInterface.cc	(revision 408)
+++ trunk/src/tcl/src/RpLibraryTclInterface.cc	(revision 424)
@@ -51,8 +51,10 @@
 static int RpTclLibRemove _ANSI_ARGS_(( ClientData cdata, Tcl_Interp *interp,
                                         int argc, const char *argv[]    ));
+/*
 static int RpTclLibResult _ANSI_ARGS_(( ClientData cdata, Tcl_Interp *interp,
                                         int argc, const char *argv[]    ));
 static int RpTclLibValue  _ANSI_ARGS_(( ClientData cdata, Tcl_Interp *interp,
                                         int argc, const char *argv[]    ));
+*/
 static int RpTclLibXml    _ANSI_ARGS_(( ClientData cdata, Tcl_Interp *interp,
                                         int argc, const char *argv[]    ));
@@ -77,10 +79,10 @@
         "?-as <fval>? ?-type <name>? ?<path>?",},
     {"copy", 2, (Blt_Op)RpTclLibCopy, 5, 6,
-        "<path> from ?<xmlobj>? <path>",},
-    {"diff", 1, (Blt_Op)RpTclLibDiff, 3, 3, "<xmlobj>",},
-    {"element", 1, (Blt_Op)RpTclLibElem, 2, 5, "?-as <fval>? ?<path>?",},
-    {"get", 1, (Blt_Op)RpTclLibGet, 2, 3, "?<path>?",},
-    {"info", 1, (Blt_Op)RpTclLibInfo, 3, 3, "<objType>",},
-    {"isa", 1, (Blt_Op)RpTclLibIsa, 3, 3, "<objType>",},
+        "path from ?xmlobj? path",},
+    {"diff", 1, (Blt_Op)RpTclLibDiff, 3, 3, "xmlobj",},
+    {"element", 1, (Blt_Op)RpTclLibElem, 2, 5, "?-as fval? ?path?",},
+    {"get", 1, (Blt_Op)RpTclLibGet, 2, 3, "?path?",},
+    {"info", 1, (Blt_Op)RpTclLibInfo, 3, 3, "objType",},
+    {"isa", 1, (Blt_Op)RpTclLibIsa, 3, 3, "objType",},
     {"parent", 2, (Blt_Op)RpTclLibParent, 2, 5, "?-as <fval>? ?<path>?",},
     {"put", 2, (Blt_Op)RpTclLibPut, 2, 8,
@@ -447,4 +449,6 @@
                 // evaluate the "-as" flag on the returned node
                 retStr = (node->*asProc)();
+                // remove the object, keep memory clean
+                delete node;
             }
             else {
@@ -484,5 +488,5 @@
     int nextarg          = 2;     // start parsing using the '2'th argument
     int argsLeft         = 0;     // temp variable for calculation
-    int noerr              = 0;     // err flag for Tcl_GetCommandInfo
+    int noerr            = 0;     // err flag for Tcl_GetCommandInfo
     Tcl_CmdInfo info;  // pointer to the command info
 
@@ -494,5 +498,5 @@
         Tcl_AppendResult(interp,
             "wrong # args: should be \"",
-            argv[0], " path from ?<xmlobj>? path\"",
+            argv[0], "copy path from ?xmlobj? path\"",
             (char*)NULL);
         return TCL_ERROR;
@@ -544,6 +548,4 @@
     // call the rappture library copy function
     ((RpLibrary*) cdata)->copy(toPath, fromPath, fromObj);
-
-    // delete the fromObj pointer ???
 
     // clear any previous result in the interpreter
@@ -602,7 +604,5 @@
             // there was an error getting the command info
             Tcl_AppendResult(interp, 
-                "There was an error getting the command info for "
-                "the provided library \"", otherLibStr.c_str(), "\'",
-                "\nAre you sure its a Rappture Library Object?",
+                "invalid command name \"", otherLibStr.c_str(), "\"",
                 (char*)NULL);
             return TCL_ERROR;
@@ -612,5 +612,5 @@
         Tcl_ResetResult(interp);
         Tcl_AppendResult(interp, 
-            "wrong # args: should be \"diff <xmlobj>\"",
+            "wrong # args: should be \"diff xmlobj\"",
             (char*)NULL);
         return TCL_ERROR;
@@ -708,5 +708,5 @@
                     else {
                         Tcl_AppendResult(interp, "bad flavor \"", argv[nextarg],
-                            "\" for -as: should be component, id, type, path, object",
+                            "\" for -as: should be component, id, object, path, type",
                             (char*)NULL);
                         return TCL_ERROR;
@@ -715,5 +715,5 @@
                 else {
                     Tcl_AppendResult(interp, "bad flavor \"\" for -as:", 
-                           " should be component, id, type, path, object",
+                           " should be component, id, object, path, type",
                             (char*)NULL);
                     return TCL_ERROR;
@@ -731,5 +731,5 @@
     if (argsLeft > 1) {
         Tcl_AppendResult(interp,
-            "wrong # args: should be \"element ?-as <fval>? ?<path>?\"",
+            "wrong # args: should be \"element ?-as fval? ?path?\"",
             (char*)NULL);
         return TCL_ERROR;
@@ -752,4 +752,6 @@
             // evaluate the "-as" flag on the returned node
             retStr = (node->*asProc)();
+            // remove the object, keep memory clean
+            delete node;
         }
         else {
@@ -840,5 +842,5 @@
         Tcl_ResetResult(interp);
         Tcl_AppendResult(interp, 
-            "wrong # args: should be \"info <infoType>\"",
+            "wrong # args: should be \"info objType\"",
             (char*)NULL);
         return TCL_ERROR;
@@ -897,5 +899,5 @@
         Tcl_ResetResult(interp);
         Tcl_AppendResult(interp, 
-            "wrong # args: should be \"isa <objType>\"",
+            "wrong # args: should be \"isa objType\"",
             (char*)NULL);
         return TCL_ERROR;
@@ -988,5 +990,5 @@
                     else {
                         Tcl_AppendResult(interp, "bad flavor \"", argv[nextarg],
-                            "\": should be component, id, type, path, object",
+                            "\": should be component, id, object, path, type",
                             (char*)NULL);
                         return TCL_ERROR;
@@ -995,5 +997,5 @@
                 else {
                     Tcl_AppendResult(interp, "bad flavor \"\" for -as: ",
-                            "should be component, id, type, path, object",
+                            "should be component, id, object, path, type",
                             (char*)NULL);
                     return TCL_ERROR;
@@ -1032,4 +1034,6 @@
             // evaluate the "-as" flag on the returned node
             retStr = (node->*asProc)();
+            // remove the object, keep memory clean
+            delete node;
         }
         else {
@@ -1080,31 +1084,29 @@
         if (nextarg < argc && *argv[nextarg] == '-') {
             if (strncmp(argv[nextarg],"-append",7) == 0) {
-                ++nextarg;
-                if (nextarg < argc) {
-                    if (strncmp(argv[nextarg],"yes",3) == 0 ) {
-                        append = 1;
-                        nextarg++;
-                    }
-                    else if (strncmp(argv[nextarg],"no",2) == 0 ) {
-                        append = 0;
-                        nextarg++;
-                    }
-                    else {
-                        appendExpectErr(interp,
-                                "expected boolean value but got ", 
-                                argv[nextarg]);
+                nextarg++;
+                if (argv[nextarg] != NULL) {
+                    if (Tcl_GetBoolean(interp, argv[nextarg], &append)) {
+                        // unrecognized value for -append option
+                        // Tcl_GetBoolean fills in error message
+                        // Tcl_AppendResult(interp,
+                        //     "expected boolean value but got \"", 
+                        //     argv[nextarg], "\"", (char*)NULL);
                         return TCL_ERROR;
                     }
+                    // nextarg++;
                 }
                 else {
-                    appendExpectErr(interp,
-                            "expected boolean value but got ", 
-                            argv[nextarg]);
+                    // if user does not specify wishes for this option,
+                    // return error.
+                    // unrecognized value for -units option
+                    Tcl_AppendResult(interp,
+                        "expected boolean value but got \"\"", (char*)NULL);
                     return TCL_ERROR;
                 }
             }
             else if (strncmp(argv[nextarg],"-id",3) == 0) {
-                id = std::string(argv[++nextarg]);
                 nextarg++;
+                id = std::string(argv[nextarg]);
+                // nextarg++;
             }
             else {
@@ -1113,4 +1115,5 @@
                 return TCL_ERROR;
             }
+            nextarg++;
         }
     }
@@ -1214,4 +1217,5 @@
 }
 
+/*
 int
 RpTclLibResult  (   ClientData cdata,
@@ -1239,4 +1243,5 @@
     return TCL_OK;
 }
+*/
 
 /**********************************************************************/
@@ -1255,4 +1260,5 @@
  */
 
+/*
 int
 RpTclLibValue   (   ClientData cdata,
@@ -1331,4 +1337,5 @@
     return TCL_OK;
 }
+*/
 
 /**********************************************************************/
Index: trunk/src/tcl/tests/children.test
===================================================================
--- trunk/src/tcl/tests/children.test	(revision 408)
+++ trunk/src/tcl/tests/children.test	(revision 424)
@@ -24,79 +24,78 @@
 # children "?-as <fval>? ?-type <name>? ?<path>?"
 #----------------------------------------------------------
+catch {unset lib}
+set lib [Rappture::library rplib_test.xml]
 test library-8.0.1 {children command 0 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children
 } {tool input output}
 test library-8.1.1 {children command path as default type default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children "input"
 } {string(formula) string(name) number(min) number(max)}
 test library-8.1.2 {children command path w/ id as default type default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children "input.number(min)"
 } {about default current}
 test library-8.1.3 {children command non-existant path 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children "kdsf.werw(we12)"
 } {}
 test library-8.2.1 {children command path 2 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib children "input.number(min)" "wreew"} msg] $msg
 } {1 {wrong # args: should be "children ?-as fval? ?-type name? ?path?"}}
-test library-8.3.1 {children command path -as flag  no option} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
+# this test works for tcl version of rappture, different error message
+#test library-8.3.1.1 {children command path -as flag  no option} {
+#    list [catch {$lib children -as} msg] $msg
+#} {1 {bad path component "-as"}}
+test library-8.3.1.2 {children command path -as flag  no option} {
     list [catch {$lib children -as} msg] $msg
 } {1 {bad flavor "" for -as: should be component, id, object, path, type}}
 test library-8.3.2 {children command path -as flag component path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -as component "input"
 } {string(formula) string(name) number(min) number(max)}
 test library-8.3.3 {children command path -as flag id path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -as id "input"
 } {formula name min max}
 test library-8.3.4 {children command path -as flag type path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -as type "input"
 } {string string number number}
 test library-8.3.5 {children command path -as path type path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -as path "input"
-} {.input.string(formula) .input.string(name) .input.number(min) .input.number(max)}
+} {input.string(formula) input.string(name) input.number(min) input.number(max)}
 test library-8.3.6 {children command path -as object type path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -as object "input"
-} {::libraryObj11 ::libraryObj12 ::libraryObj13 ::libraryObj14}
+} {::libraryObj1 ::libraryObj2 ::libraryObj3 ::libraryObj4}
+# this test works for old tcl bindings, different error message
+#test library-8.3.7 {children command path -as junk type path} {
+#    list [catch {$lib children -as junk "input"} msg] $msg
+#} {1 {bad flavor "junk": should be component, id, object, path, type}}
+# this test works for new tcl bindings, different error message
 test library-8.3.7 {children command path -as junk type path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib children -as junk "input"} msg] $msg
 } {1 {bad flavor "junk" for -as: should be component, id, object, path, type}}
 test library-8.4.1 {children command path -type number path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -type "number" "input"
 } {number(min) number(max)}
 test library-8.4.2 {children command path -type "" path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib children -type "" "input"
 } {string(formula) string(name) number(min) number(max)}
+test library-8.4.2 {children command path -type "blah" path} {
+    $lib children -type "blah" "input"
+} {}
 test library-8.5.1 {children command path -junk path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib children -junk "input"} msg] $msg
 } {1 {bad option "-junk": should be -as, -type}}
+test library-8.6.1 {children command 2 opts -as comp -type number, path} {
+    $lib children -as "component" -type "number" "input"
+} {number(min) number(max)}
+test library-8.6.2 {children command 2 opts -as id -type number, path} {
+    $lib children -as "id" -type "number" "input"
+} {min max}
+test library-8.6.3 {children command 2 opts -as type -type number, path} {
+    $lib children -as "type" -type "number" "input"
+} {number number}
+test library-8.6.4 {children command 2 opts -as path -type number, path} {
+    $lib children -as "path" -type "number" "input"
+} {input.number(min) input.number(max)}
+test library-8.6.5 {children command 2 opts -as object -type number, path} {
+    $lib children -as "object" -type "number" "input"
+} {::libraryObj5 ::libraryObj6}
 
 ::tcltest::cleanupTests
Index: trunk/src/tcl/tests/copy.test
===================================================================
--- trunk/src/tcl/tests/copy.test	(revision 408)
+++ trunk/src/tcl/tests/copy.test	(revision 424)
@@ -26,20 +26,44 @@
 catch {unset lib}
 set lib [Rappture::library rplib_test.xml]
-test library-9.0.1 {copy command, 0 args} {
+# this test works for old tcl bindings, different error message
+#test library-9.0.1.1 {copy command, 0 args} {
+#    list [catch {$lib copy} msg] $msg
+#} {1 {wrong # args: should be "libraryObj0 copy path from ?arg arg ...?"}}
+# this test works for new tcl bindings, different error message
+test library-9.0.1.2 {copy command, 0 args} {
     list [catch {$lib copy} msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 copy <path> from ?<xmlobj>? <path>"}}
-test library-9.0.2 {copy command, 0 args} {
+} {1 {wrong # args: should be "::libraryObj0 copy path from ?xmlobj? path"}}
+# this test works for old tcl bindings, different error message
+#test library-9.0.2.1 {copy command, 0 args} {
+#    list [catch {$lib copy "input.number(min)"} msg] $msg
+#} {1 {wrong # args: should be "libraryObj0 copy path from ?arg arg ...?"}}
+# this test works for new tcl bindings, different error message
+test library-9.0.2.2 {copy command, 0 args} {
     list [catch {$lib copy "input.number(min)"} msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 copy <path> from ?<xmlobj>? <path>"}}
-test library-9.0.3 {copy command, 1 arg} {
+} {1 {wrong # args: should be "::libraryObj0 copy path from ?xmlobj? path"}}
+# this test works for old tcl bindings, different error message
+#test library-9.0.3.1 {copy command, 1 arg} {
+#    list [catch {$lib copy "input.number(min)" from } msg] $msg
+#} {1 {wrong # args: should be "copy path from ?xmlobj? path"}}
+# this test works for new tcl bindings, different error message
+test library-9.0.3.2 {copy command, 1 arg} {
     list [catch {$lib copy "input.number(min)" from } msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 copy <path> from ?<xmlobj>? <path>"}}
+} {1 {wrong # args: should be "::libraryObj0 copy path from ?xmlobj? path"}}
+# this test works for old tcl bindings
+# does not work for new tcl bindings because the bad paths are not
+# discovered in the binding, but in the core copy function and
+# currently errors from the core functions are not relayed to 
+# the bindings.
 #test library-9.0.4 {copy command not enough arg} {
 #    list [catch {$lib copy "input.number(min)" from $lib} msg] $msg
 #} {1 {bad path component "::libraryObj0"}}
-test library-9.0.5 {copy command not enough arg} {
+# this test works for old tcl bindings, different error message
+#test library-9.0.5.1 {copy command not enough arg} {
+#    list [catch {$lib copy "input.number(min)" from } msg] $msg
+#} {1 {wrong # args: should be "copy path from ?xmlobj? path"}}
+test library-9.0.5.2 {copy command not enough arg} {
     list [catch {$lib copy "input.number(min)" from } msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 copy <path> from ?<xmlobj>? <path>"}}
-test library-9.1.1 {copy command from -> junk} {
+} {1 {wrong # args: should be "::libraryObj0 copy path from ?xmlobj? path"}}
+test library-9.1.1 {copy command, bad syntax, switched from -> junk} {
     list [catch {$lib copy "input.number(blah)" junk "input.number(min)"} msg] $msg
 } {1 {bad syntax: should be "copy path from ?xmlobj? path"}}
Index: trunk/src/tcl/tests/diff.test
===================================================================
--- trunk/src/tcl/tests/diff.test	(revision 408)
+++ trunk/src/tcl/tests/diff.test	(revision 424)
@@ -28,11 +28,18 @@
 catch {unset libDefault}
 catch {unset libFromGet}
+
 set lib [Rappture::library rplib_test.xml]
 set libnew [Rappture::library rplib_test.xml]
 set libDefault [Rappture::library rplib_test.xml]
 set libFromGet [$libDefault element -as object "input.number(max)"]
-test library-10.0.1 {diff command, no arguments} {
+
+# this test works for old tcl bindings, different error message
+#test library-10.0.1.1 {diff command, no arguments} {
+#    list [catch {$lib diff} msg] $msg
+#} {1 {wrong # args: should be "libraryObj0 diff libobj"}}
+# this test works for new tcl bindings, different error message
+test library-10.0.1.2 {diff command, no arguments} {
     list [catch {$lib diff} msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 diff <xmlobj>"}}
+} {1 {wrong # args: should be "::libraryObj0 diff xmlobj"}}
 test library-10.1.1 {diff command, one argument, no difference} {
     $lib diff $libnew
@@ -48,7 +55,25 @@
     $libFromGet diff $libDefault
 } {+ input.string(formula) dsd234ssdf3sdf {} + input.string(name) tnerruc {} + input.number(min) 1 {} + input.number(max) 3 {}}
-test library-10.2.1 {diff command, two arguments, returns error} {
+test library-10.2.1 {diff command, one argument} {
+    set lib1021 [Rappture::library rplib_test.xml]
+    $lib1021 put input.number(max).current "5"
+    $libDefault diff $lib1021
+} {c input.number(max) 3 5}
+test library-10.2.2 {diff command, one argument} {
+    set lib1022 [Rappture::library rplib_test.xml]
+    $lib1022 put input.number(max).new "5"
+    $libDefault diff $lib1022
+} {c input.number(max) 3 5}
+test library-10.3.1 {diff command, two arguments, returns error} {
     list [catch {$lib diff $libnew $libnew} msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 diff <xmlobj>"}}
+} {1 {wrong # args: should be "::libraryObj0 diff xmlobj"}}
+test library-10.3.2 {diff command, bad second arg, returns error} {
+    list [catch {$lib diff slfd} msg] $msg
+} {1 {invalid command name "slfd"}}
+test library-10.4.1 {diff command, bad second arg, returns error} {
+    set slfd 40
+    list [catch {$lib diff $slfd} msg] $msg
+} {1 {invalid command name "40"}}
+# no tests for xmlobj's that are not Rappture Libraries yet
 
 ::tcltest::cleanupTests
Index: trunk/src/tcl/tests/element.test
===================================================================
--- trunk/src/tcl/tests/element.test	(revision 408)
+++ trunk/src/tcl/tests/element.test	(revision 424)
@@ -19,4 +19,5 @@
 }
 catch {unset lib}
+set lib [Rappture::library rplib_test.xml]
 
 #----------------------------------------------------------
@@ -26,92 +27,66 @@
 #----------------------------------------------------------
 test library-5.0.1 {element command 0 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element
 } {}
 test library-5.1.1 {element command path as default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element "input"
 } {input}
 test library-5.1.2 {element command path w/ id as default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element "input.number(min)"
 } {number(min)}
 test library-5.1.3 {element command non-existant path 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element "kdsf.werw(we12)"
 } {}
 test library-5.2.1 {element command path 2 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib element "input.number(min)" "wreew"} msg] $msg
-} {1 {wrong # args: should be "element ?-as <fval>? ?<path>?"}}
-test library-5.3.1 {element command path -as flag  no option} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
+} {1 {wrong # args: should be "element ?-as fval? ?path?"}}
+# this test works for old tcl bindings, different error message
+#test library-5.3.1.1 {element command path -as flag  no option} {
+#    list [catch {$lib element -as} msg] $msg
+#} {1 {bad path component "-as"}}
+# this test works for new tcl bindings, different error message
+test library-5.3.1.2 {element command path -as flag  no option} {
     list [catch {$lib element -as} msg] $msg
-} {1 {bad flavor "" for -as: should be component, id, type, path, object}}
+} {1 {bad flavor "" for -as: should be component, id, object, path, type}}
 test library-5.3.2 {element command path -as component, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as component "input.number(max)"
 } {number(max)}
 test library-5.3.3 {element command path -as id, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as id "input.number(max)"
 } {max}
 test library-5.3.4 {element command path -as type, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as type "input.number(max)"
 } {number}
 test library-5.3.5 {element command path -as path, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as path "input.number(max)"
-} {.input.number(max)}
+} {input.number(max)}
 test library-5.3.6 {element command path -as object, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set ele [$lib element -as object "input.number(max)"]
     list [catch {$ele isa ::Rappture::LibraryObj} msg] $msg
 } {0 1}
-test library-5.3.7 {element command path -as junk, path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
+# this test works for old tcl bindings, different error message
+#test library-5.3.7.1 {element command path -as junk, path with id} {
+#    list [catch {$lib element -as junk "input.number(max)"} msg] $msg
+#} {1 {bad flavor "junk": should be component, id, object, path, type}}
+# this test works for new tcl bindings, different error message
+test library-5.3.7.2 {element command path -as junk, path with id} {
     list [catch {$lib element -as junk "input.number(max)"} msg] $msg
-} {1 {bad flavor "junk" for -as: should be component, id, type, path, object}}
+} {1 {bad flavor "junk" for -as: should be component, id, object, path, type}}
 test library-5.3.8 {element command path -as component, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as component "input.test(we)"
 } {}
 test library-5.3.9 {element command path -as id, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as id "input.test(we)"
 } {}
 test library-5.3.10 {element command path -as type, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as type "input.test(we)"
 } {}
 test library-5.3.11 {element command path -as path, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as path "input.test(we)"
 } {}
 test library-5.3.12 {element command path -as object, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib element -as object "input.test(we)"
 } {}
 test library-5.4.1 {element command path -junk path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib element -junk "input"} msg] $msg
 } {1 {bad option "-junk": should be -as}}
Index: trunk/src/tcl/tests/get.test
===================================================================
--- trunk/src/tcl/tests/get.test	(revision 408)
+++ trunk/src/tcl/tests/get.test	(revision 424)
@@ -19,4 +19,5 @@
 }
 catch {unset lib}
+set lib [Rappture::library rplib_test.xml]
 
 #----------------------------------------------------------
@@ -26,80 +27,50 @@
 #----------------------------------------------------------
 test get-1.0.1 {get command, zero arguments } {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set val [$lib get]
 } {}
 test get-1.0.2 {get command, two arguments } {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
-    list { catch [$lib get "input.number(min).default" "ggg"] msg} $msg
-} {i1 {wrong # args: should be ::libraryObj1 get ?<path>?}}
+    list [ catch {$lib get "input.number(min).default" "ggg"} msg] $msg
+} {1 {wrong # args: should be "::libraryObj0 get ?path?"}}
 #----------------------------------------------------------
 test get-1.1 {get command valid path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "tool.command"]
 } {@tool/graph @driver}
 #----------------------------------------------------------
 test get-1.1.2 {get command valid path, single level path doesnt exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "dsffds"]
 } {}
 test get-1.1.3 {get command valid path, multiple levels, path doesnt exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "dsffds.sdfsdf"]
 } {}
 test get-1.1.3 {get command valid path, multiple levels, with id, path doesnt exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "dsffds.sdfsdf(1234)"]
 } {}
 #----------------------------------------------------------
 test get-1.2.1 {get command valid full path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.number(min).default"]
 } {0}
 test get-1.2.2 {get command valid partial path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.(min).default"]
 } {0}
 test get-1.2.3 {get command valid partial path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.(min).current"]
 } {1}
 test get-3.2.5 {get command valid partial path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.number.default"]
     # this should grab the first occurance of number -> number(min)
 } {0}
 test get-3.2.6 {get command valid partial path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.number.noexist"]
 } {}
 test get-3.2.7 {get command valid partial path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.(min).noexist"]
 } {}
 test get-3.2.8 {get command invalid path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input..number"]
 } {}
 test get-3.2.9 {get command invalid path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.().number"]
 } {}
 test get-3.2.10 {get command invalid path number} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set cmd [$lib get "input.(!!).number"]
 } {}
Index: trunk/src/tcl/tests/isa.test
===================================================================
--- trunk/src/tcl/tests/isa.test	(revision 408)
+++ trunk/src/tcl/tests/isa.test	(revision 424)
@@ -19,4 +19,5 @@
 }
 catch {unset lib}
+set lib [Rappture::library rplib_test.xml]
 
 #----------------------------------------------------------
@@ -25,28 +26,18 @@
 #----------------------------------------------------------
 test library-7.0.1 {isa command 0 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib isa} msg] $msg
-} {1 {wrong # args: should be "::libraryObj0 isa <objType>"}}
+} {1 {wrong # args: should be "::libraryObj0 isa objType"}}
 test library-7.1.1 {isa command 1 valid arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib isa ::Rappture::LibraryObj
 } {1}
 test library-7.1.2 {isa command 1 invalid arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib isa ::Rappture::Curve
 } {0}
 test library-7.1.3 {isa command 1 invalid arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib isa sdfsdf
 } {0}
 test library-7.2.1 {isa command 2 args} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib isa ::Rappture::LibraryObj ::Rappture::LibraryObj} msg] $msg
-} {1 {wrong # args: should be "::libraryObj4 isa <objType>"}}
+} {1 {wrong # args: should be "::libraryObj0 isa objType"}}
 
 
Index: trunk/src/tcl/tests/parent.test
===================================================================
--- trunk/src/tcl/tests/parent.test	(revision 408)
+++ trunk/src/tcl/tests/parent.test	(revision 424)
@@ -18,5 +18,7 @@
     namespace import -force ::tcltest::*
 }
+
 catch {unset lib}
+set lib [Rappture::library rplib_test.xml]
 
 #----------------------------------------------------------
@@ -25,92 +27,56 @@
 #----------------------------------------------------------
 test library-6.0.1 {parent command 0 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent
 } {}
 test library-6.1.1 {parent command path as default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent "input"
 } {}
 test library-6.1.2 {parent command path w/ id as default 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent "input.number(min)"
 } {input}
 test library-6.1.3 {parent command non-existant path 1 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent "kdsf.werw(we12)"
 } {}
 test library-6.2.1 {parent command path 2 arg} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib parent "input.number(min)" "wreew"} msg] $msg
 } {1 {wrong # args: should be "parent ?-as <fval>? ?<path>?"}}
 test library-6.3.1 {parent command path -as flag  no option} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib parent -as} msg] $msg
-} {1 {bad flavor "" for -as: should be component, id, type, path, object}}
+} {1 {bad flavor "" for -as: should be component, id, object, path, type}}
 test library-6.3.2 {parent command path -as flag component path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as component "input.number(max).default"
 } {number(max)}
 test library-6.3.3 {parent command path -as flag id path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as id "input.number(max).default"
 } {max}
 test library-6.3.4 {parent command path -as flag type path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as type "input.number(max).default"
 } {number}
 test library-6.3.5 {parent command path -as path type path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as path "input.number(max).default"
-} {.input.number(max)}
+} {input.number(max)}
 test library-6.3.6 {parent command path -as object type path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     set libNew [$lib parent -as object "input.number(max).default"]
     list [catch {$libNew isa ::Rappture::LibraryObj} msg] $msg
 } {0 1}
 test library-6.3.7 {parent command path -as junk type path with id} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib parent -as junk "input.number(max)"} msg] $msg
-} {1 {bad flavor "junk" for -as: should be component, id, object, path, type}}
+} {1 {bad flavor "junk": should be component, id, object, path, type}}
 test library-6.3.8 {parent command path -as component, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as component "input.test(we).current"
 } {}
 test library-6.3.9 {parent command path -as id, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as id "input.test(we).current"
 } {}
 test library-6.3.10 {parent command path -as type, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as type "input.test(we).current"
 } {}
 test library-6.3.11 {parent command path -as path, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as path "input.test(we).current"
 } {}
 test library-6.3.12 {parent command path -as object, path does not exist} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     $lib parent -as object "input.test(we).current"
-} {::libraryObj18}
+} {}
 test library-6.4.1 {parent command path -junk path} {
-    catch {unset lib}
-    set lib [Rappture::library rplib_test.xml]
     list [catch {$lib parent -junk "input"} msg] $msg
 } {1 {bad option "-junk": should be -as}}
Index: trunk/src/tcl/tests/put.test
===================================================================
--- trunk/src/tcl/tests/put.test	(revision 408)
+++ trunk/src/tcl/tests/put.test	(revision 424)
@@ -107,5 +107,5 @@
     # $libPut xml
 } {1 {expected boolean value but got "junk"}}
-test library-4.2.5 {put command test append = "1"} {
+test library-4.2.6 {put command test append = "1"} {
     catch {unset libPut}
     set libPut [Rappture::library rplib_test.xml]
@@ -118,5 +118,5 @@
     set rslt
 } {0 {} val1val2}
-test library-4.2.5 {put command test append = "0"} {
+test library-4.2.7 {put command test append = "0"} {
     catch {unset libPut}
     set libPut [Rappture::library rplib_test.xml]
@@ -129,5 +129,5 @@
     set rslt
 } {0 {} val2}
-test library-4.2.5 {put command test append = "true"} {
+test library-4.2.8 {put command test append = "true"} {
     catch {unset libPut}
     set libPut [Rappture::library rplib_test.xml]
@@ -140,5 +140,5 @@
     set rslt
 } {0 {} val1val2}
-test library-4.2.5 {put command test append = "false"} {
+test library-4.2.9 {put command test append = "false"} {
     catch {unset libPut}
     set libPut [Rappture::library rplib_test.xml]
