Changeset 597


Ignore:
Timestamp:
Mar 1, 2007 11:24:02 AM (17 years ago)
Author:
dkearney
Message:

adjusted core makefile to not remove setup.py when doing a make clean
adjusted putFile and putData commands and flags in matlab, octave,fortran,perl
changed the RPLIB_[TEXT,BINARY] flags to RPLIB_COMPRESS and RPLIB_NO_COMPRESS flags
adjusted the c-example for compress to incorporate newly named flags.
adjusted rappture library header to find rappture buffer header files in rappture2 directory.

Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r577 r597  
    139139        cd gui; make clean; cd -;
    140140        cd perl; make clean; cd -;
    141         cd python; rm -rf build; rm setup.py; cd -;
     141        cd python; rm -rf build; cd -;
    142142        cd src; make clean; cd -;
    143143        cd src/matlab; make clean; cd -;
  • trunk/examples/c-example/compress.c

    r594 r597  
    3737        "Example loading of a DX file",RPLIB_OVERWRITE);
    3838    rpPutFile(lib,"output.field(dxFile1).component.dx",
    39         dxFilePath,RPLIB_BINARY,RPLIB_OVERWRITE);
     39        dxFilePath,RPLIB_COMPRESS,RPLIB_OVERWRITE);
    4040
    4141    // write output to run file and signal
  • trunk/examples/c-example/compress.cc

    r594 r597  
    3838        "Example loading of a DX file","",RPLIB_OVERWRITE);
    3939    lib->putFile("output.field(dxFile1).component.dx",
    40         dxFilePath,RPLIB_BINARY,RPLIB_OVERWRITE);
     40        dxFilePath,RPLIB_COMPRESS,RPLIB_OVERWRITE);
    4141
    4242
  • trunk/perl/lib/Rappture.pm

    r484 r597  
    9393=head1 COPYRIGHT AND LICENSE
    9494
    95 Copyright (c) 2006, Purdue Research Foundation
     95Copyright (c) 2006-2007, Purdue Research Foundation
    9696All rights reserved.
    9797
  • trunk/src/core/RpLibrary.cc

    r591 r597  
    15801580RpLibrary::putFile (std::string path,
    15811581                    std::string fileName,
    1582                     unsigned int fileType,
     1582                    unsigned int compress,
    15831583                    unsigned int append  )
    15841584{
     
    15881588    Rappture::Buffer fileBuf;
    15891589    unsigned int bytesWritten = 0;
     1590    std::string value = "";
     1591    std::string transContents = "";
    15901592
    15911593    if (!this->root) {
     
    16011603            if ( (contents = scew_element_contents(retNode)) ) {
    16021604                buf.append(contents);
    1603                 if (fileType == RPLIB_BINARY) {
     1605                if (compress == RPLIB_COMPRESS) {
    16041606                    // base64 decode and un-gzip the data
    16051607                    buf.decode();
     
    16101612        fileBuf.load(fileName.c_str());
    16111613        buf += fileBuf;
    1612 
    1613         if (fileType == RPLIB_BINARY) {
     1614        fileBuf.clear();
     1615
     1616        if (compress == RPLIB_COMPRESS) {
    16141617            // gzip and base64 encode the data
    16151618            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());
    16161625        }
    16171626
  • trunk/src/core/RpLibrary.h

    r591 r597  
    2020    RPLIB_NO_TRANSLATE  = 0,
    2121    RPLIB_TRANSLATE     = 1,
    22     RPLIB_TEXT          = 0,
    23     RPLIB_BINARY        = 1,
     22    RPLIB_NO_COMPRESS   = 0,
     23    RPLIB_COMPRESS      = 1,
    2424};
    2525
     
    3939#include <cctype>
    4040#include <list>
    41 #include "RpBuffer.h"
     41#include "rappture2/RpBuffer.h"
    4242
    4343/* indentation size (in whitespaces) */
     
    134134        RpLibrary& putFile( std::string path,
    135135                            std::string fileName,
    136                             unsigned int fileType = RPLIB_BINARY,
     136                            unsigned int compress = RPLIB_COMPRESS,
    137137                            unsigned int append = RPLIB_OVERWRITE    );
    138138
  • trunk/src/fortran/RpLibraryFInterface.cc

    r591 r597  
    688688    std::string inPath = "";
    689689    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);
    698706        }
    699707    }
     
    712720                        char* path,
    713721                        char* fileName,
    714                         int* fileType,
     722                        int* compress,
    715723                        int* append,
    716724                        int path_len,
     
    729737
    730738        if (lib) {
    731             lib->putFile(inPath,inFileName,*fileType,*append);
     739            lib->putFile(inPath,inFileName,*compress,*append);
    732740        }
    733741    }
  • trunk/src/fortran/RpLibraryFInterface.h

    r591 r597  
    106106                            char* path,
    107107                            char* fileName,
    108                             int* fileType,
     108                            int* compress,
    109109                            int* append,
    110110                            int path_len,
  • trunk/src/fortran/RpLibraryFStubs.c

    r591 r597  
    461461                        char* path,
    462462                        char* fileName,
    463                         int* fileType,
     463                        int* compress,
    464464                        int* append,
    465465                        int path_len,
    466466                        int fileName_len ) {
    467467
    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);
    469469    return;
    470470}
     
    474474                        char* path,
    475475                        char* fileName,
    476                         int* fileType,
     476                        int* compress,
    477477                        int* append,
    478478                        int path_len,
    479479                        int fileName_len ) {
    480480
    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);
    482482    return;
    483483}
     
    487487                        char* path,
    488488                        char* fileName,
    489                         int* fileType,
     489                        int* compress,
    490490                        int* append,
    491491                        int path_len,
    492492                        int fileName_len ) {
    493493
    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);
    495495    return;
    496496}
  • trunk/src/fortran/RpLibraryFStubs.h

    r591 r597  
    109109                            char* path,
    110110                            char* fileName,
    111                             int* fileType,
     111                            int* compress,
    112112                            int* append,
    113113                            int path_len,
     
    250250                            char* path,
    251251                            char* fileName,
    252                             int* fileType,
     252                            int* compress,
    253253                            int* append,
    254254                            int path_len,
     
    392392                            char* path,
    393393                            char* fileName,
    394                             int* fileType,
     394                            int* compress,
    395395                            int* append,
    396396                            int path_len,
  • trunk/src/matlab/Makefile.in

    r591 r597  
    5959                        rpLibPutString.mexglx \
    6060                        rpLibPutDouble.mexglx \
     61                        rpLibPutData.mexglx \
    6162                        rpLibPutFile.mexglx \
    6263                        rpLibNodeComp.mexglx \
     
    119120rpLibPutDouble.mexglx:
    120121        $(MEX) rpLibPutDouble.cc          $(MATLAB_COMP_ARGS)
     122rpLibPutData.mexglx:
     123        $(MEX) rpLibPutData.cc            $(MATLAB_COMP_ARGS)
    121124rpLibPutFile.mexglx:
    122125        $(MEX) rpLibPutFile.cc            $(MATLAB_COMP_ARGS)
  • trunk/src/matlab/rpLibPutFile.cc

    r591 r597  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [err] = rpLibPutFile(libHandle,path,fileName,fileType,append)
     5 *    [err] = rpLibPutFile(libHandle,path,fileName,compress,append)
    66 *
    77 * ======================================================================
     
    1717
    1818/**********************************************************************/
    19 // METHOD: [err] = rpLibPutFile (libHandle,path,fileName,fileType,append)
     19// METHOD: [err] = rpLibPutFile (libHandle,path,fileName,compress,append)
    2020/// Set the value of a node.
    2121/**
     
    2727 *
    2828 * 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, text
    30  * (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).
    3131 * Append is an integer telling if this new data should overwrite
    3232 * (use 0) or be appended (use 1) to previous data in this node.
     
    3939    int          libIndex = 0;
    4040    unsigned int append = 0;
    41     unsigned int fileType = 0;
     41    unsigned int compress = 0;
    4242    int          err = 1;
    4343    RpLibrary*   lib = NULL;
     
    4646
    4747    /* Check for proper number of arguments. */
    48     if (nrhs != 4) {
    49         mexErrMsgTxt("Two input required.");
     48    if (nrhs != 5) {
     49        mexErrMsgTxt("Five inputs required.");
    5050    }
    5151
     
    5353    path     = getStringInput(prhs[1]);
    5454    fileName = getStringInput(prhs[2]);
    55     fileType = (unsigned int) getIntInput(prhs[3]);
     55    compress = (unsigned int) getIntInput(prhs[3]);
    5656    append   = (unsigned int) getIntInput(prhs[4]);
    5757
     
    6161
    6262        if (lib) {
    63             lib->putFile(path,fileName,fileType,append);
     63            lib->putFile(path,fileName,compress,append);
    6464            err = 0;
    6565        }
  • trunk/src/octave/rpLibPutFile.cc

    r591 r597  
    33 *  INTERFACE: Octave Rappture Library Source
    44 *
    5  *    [err] = rpLibPutFile(libHandle,path,fileName,fileType,append)
     5 *    [err] = rpLibPutFile(libHandle,path,fileName,compress,append)
    66 *
    77 * ======================================================================
     
    2525 *
    2626 * 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, text
    28  * (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).
    2929 * Append is an integer telling if this new data should overwrite
    3030 * (use 0) or be appended (use 1) to previous data in this node.
     
    3434DEFUN_DLD (rpLibPutString, args, ,
    3535"-*- 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\
    3737\n\
    3838Clients use this to set the value of a node.  If the @var{path}\n\
    3939is not specified (ie. empty string ""), it sets the value for the\n\
    4040root 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\
     41by the path.  The added data is treated as the text within the \n\
    4242tag at the tail of the @var{path}.\n\
    4343\n\
    4444@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\
    4747@var{append} is an integer telling if this new data should overwrite\n\
    4848(use 0) or be appended (use 1) to previous data in this node.\n\
     
    5050Error Codes: err = 0 is success, anything else is failure.")
    5151{
    52     static std::string who = "rpLibPutString";
     52    static std::string who = "rpLibPutFile";
    5353
    5454    // The list of values to return.
     
    5959    std::string path      = "";
    6060    std::string fileName  = "";
    61     unsigned int fileType = 0;
     61    unsigned int compress = 0;
    6262    unsigned int append   = 0;
    6363    RpLibrary* lib        = NULL;
    6464
    65     if (nargin == 4) {
     65    if (nargin == 5) {
    6666
    6767        if ( args(0).is_real_scalar() &&
     
    6969             args(2).is_string()      &&
    7070             args(3).is_real_scalar() &&
    71              args(3).is_real_scalar()   ) {
     71             args(4).is_real_scalar()   ) {
    7272
    7373            libHandle = args(0).int_value ();
    7474            path      = args(1).string_value ();
    7575            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 ();
    7878
    7979            /* Call the C subroutine. */
     
    8484                lib = getObject_Lib(libHandle);
    8585                if (lib) {
    86                     lib->putFile(path,fileName,fileType,append);
     86                    lib->putFile(path,fileName,compress,append);
    8787                    err = 0;
    8888                }
Note: See TracChangeset for help on using the changeset viewer.