Changeset 597
- Timestamp:
- Mar 1, 2007, 11:24:02 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r577 r597 139 139 cd gui; make clean; cd -; 140 140 cd perl; make clean; cd -; 141 cd python; rm -rf build; rm setup.py;cd -;141 cd python; rm -rf build; cd -; 142 142 cd src; make clean; cd -; 143 143 cd src/matlab; make clean; cd -; -
trunk/examples/c-example/compress.c
r594 r597 37 37 "Example loading of a DX file",RPLIB_OVERWRITE); 38 38 rpPutFile(lib,"output.field(dxFile1).component.dx", 39 dxFilePath,RPLIB_ BINARY,RPLIB_OVERWRITE);39 dxFilePath,RPLIB_COMPRESS,RPLIB_OVERWRITE); 40 40 41 41 // write output to run file and signal -
trunk/examples/c-example/compress.cc
r594 r597 38 38 "Example loading of a DX file","",RPLIB_OVERWRITE); 39 39 lib->putFile("output.field(dxFile1).component.dx", 40 dxFilePath,RPLIB_ BINARY,RPLIB_OVERWRITE);40 dxFilePath,RPLIB_COMPRESS,RPLIB_OVERWRITE); 41 41 42 42 -
trunk/perl/lib/Rappture.pm
r484 r597 93 93 =head1 COPYRIGHT AND LICENSE 94 94 95 Copyright (c) 2006 , Purdue Research Foundation95 Copyright (c) 2006-2007, Purdue Research Foundation 96 96 All rights reserved. 97 97 -
trunk/src/core/RpLibrary.cc
r591 r597 1580 1580 RpLibrary::putFile (std::string path, 1581 1581 std::string fileName, 1582 unsigned int fileType,1582 unsigned int compress, 1583 1583 unsigned int append ) 1584 1584 { … … 1588 1588 Rappture::Buffer fileBuf; 1589 1589 unsigned int bytesWritten = 0; 1590 std::string value = ""; 1591 std::string transContents = ""; 1590 1592 1591 1593 if (!this->root) { … … 1601 1603 if ( (contents = scew_element_contents(retNode)) ) { 1602 1604 buf.append(contents); 1603 if ( fileType == RPLIB_BINARY) {1605 if (compress == RPLIB_COMPRESS) { 1604 1606 // base64 decode and un-gzip the data 1605 1607 buf.decode(); … … 1610 1612 fileBuf.load(fileName.c_str()); 1611 1613 buf += fileBuf; 1612 1613 if (fileType == RPLIB_BINARY) { 1614 fileBuf.clear(); 1615 1616 if (compress == RPLIB_COMPRESS) { 1614 1617 // gzip and base64 encode the data 1615 1618 buf.encode(); 1619 } 1620 else { 1621 value = std::string(buf.bytes(),buf.size()); 1622 buf.clear(); 1623 _translateIn(value,transContents); 1624 buf.append(transContents.c_str(),transContents.size()); 1616 1625 } 1617 1626 -
trunk/src/core/RpLibrary.h
r591 r597 20 20 RPLIB_NO_TRANSLATE = 0, 21 21 RPLIB_TRANSLATE = 1, 22 RPLIB_ TEXT= 0,23 RPLIB_ BINARY= 1,22 RPLIB_NO_COMPRESS = 0, 23 RPLIB_COMPRESS = 1, 24 24 }; 25 25 … … 39 39 #include <cctype> 40 40 #include <list> 41 #include " RpBuffer.h"41 #include "rappture2/RpBuffer.h" 42 42 43 43 /* indentation size (in whitespaces) */ … … 134 134 RpLibrary& putFile( std::string path, 135 135 std::string fileName, 136 unsigned int fileType = RPLIB_BINARY,136 unsigned int compress = RPLIB_COMPRESS, 137 137 unsigned int append = RPLIB_OVERWRITE ); 138 138 -
trunk/src/fortran/RpLibraryFInterface.cc
r591 r597 688 688 std::string inPath = ""; 689 689 RpLibrary* lib = NULL; 690 691 inPath = null_terminate_str(path,path_len); 692 693 if ((handle) && (*handle != 0)) { 694 lib = getObject_Lib(*handle); 695 696 if (lib) { 697 lib->putData(inPath,bytes,*nbytes,*append); 690 int bufferSize = 0; 691 692 inPath = null_terminate_str(path,path_len); 693 694 if (*nbytes < bytes_len) { 695 bufferSize = *nbytes; 696 } 697 else { 698 bufferSize = bytes_len; 699 } 700 701 if ((handle) && (*handle != 0)) { 702 lib = getObject_Lib(*handle); 703 704 if (lib) { 705 lib->putData(inPath,bytes,bufferSize,*append); 698 706 } 699 707 } … … 712 720 char* path, 713 721 char* fileName, 714 int* fileType,722 int* compress, 715 723 int* append, 716 724 int path_len, … … 729 737 730 738 if (lib) { 731 lib->putFile(inPath,inFileName,* fileType,*append);739 lib->putFile(inPath,inFileName,*compress,*append); 732 740 } 733 741 } -
trunk/src/fortran/RpLibraryFInterface.h
r591 r597 106 106 char* path, 107 107 char* fileName, 108 int* fileType,108 int* compress, 109 109 int* append, 110 110 int path_len, -
trunk/src/fortran/RpLibraryFStubs.c
r591 r597 461 461 char* path, 462 462 char* fileName, 463 int* fileType,463 int* compress, 464 464 int* append, 465 465 int path_len, 466 466 int fileName_len ) { 467 467 468 rp_lib_put_file(handle,path,fileName, fileType,append,path_len,fileName_len);468 rp_lib_put_file(handle,path,fileName,compress,append,path_len,fileName_len); 469 469 return; 470 470 } … … 474 474 char* path, 475 475 char* fileName, 476 int* fileType,476 int* compress, 477 477 int* append, 478 478 int path_len, 479 479 int fileName_len ) { 480 480 481 rp_lib_put_file(handle,path,fileName, fileType,append,path_len,fileName_len);481 rp_lib_put_file(handle,path,fileName,compress,append,path_len,fileName_len); 482 482 return; 483 483 } … … 487 487 char* path, 488 488 char* fileName, 489 int* fileType,489 int* compress, 490 490 int* append, 491 491 int path_len, 492 492 int fileName_len ) { 493 493 494 rp_lib_put_file(handle,path,fileName, fileType,append,path_len,fileName_len);494 rp_lib_put_file(handle,path,fileName,compress,append,path_len,fileName_len); 495 495 return; 496 496 } -
trunk/src/fortran/RpLibraryFStubs.h
r591 r597 109 109 char* path, 110 110 char* fileName, 111 int* fileType,111 int* compress, 112 112 int* append, 113 113 int path_len, … … 250 250 char* path, 251 251 char* fileName, 252 int* fileType,252 int* compress, 253 253 int* append, 254 254 int path_len, … … 392 392 char* path, 393 393 char* fileName, 394 int* fileType,394 int* compress, 395 395 int* append, 396 396 int path_len, -
trunk/src/matlab/Makefile.in
r591 r597 59 59 rpLibPutString.mexglx \ 60 60 rpLibPutDouble.mexglx \ 61 rpLibPutData.mexglx \ 61 62 rpLibPutFile.mexglx \ 62 63 rpLibNodeComp.mexglx \ … … 119 120 rpLibPutDouble.mexglx: 120 121 $(MEX) rpLibPutDouble.cc $(MATLAB_COMP_ARGS) 122 rpLibPutData.mexglx: 123 $(MEX) rpLibPutData.cc $(MATLAB_COMP_ARGS) 121 124 rpLibPutFile.mexglx: 122 125 $(MEX) rpLibPutFile.cc $(MATLAB_COMP_ARGS) -
trunk/src/matlab/rpLibPutFile.cc
r591 r597 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [err] = rpLibPutFile(libHandle,path,fileName, fileType,append)5 * [err] = rpLibPutFile(libHandle,path,fileName,compress,append) 6 6 * 7 7 * ====================================================================== … … 17 17 18 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPutFile (libHandle,path,fileName, fileType,append)19 // METHOD: [err] = rpLibPutFile (libHandle,path,fileName,compress,append) 20 20 /// Set the value of a node. 21 21 /** … … 27 27 * 28 28 * FileName is the name of the file to import into the rappture object 29 * FileType is an integer representing the type of file to include, text30 * (use 0) or binary (use 1).29 * Compress is an integer telling if you want the data compressed (use 1) 30 * or uncompressed (use 0). 31 31 * Append is an integer telling if this new data should overwrite 32 32 * (use 0) or be appended (use 1) to previous data in this node. … … 39 39 int libIndex = 0; 40 40 unsigned int append = 0; 41 unsigned int fileType= 0;41 unsigned int compress = 0; 42 42 int err = 1; 43 43 RpLibrary* lib = NULL; … … 46 46 47 47 /* Check for proper number of arguments. */ 48 if (nrhs != 4) {49 mexErrMsgTxt(" Two inputrequired.");48 if (nrhs != 5) { 49 mexErrMsgTxt("Five inputs required."); 50 50 } 51 51 … … 53 53 path = getStringInput(prhs[1]); 54 54 fileName = getStringInput(prhs[2]); 55 fileType= (unsigned int) getIntInput(prhs[3]);55 compress = (unsigned int) getIntInput(prhs[3]); 56 56 append = (unsigned int) getIntInput(prhs[4]); 57 57 … … 61 61 62 62 if (lib) { 63 lib->putFile(path,fileName, fileType,append);63 lib->putFile(path,fileName,compress,append); 64 64 err = 0; 65 65 } -
trunk/src/octave/rpLibPutFile.cc
r591 r597 3 3 * INTERFACE: Octave Rappture Library Source 4 4 * 5 * [err] = rpLibPutFile(libHandle,path,fileName, fileType,append)5 * [err] = rpLibPutFile(libHandle,path,fileName,compress,append) 6 6 * 7 7 * ====================================================================== … … 25 25 * 26 26 * FileName is the name of the file to import into the rappture object 27 * FileType is an integer representing the type of file to include, text28 * (use 0) or binary (use 1).27 * Compress is an integer telling if the provided data should be compressed 28 * (use 1) or left uncompressed (use 0). 29 29 * Append is an integer telling if this new data should overwrite 30 30 * (use 0) or be appended (use 1) to previous data in this node. … … 34 34 DEFUN_DLD (rpLibPutString, args, , 35 35 "-*- texinfo -*-\n\ 36 [err] = rpLibPutString(@var{libHandle},@var{path},@var{ value},@var{append})\n\36 [err] = rpLibPutString(@var{libHandle},@var{path},@var{fileName},@var{compress},@var{append})\n\ 37 37 \n\ 38 38 Clients use this to set the value of a node. If the @var{path}\n\ 39 39 is not specified (ie. empty string ""), it sets the value for the\n\ 40 40 root node. Otherwise, it sets the value for the element specified\n\ 41 by the path. The @var{value}is treated as the text within the \n\41 by the path. The added data is treated as the text within the \n\ 42 42 tag at the tail of the @var{path}.\n\ 43 43 \n\ 44 44 @var{fileName} is the name of the file to import into the rappture object\n\ 45 @var{ fileType} is an integer representing the type of file to include, text\n\46 (use 0) or binary (use 1).\n\45 @var{compress} is an integer telling if the provided data should be compressed\n\ 46 (use 1) or left uncompressed (use 0).\n\ 47 47 @var{append} is an integer telling if this new data should overwrite\n\ 48 48 (use 0) or be appended (use 1) to previous data in this node.\n\ … … 50 50 Error Codes: err = 0 is success, anything else is failure.") 51 51 { 52 static std::string who = "rpLibPut String";52 static std::string who = "rpLibPutFile"; 53 53 54 54 // The list of values to return. … … 59 59 std::string path = ""; 60 60 std::string fileName = ""; 61 unsigned int fileType= 0;61 unsigned int compress = 0; 62 62 unsigned int append = 0; 63 63 RpLibrary* lib = NULL; 64 64 65 if (nargin == 4) {65 if (nargin == 5) { 66 66 67 67 if ( args(0).is_real_scalar() && … … 69 69 args(2).is_string() && 70 70 args(3).is_real_scalar() && 71 args( 3).is_real_scalar() ) {71 args(4).is_real_scalar() ) { 72 72 73 73 libHandle = args(0).int_value (); 74 74 path = args(1).string_value (); 75 75 fileName = args(2).string_value (); 76 fileType= (unsigned int) args(3).int_value ();77 append = (unsigned int) args( 3).int_value ();76 compress = (unsigned int) args(3).int_value (); 77 append = (unsigned int) args(4).int_value (); 78 78 79 79 /* Call the C subroutine. */ … … 84 84 lib = getObject_Lib(libHandle); 85 85 if (lib) { 86 lib->putFile(path,fileName, fileType,append);86 lib->putFile(path,fileName,compress,append); 87 87 err = 0; 88 88 }
Note: See TracChangeset
for help on using the changeset viewer.