Ignore:
Timestamp:
Apr 2, 2013, 1:38:59 PM (12 years ago)
Author:
ldelgass
Message:

Remove old, now unused functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/nanovisServer.cpp

    r3605 r3606  
    367367    exit(code);
    368368}
    369 
    370 #if 0
    371 static int
    372 executeCommand(Tcl_Interp *interp, Tcl_DString *dsPtr)
    373 {
    374     struct timeval tv;
    375     double start, finish;
    376     int result;
    377 
    378 #ifdef WANT_TRACE
    379     char *str = Tcl_DStringValue(dsPtr);
    380     std::string cmd(str);
    381     cmd.erase(cmd.find_last_not_of(" \n\r\t")+1);
    382     TRACE("command %lu: '%s'", g_stats.nCommands+1, cmd.c_str());
    383 #endif
    384 
    385     gettimeofday(&tv, NULL);
    386     start = CVT2SECS(tv);
    387 
    388     result = Tcl_Eval(interp, Tcl_DStringValue(dsPtr));
    389     Tcl_DStringSetLength(dsPtr, 0);
    390 
    391     gettimeofday(&tv, NULL);
    392     finish = CVT2SECS(tv);
    393 
    394     g_stats.cmdTime += finish - start;
    395     g_stats.nCommands++;
    396     TRACE("Leave status=%d", result);
    397     return result;
    398 }
    399 
    400 static void
    401 processCommands()
    402 {
    403     flags &= ~REDRAW_PENDING;
    404 
    405     TRACE("Enter");
    406 
    407     int flags = fcntl(0, F_GETFL, 0);
    408     fcntl(0, F_SETFL, flags & ~O_NONBLOCK);
    409 
    410     int status = TCL_OK;
    411 
    412     //  Read and execute as many commands as we can from stdin...
    413     Tcl_DString cmdbuffer;
    414     Tcl_DStringInit(&cmdbuffer);
    415     int nCommands = 0;
    416     bool isComplete = false;
    417     while ((!feof(g_fIn)) && (status == TCL_OK)) {
    418         //
    419         //  Read the next command from the buffer.  First time through we
    420         //  block here and wait if necessary until a command comes in.
    421         //
    422         //  BE CAREFUL: Read only one command, up to a newline.  The "volume
    423         //  data follows" command needs to be able to read the data
    424         //  immediately following the command, and we shouldn't consume it
    425         //  here.
    426         //
    427         while (!feof(g_fIn)) {
    428             int c = fgetc(g_fIn);
    429             char ch;
    430             if (c <= 0) {
    431                 if (errno == EWOULDBLOCK) {
    432                     break;
    433                 }
    434                 exitService(100);
    435             }
    436             ch = (char)c;
    437             Tcl_DStringAppend(&cmdbuffer, &ch, 1);
    438             if (ch == '\n') {
    439                 isComplete = Tcl_CommandComplete(Tcl_DStringValue(&cmdbuffer));
    440                 if (isComplete) {
    441                     break;
    442                 }
    443             }
    444         }
    445         // no command? then we're done for now
    446         if (Tcl_DStringLength(&cmdbuffer) == 0) {
    447             break;
    448         }
    449         if (isComplete) {
    450             // back to original flags during command evaluation...
    451             fcntl(0, F_SETFL, flags & ~O_NONBLOCK);
    452             status = executeCommand(interp, &cmdbuffer);
    453             // non-blocking for next read -- we might not get anything
    454             fcntl(0, F_SETFL, flags | O_NONBLOCK);
    455             isComplete = false;
    456             nCommands++;
    457             CHECK_FRAMEBUFFER_STATUS();
    458         }
    459     }
    460     fcntl(0, F_SETFL, flags);
    461 
    462     if (status != TCL_OK) {
    463         char *msg;
    464         char hdr[200];
    465         int msgSize, hdrSize;
    466         Tcl_Obj *objPtr;
    467 
    468         objPtr = Tcl_GetObjResult(interp);
    469         msg = Tcl_GetStringFromObj(objPtr, &msgSize);
    470         hdrSize = sprintf(hdr, "nv>viserror -type internal_error -bytes %d\n", msgSize);
    471         {
    472             struct iovec iov[2];
    473 
    474             iov[0].iov_base = hdr;
    475             iov[0].iov_len = hdrSize;
    476             iov[1].iov_base = msg;
    477             iov[1].iov_len = msgSize;
    478             if (writev(1, iov, 2) < 0) {
    479                 ERROR("write failed: %s", strerror(errno));
    480             }
    481         }
    482         TRACE("Leaving on ERROR");
    483         return;
    484     }
    485     if (feof(g_fIn)) {
    486         TRACE("Exiting server on EOF from client");
    487         exitService(90);
    488     }
    489 
    490     update();
    491 
    492     bindOffscreenBuffer();  //enable offscreen render
    493     render();
    494     readScreen();
    495 
    496     if (feof(g_fIn)) {
    497         exitService(90);
    498     }
    499 
    500     ppmWrite("nv>image -type image -bytes");
    501 
    502     TRACE("Leave");
    503 }
    504 #endif
    505369
    506370static void
Note: See TracChangeset for help on using the changeset viewer.