Index: trunk/perl/Rappture.xs
===================================================================
--- trunk/perl/Rappture.xs	(revision 590)
+++ trunk/perl/Rappture.xs	(revision 591)
@@ -56,5 +56,14 @@
 	CODE:
 		THIS->put(path,value,"",append);
-		
+
+void
+RpLibrary::putFile( path, fileName, fileType, append )
+char *path
+char *fileName
+int fileType
+int append
+	CODE:
+		THIS->putFile(path,fileName,fileType,append);
+
 void
 RpLibrary::result()
Index: trunk/src/core/RpLibrary.cc
===================================================================
--- trunk/src/core/RpLibrary.cc	(revision 590)
+++ trunk/src/core/RpLibrary.cc	(revision 591)
@@ -1387,6 +1387,6 @@
                     std::string value,
                     std::string id,
-                    int append,
-                    int translateFlag)
+                    unsigned int append,
+                    unsigned int translateFlag)
 {
     scew_element* retNode = NULL;
@@ -1430,5 +1430,8 @@
 
 RpLibrary&
-RpLibrary::put ( std::string path, double value, std::string id, int append )
+RpLibrary::put (    std::string path,
+                    double value,
+                    std::string id,
+                    unsigned int append )
 {
     std::stringstream valStr;
@@ -1453,5 +1456,8 @@
 
 RpLibrary&
-RpLibrary::put ( std::string path, RpLibrary* value, std::string id, int append )
+RpLibrary::put (    std::string path,
+                    RpLibrary* value,
+                    std::string id,
+                    unsigned int append )
 {
     scew_element* retNode   = NULL;
@@ -1527,5 +1533,5 @@
                     const char* bytes,
                     int nbytes,
-                    int append  )
+                    unsigned int append  )
 {
     scew_element* retNode = NULL;
@@ -1564,5 +1570,5 @@
 
 /**********************************************************************/
-// METHOD: putData()
+// METHOD: putFile()
 /// Put data from a file into the xml.
 /**
@@ -1574,6 +1580,6 @@
 RpLibrary::putFile (std::string path,
                     std::string fileName,
-                    bool binary,
-                    int append  )
+                    unsigned int fileType,
+                    unsigned int append  )
 {
     scew_element* retNode = NULL;
@@ -1595,5 +1601,5 @@
             if ( (contents = scew_element_contents(retNode)) ) {
                 buf.append(contents);
-                if (binary == true) {
+                if (fileType == RPLIB_BINARY) {
                     // base64 decode and un-gzip the data
                     buf.decode();
@@ -1605,11 +1611,15 @@
         buf += fileBuf;
 
-        if (binary == true) {
+        if (fileType == RPLIB_BINARY) {
             // gzip and base64 encode the data
             buf.encode();
         }
 
-        bytesWritten = (unsigned int) buf.size();
+        bytesWritten = buf.size();
         scew_element_set_contents_binary(retNode,buf.bytes(),&bytesWritten);
+
+        if (bytesWritten == buf.size()) {
+            // error writing data to xml
+        }
 
     }
Index: trunk/src/core/RpLibrary.h
===================================================================
--- trunk/src/core/RpLibrary.h	(revision 590)
+++ trunk/src/core/RpLibrary.h	(revision 591)
@@ -20,4 +20,6 @@
     RPLIB_NO_TRANSLATE  = 0,
     RPLIB_TRANSLATE     = 1,
+    RPLIB_TEXT          = 0,
+    RPLIB_BINARY        = 1,
 };
 
@@ -112,26 +114,26 @@
                             std::string value,
                             std::string id = "",
-                            int append = RPLIB_OVERWRITE,
-                            int translateFlag = RPLIB_TRANSLATE   );
+                            unsigned int append = RPLIB_OVERWRITE,
+                            unsigned int translateFlag = RPLIB_TRANSLATE   );
 
         RpLibrary& put (    std::string path,
                             double value,
                             std::string id = "",
-                            int append = RPLIB_OVERWRITE    );
+                            unsigned int append = RPLIB_OVERWRITE    );
 
         RpLibrary& put (    std::string path,
                             RpLibrary* value,
                             std::string id = "",
-                            int append = RPLIB_OVERWRITE    );
+                            unsigned int append = RPLIB_OVERWRITE    );
 
         RpLibrary& putData( std::string path,
                             const char* bytes,
                             int nbytes,
-                            int append = RPLIB_OVERWRITE    );
+                            unsigned int append = RPLIB_OVERWRITE    );
 
         RpLibrary& putFile( std::string path,
                             std::string fileName,
-                            bool binary,
-                            int append = RPLIB_OVERWRITE    );
+                            unsigned int fileType = RPLIB_BINARY,
+                            unsigned int append = RPLIB_OVERWRITE    );
 
         RpLibrary* remove (std::string path = "");
Index: trunk/src/fortran/RpLibraryFInterface.cc
===================================================================
--- trunk/src/fortran/RpLibraryFInterface.cc	(revision 590)
+++ trunk/src/fortran/RpLibraryFInterface.cc	(revision 591)
@@ -5,5 +5,5 @@
  * ======================================================================
  *  AUTHOR:  Derrick Kearney, Purdue University
- *  Copyright (c) 2004-2005  Purdue Research Foundation
+ *  Copyright (c) 2004-2007  Purdue Research Foundation
  *
  *  See the file "license.terms" for information on usage and
@@ -670,4 +670,71 @@
 
 }
+
+
+/**********************************************************************/
+// FUNCTION: rp_lib_put_data()
+/// Put string into Rappture Library Object at location 'path'.
+/**
+ */
+void rp_lib_put_data( int* handle,
+                        char* path,
+                        char* bytes,
+                        int* nbytes,
+                        int* append,
+                        int path_len,
+                        int bytes_len
+                      )
+{
+    std::string inPath = "";
+    RpLibrary* lib = NULL;
+
+    inPath = null_terminate_str(path,path_len);
+
+    if ((handle) && (*handle != 0)) {
+        lib = getObject_Lib(*handle);
+
+        if (lib) {
+            lib->putData(inPath,bytes,*nbytes,*append);
+        }
+    }
+
+    return;
+
+}
+
+
+/**********************************************************************/
+// FUNCTION: rp_lib_put_file()
+/// Put string into Rappture Library Object at location 'path'.
+/**
+ */
+void rp_lib_put_file( int* handle,
+                        char* path,
+                        char* fileName,
+                        int* fileType,
+                        int* append,
+                        int path_len,
+                        int fileName_len
+                      )
+{
+    std::string inPath = "";
+    std::string inFileName = "";
+    RpLibrary* lib = NULL;
+
+    inPath = null_terminate_str(path,path_len);
+    inFileName = null_terminate_str(fileName,fileName_len);
+
+    if ((handle) && (*handle != 0)) {
+        lib = getObject_Lib(*handle);
+
+        if (lib) {
+            lib->putFile(inPath,inFileName,*fileType,*append);
+        }
+    }
+
+    return;
+
+}
+
 
 //void rp_lib_put_obj( int* handle, 
Index: trunk/src/fortran/RpLibraryFInterface.h
===================================================================
--- trunk/src/fortran/RpLibraryFInterface.h	(revision 590)
+++ trunk/src/fortran/RpLibraryFInterface.h	(revision 591)
@@ -5,5 +5,5 @@
  * ======================================================================
  *  AUTHOR:  Derrick S. Kearney, Purdue University
- *  Copyright (c) 2004-2005  Purdue Research Foundation
+ *  Copyright (c) 2004-2007  Purdue Research Foundation
  *
  *  See the file "license.terms" for information on usage and
@@ -95,4 +95,20 @@
                             int id_len );
 
+void rp_lib_put_data (      int* handle,
+                            char* path,
+                            char* bytes,
+                            int* nbytes,
+                            int* append,
+                            int path_len,
+                            int bytes_len );
+
+void rp_lib_put_file (      int* handle,
+                            char* path,
+                            char* fileName,
+                            int* fileType,
+                            int* append,
+                            int path_len,
+                            int fileName_len );
+
 /*
  * rp_lib_put_obj still needs to be written
Index: trunk/src/fortran/RpLibraryFStubs.c
===================================================================
--- trunk/src/fortran/RpLibraryFStubs.c	(revision 590)
+++ trunk/src/fortran/RpLibraryFStubs.c	(revision 591)
@@ -5,5 +5,5 @@
  * ======================================================================
  *  AUTHOR:  Derrick Kearney, Purdue University
- *  Copyright (c) 2004-2005  Purdue Research Foundation
+ *  Copyright (c) 2004-2007  Purdue Research Foundation
  *
  *  See the file "license.terms" for information on usage and
@@ -348,5 +348,6 @@
                         int value_len ) {
 
-    return rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    return;
 }
 
@@ -359,5 +360,6 @@
                         int value_len ) {
 
-    return rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    return;
 }
 
@@ -370,5 +372,6 @@
                         int value_len ) {
 
-    return rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    rp_lib_put_str(handle,path,value,append,path_len,value_len);
+    return;
 }
 
@@ -383,6 +386,6 @@
                         int id_len ) {
 
-    return rp_lib_put_id_str( handle, path, value,id,append,
-                              path_len,value_len,id_len);
+    rp_lib_put_id_str(handle,path,value,id,append,path_len,value_len,id_len);
+    return;
 }
 
@@ -397,6 +400,6 @@
                         int id_len ) {
 
-    return rp_lib_put_id_str( handle, path, value,id,append,
-                              path_len,value_len,id_len);
+    rp_lib_put_id_str(handle,path,value,id,append,path_len,value_len,id_len);
+    return;
 }
 
@@ -411,6 +414,84 @@
                         int id_len ) {
 
-    return rp_lib_put_id_str( handle, path, value,id,append,
-                              path_len,value_len,id_len);
+    rp_lib_put_id_str(handle,path,value,id,append,path_len,value_len,id_len);
+    return;
+}
+
+void
+rp_lib_put_data_ (      int* handle,
+                        char* path,
+                        char* bytes,
+                        int* nbytes,
+                        int* append,
+                        int path_len,
+                        int bytes_len ) {
+
+    rp_lib_put_data(handle,path,bytes,nbytes,append,path_len,bytes_len);
+    return;
+}
+
+void
+rp_lib_put_data__ (     int* handle,
+                        char* path,
+                        char* bytes,
+                        int* nbytes,
+                        int* append,
+                        int path_len,
+                        int bytes_len ) {
+
+    rp_lib_put_data(handle,path,bytes,nbytes,append,path_len,bytes_len);
+    return;
+}
+
+void
+RP_LIB_PUT_DATA (       int* handle,
+                        char* path,
+                        char* bytes,
+                        int* nbytes,
+                        int* append,
+                        int path_len,
+                        int bytes_len ) {
+
+    rp_lib_put_data(handle,path,bytes,nbytes,append,path_len,bytes_len);
+    return;
+}
+
+void
+rp_lib_put_file_ (      int* handle,
+                        char* path,
+                        char* fileName,
+                        int* fileType,
+                        int* append,
+                        int path_len,
+                        int fileName_len ) {
+
+    rp_lib_put_file(handle,path,fileName,fileType,append,path_len,fileName_len);
+    return;
+}
+
+void
+rp_lib_put_file__ (     int* handle,
+                        char* path,
+                        char* fileName,
+                        int* fileType,
+                        int* append,
+                        int path_len,
+                        int fileName_len ) {
+
+    rp_lib_put_file(handle,path,fileName,fileType,append,path_len,fileName_len);
+    return;
+}
+
+void
+RP_LIB_PUT_FILE (       int* handle,
+                        char* path,
+                        char* fileName,
+                        int* fileType,
+                        int* append,
+                        int path_len,
+                        int fileName_len ) {
+
+    rp_lib_put_file(handle,path,fileName,fileType,append,path_len,fileName_len);
+    return;
 }
 
Index: trunk/src/fortran/RpLibraryFStubs.h
===================================================================
--- trunk/src/fortran/RpLibraryFStubs.h	(revision 590)
+++ trunk/src/fortran/RpLibraryFStubs.h	(revision 591)
@@ -5,5 +5,5 @@
  * ======================================================================
  *  AUTHOR:  Derrick Kearney, Purdue University
- *  Copyright (c) 2004-2005  Purdue Research Foundation
+ *  Copyright (c) 2004-2007  Purdue Research Foundation
  *
  *  See the file "license.terms" for information on usage and
@@ -98,4 +98,21 @@
                             int id_len );
 
+void rp_lib_put_data_ (     int* handle,
+                            char* path,
+                            char* bytes,
+                            int* nbytes,
+                            int* append,
+                            int path_len,
+                            int bytes_len );
+
+void rp_lib_put_file_ (     int* handle,
+                            char* path,
+                            char* fileName,
+                            int* fileType,
+                            int* append,
+                            int path_len,
+                            int fileName_len );
+
+/*
 void rp_lib_put_obj_ (      int* handle,
                             char* path,
@@ -111,4 +128,5 @@
                             int path_len,
                             int id_len );
+*/
 
 int rp_lib_remove_ (        int* handle,
@@ -221,4 +239,21 @@
                             int id_len );
 
+void rp_lib_put_data__ (    int* handle,
+                            char* path,
+                            char* bytes,
+                            int* nbytes,
+                            int* append,
+                            int path_len,
+                            int bytes_len );
+
+void rp_lib_put_file__ (    int* handle,
+                            char* path,
+                            char* fileName,
+                            int* fileType,
+                            int* append,
+                            int path_len,
+                            int fileName_len );
+
+/*
 void rp_lib_put_obj__ (     int* handle,
                             char* path,
@@ -234,4 +269,5 @@
                             int path_len,
                             int id_len );
+*/
 
 int rp_lib_remove__ (       int* handle,
@@ -345,4 +381,20 @@
                             int id_len );
 
+void RP_LIB_PUT_DATA (      int* handle,
+                            char* path,
+                            char* bytes,
+                            int* nbytes,
+                            int* append,
+                            int path_len,
+                            int bytes_len );
+
+void RP_LIB_PUT_FILE (      int* handle,
+                            char* path,
+                            char* fileName,
+                            int* fileType,
+                            int* append,
+                            int path_len,
+                            int fileName_len );
+/*
 void RP_LIB_PUT_OBJ (       int* handle,
                             char* path,
@@ -358,4 +410,5 @@
                             int path_len,
                             int id_len );
+*/
 
 int RP_LIB_REMOVE (         int* handle,
@@ -391,5 +444,5 @@
 /**********************************************************/
 
-#ifdef __cplusplus 
+#ifdef __cplusplus
     }
 #endif
Index: trunk/src/matlab/Makefile.in
===================================================================
--- trunk/src/matlab/Makefile.in	(revision 590)
+++ trunk/src/matlab/Makefile.in	(revision 591)
@@ -59,4 +59,5 @@
 			rpLibPutString.mexglx \
 			rpLibPutDouble.mexglx \
+			rpLibPutFile.mexglx \
 			rpLibNodeComp.mexglx \
 			rpLibNodeType.mexglx \
@@ -118,4 +119,6 @@
 rpLibPutDouble.mexglx:
 	$(MEX) rpLibPutDouble.cc          $(MATLAB_COMP_ARGS)
+rpLibPutFile.mexglx:
+	$(MEX) rpLibPutFile.cc            $(MATLAB_COMP_ARGS)
 rpLibNodeComp.mexglx:
 	$(MEX) rpLibNodeComp.cc           $(MATLAB_COMP_ARGS)
Index: trunk/src/matlab/rpLibPutFile.cc
===================================================================
--- trunk/src/matlab/rpLibPutFile.cc	(revision 591)
+++ trunk/src/matlab/rpLibPutFile.cc	(revision 591)
@@ -0,0 +1,71 @@
+/*
+ * ----------------------------------------------------------------------
+ *  INTERFACE: Matlab Rappture Library Source
+ *
+ *    [err] = rpLibPutFile(libHandle,path,fileName,fileType,append)
+ *
+ * ======================================================================
+ *  AUTHOR:  Derrick Kearney, Purdue University
+ *  Copyright (c) 2004-2007  Purdue Research Foundation
+ *
+ *  See the file "license.terms" for information on usage and
+ *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * ======================================================================
+ */
+
+#include "RpMatlabInterface.h"
+
+/**********************************************************************/
+// METHOD: [err] = rpLibPutFile (libHandle,path,fileName,fileType,append)
+/// Set the value of a node.
+/**
+ * Clients use this to set the value of a node to the contents of a file.
+ * If the path is not specified, it sets the value for the root node.
+ * Otherwise, it sets the value for the element specified
+ * by the path.  The value is treated as the text within the
+ * tag at the tail of the path.
+ *
+ * FileName is the name of the file to import into the rappture object
+ * FileType is an integer representing the type of file to include, text
+ * (use 0) or binary (use 1).
+ * Append is an integer telling if this new data should overwrite
+ * (use 0) or be appended (use 1) to previous data in this node.
+ *
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[],
+                 int nrhs, const mxArray *prhs[])
+{
+    int          libIndex = 0;
+    unsigned int append = 0;
+    unsigned int fileType = 0;
+    int          err = 1;
+    RpLibrary*   lib = NULL;
+    std::string  path = "";
+    std::string  fileName = "";
+
+    /* Check for proper number of arguments. */
+    if (nrhs != 4) {
+        mexErrMsgTxt("Two input required.");
+    }
+
+    libIndex = getIntInput(prhs[0]);
+    path     = getStringInput(prhs[1]);
+    fileName = getStringInput(prhs[2]);
+    fileType = (unsigned int) getIntInput(prhs[3]);
+    append   = (unsigned int) getIntInput(prhs[4]);
+
+    /* Call the C++ subroutine. */
+    if ( (libIndex > 0) && (!path.empty()) ) {
+        lib = getObject_Lib(libIndex);
+
+        if (lib) {
+            lib->putFile(path,fileName,fileType,append);
+            err = 0;
+        }
+    }
+
+    plhs[0] = mxCreateDoubleScalar(err);
+
+    return;
+}
Index: trunk/src/octave/Makefile.in
===================================================================
--- trunk/src/octave/Makefile.in	(revision 590)
+++ trunk/src/octave/Makefile.in	(revision 591)
@@ -56,4 +56,5 @@
 			rpLibPutDouble.oct \
 			rpLibPutSingle.oct \
+			rpLibPutFile.oct \
 			rpLibResult.oct \
 			rpLibXml.oct \
@@ -106,4 +107,6 @@
 rpLibPutSingle.oct:
 	$(OCT) rpLibPutString.cc          $(OCTAVE_COMP_ARGS)
+rpLibPutFile.oct:
+	$(OCT) rpLibPutFile.cc            $(OCTAVE_COMP_ARGS)
 rpLibResult.oct:
 	$(OCT) rpLibResult.cc             $(OCTAVE_COMP_ARGS)
Index: trunk/src/octave/rpLibPutFile.cc
===================================================================
--- trunk/src/octave/rpLibPutFile.cc	(revision 591)
+++ trunk/src/octave/rpLibPutFile.cc	(revision 591)
@@ -0,0 +1,110 @@
+/*
+ * ----------------------------------------------------------------------
+ *  INTERFACE: Octave Rappture Library Source
+ *
+ *    [err] = rpLibPutFile(libHandle,path,fileName,fileType,append)
+ *
+ * ======================================================================
+ *  AUTHOR:  Derrick Kearney, Purdue University
+ *  Copyright (c) 2005-2007
+ *  Purdue Research Foundation, West Lafayette, IN
+ * ======================================================================
+ */
+
+#include "RpOctaveInterface.h"
+
+/**********************************************************************/
+// METHOD: [err] = rpLibPutFile (libHandle,path,fileName,fileType,append)
+/// Set the value of a node.
+/**
+ * Clients use this to set the value of a node.  If the path
+ * is not specified, it sets the value for the root node.
+ * Otherwise, it sets the value for the element specified
+ * by the path.  The value is treated as the text within the 
+ * tag at the tail of the path.
+ *
+ * FileName is the name of the file to import into the rappture object
+ * FileType is an integer representing the type of file to include, text
+ * (use 0) or binary (use 1).
+ * Append is an integer telling if this new data should overwrite
+ * (use 0) or be appended (use 1) to previous data in this node.
+ *
+ */
+
+DEFUN_DLD (rpLibPutString, args, ,
+"-*- texinfo -*-\n\
+[err] = rpLibPutString(@var{libHandle},@var{path},@var{value},@var{append})\n\
+\n\
+Clients use this to set the value of a node.  If the @var{path}\n\
+is not specified (ie. empty string ""), it sets the value for the\n\
+root node.  Otherwise, it sets the value for the element specified\n\
+by the path.  The @var{value} is treated as the text within the \n\
+tag at the tail of the @var{path}.\n\
+\n\
+@var{fileName} is the name of the file to import into the rappture object\n\
+@var{fileType} is an integer representing the type of file to include, text\n\
+(use 0) or binary (use 1).\n\
+@var{append} is an integer telling if this new data should overwrite\n\
+(use 0) or be appended (use 1) to previous data in this node.\n\
+\n\
+Error Codes: err = 0 is success, anything else is failure.")
+{
+    static std::string who = "rpLibPutString";
+
+    // The list of values to return.
+    octave_value_list retval;
+    int err               = 1;
+    int nargin            = args.length ();
+    int libHandle         = 0;
+    std::string path      = "";
+    std::string fileName  = "";
+    unsigned int fileType = 0;
+    unsigned int append   = 0;
+    RpLibrary* lib        = NULL;
+
+    if (nargin == 4) {
+
+        if ( args(0).is_real_scalar() &&
+             args(1).is_string()      &&
+             args(2).is_string()      &&
+             args(3).is_real_scalar() &&
+             args(3).is_real_scalar()   ) {
+
+            libHandle = args(0).int_value ();
+            path      = args(1).string_value ();
+            fileName  = args(2).string_value ();
+            fileType  = (unsigned int) args(3).int_value ();
+            append    = (unsigned int) args(3).int_value ();
+
+            /* Call the C subroutine. */
+            // the only input that has restrictions is libHandle
+            // all other inputs may be empty strings or any integer value
+            if ( (libHandle >= 0) ) {
+
+                lib = getObject_Lib(libHandle);
+                if (lib) {
+                    lib->putFile(path,fileName,fileType,append);
+                    err = 0;
+                }
+                else {
+                    // lib is NULL, not found in dictionary
+                }
+            }
+            else {
+                // libHandle is negative
+                print_usage (who.c_str());
+            }
+        }
+        else {
+            // wrong argument types
+            print_usage (who.c_str());
+        }
+    }
+    else {
+        // wrong number of arguments
+        print_usage (who.c_str());
+    }
+
+    retval(0) = err;
+    return retval;
+}
