Changeset 3361


Ignore:
Timestamp:
Feb 26, 2013 1:42:53 AM (11 years ago)
Author:
ldelgass
Message:

Sync with trunk

Location:
branches/nanovis2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/nanovis2

    • Property svn:mergeinfo changed
      /trunkmerged: 3360
  • branches/nanovis2/packages/vizservers/vtkvis/RpVtkDataSet.cpp

    r3334 r3361  
    356356
    357357    _dataSet = reader->GetOutput();
     358    if (_dataSet == NULL)
     359        return false;
    358360#ifndef USE_VTK6
    359361    _dataSet->SetPipelineInformation(NULL);
     
    362364        _dataSet->GetPointData()->GetScalars() != NULL &&
    363365        _dataSet->GetPointData()->GetScalars()->GetLookupTable() != NULL) {
    364         ERROR("No lookup table should be specified in DataSets");
     366        USER_ERROR("No lookup table should be specified in VTK data sets");
    365367    }
    366368
     
    389391        _dataSet->GetPointData()->GetScalars() != NULL &&
    390392        _dataSet->GetPointData()->GetScalars()->GetLookupTable() != NULL) {
    391         ERROR("No lookup table should be specified in DataSets");
     393        USER_ERROR("No lookup table should be specified in VTK data sets");
    392394    }
    393395
  • branches/nanovis2/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r3334 r3361  
    8282    int result;
    8383
    84     TRACE("command: '%s'", Tcl_DStringValue(dsPtr));
     84    TRACE("command %lu: '%s'", g_stats.nCommands+1, Tcl_DStringValue(dsPtr));
    8585    lastCmdStatus = TCL_OK;
    8686    result = Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr),
     
    40704070    }
    40714071    g_renderer->addDataSet(name);
    4072     g_renderer->setData(name, data, nbytes);
     4072    if (!g_renderer->setData(name, data, nbytes)) {
     4073        USER_ERROR("Failed to load data for dataset \"%s\"", name);
     4074        free(data);
     4075        return TCL_ERROR;
     4076    }
    40734077    g_stats.nDataSets++;
    40744078    g_stats.nDataBytes += nbytes;
     
    96979701                                         * and allow a new image to be
    96989702                                         * rendered. */
    9699             } else if (status != TCL_OK) {
     9703            } else { //if (status != TCL_OK) {
    97009704                ret = 0;
    97019705                if (handleError(interp, clientData, status, fdOut) < 0) {
     
    97259729    int nBytes;
    97269730
    9727     string = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
    9728     TRACE("status=%d errorInfo=(%s)", status, string);
     9731    TRACE("Enter");
     9732
     9733    if (status != TCL_OK) {
     9734        string = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
     9735        nBytes = strlen(string);
     9736        if (nBytes > 0) {
     9737            TRACE("status=%d errorInfo=(%s)", status, string);
     9738
     9739            std::ostringstream oss;
     9740#ifdef OLD_ERRORS
     9741            oss << "VtkVis Server Error: " << string << "\n";
     9742            nBytes += 22;
     9743#else
     9744            oss << "nv>viserror -type internal_error -token " << g_stats.nCommands << " -bytes " << nBytes << "\n" << string;
     9745            nBytes = oss.str().length();
     9746#endif
     9747
     9748#ifdef USE_THREADS
     9749            QueueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
     9750#else
     9751            if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
     9752                ERROR("write failed: %s", strerror(errno));
     9753                return -1;
     9754            }
     9755#endif
     9756        }
     9757    }
     9758
     9759    TRACE("Before user error");
     9760
     9761    string = getUserMessages();
    97299762    nBytes = strlen(string);
    9730 
    9731     std::ostringstream oss;
     9763    if (nBytes > 0) {
     9764        TRACE("userError=(%s)", string);
     9765
     9766        std::ostringstream oss;
    97329767#ifdef OLD_ERRORS
    9733     oss << "VtkVis Server Error: " << string << "\n";
    9734     nBytes += 22;
     9768        oss << "VtkVis Server Error: " << string << "\n";
     9769        nBytes += 22;
    97359770#else
    9736     oss << "nv>viserror -type error -bytes " << nBytes << "\n" << string;
    9737     nBytes = oss.str().length();
     9771        oss << "nv>viserror -type error -token " << g_stats.nCommands << " -bytes " << nBytes << "\n" << string;
     9772        nBytes = oss.str().length();
    97389773#endif
    97399774
    97409775#ifdef USE_THREADS
    9741     QueueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
     9776        QueueResponse(clientData, oss.str().c_str(), nBytes, Response::VOLATILE, Response::ERROR);
    97429777#else
    9743     if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
    9744         ERROR("write failed: %s", strerror(errno));
    9745         return -1;
    9746     }
     9778        if (write(fdOut, oss.str().c_str(), nBytes) < 0) {
     9779            ERROR("write failed: %s", strerror(errno));
     9780            return -1;
     9781        }
    97479782#endif
     9783        clearUserMessages();
     9784    }
     9785
     9786    TRACE("Leave");
    97489787
    97499788    return 0;
  • branches/nanovis2/packages/vizservers/vtkvis/RpVtkRendererCmd.h

    r3334 r3361  
    1111#include <cstdio>
    1212#include <tcl.h>
     13
    1314#include "ReadBuffer.h"
    1415
  • branches/nanovis2/packages/vizservers/vtkvis/Trace.cpp

    r3334 r3361  
    1111#include <syslog.h>
    1212
     13#include <string>
     14#include <sstream>
     15
    1316#include "Trace.h"
    1417
    1518using namespace Rappture::VtkVis;
     19
     20static std::ostringstream g_UserErrorString;
    1621
    1722#define MSG_LEN 2047
     
    6469    syslog(priority, "%s", message);
    6570}
     71
     72/**
     73 * \brief Write a user message to buffer
     74 */
     75void
     76Rappture::VtkVis::logUserMessage(const char* fmt, ...)
     77{
     78    char message[MSG_LEN + 1];
     79    int length = 0;
     80    va_list lst;
     81
     82    va_start(lst, fmt);
     83
     84    length += vsnprintf(message, MSG_LEN, fmt, lst);
     85    message[MSG_LEN] = '\0';
     86
     87    g_UserErrorString << message << "\n";
     88}
     89
     90const char *
     91Rappture::VtkVis::getUserMessages()
     92{
     93    return g_UserErrorString.str().c_str();
     94}
     95
     96void
     97Rappture::VtkVis::clearUserMessages()
     98{
     99    g_UserErrorString.str(std::string());
     100}
  • branches/nanovis2/packages/vizservers/vtkvis/Trace.h

    r3305 r3361  
    1313namespace Rappture {
    1414namespace VtkVis {
     15
     16extern void logUserMessage(const char* format, ...);
     17
     18extern const char *getUserMessages();
     19
     20extern void clearUserMessages();
    1521
    1622extern void initLog();
     
    3036#define INFO(...)       Rappture::VtkVis::logMessage(LOG_INFO, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
    3137
     38#define USER_ERROR(...) Rappture::VtkVis::logUserMessage(__VA_ARGS__)
     39
    3240}
    3341}
Note: See TracChangeset for help on using the changeset viewer.