Changeset 6606 for pymolproxy
- Timestamp:
- Nov 11, 2016 12:43:23 AM (8 years ago)
- Location:
- pymolproxy/branches/1.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pymolproxy/branches/1.0
- Property svn:mergeinfo changed
/pymolproxy/trunk merged: 6598-6605
- Property svn:mergeinfo changed
-
pymolproxy/branches/1.0/Makefile.in
r4592 r6606 64 64 65 65 clean: 66 $(RM) a.out *.o *~ core* $(TARGETS) *.log *.tmp logfile*.deps/*.d66 $(RM) a.out *.o *~ core* $(TARGETS) .deps/*.d 67 67 68 68 distclean: clean -
pymolproxy/branches/1.0/pymolproxy.c
r6399 r6606 12 12 * image rendered offscreen is returned as ppm-formatted image data. 13 13 * 14 * Copyright (c) 2004-201 2HUBzero Foundation, LLC14 * Copyright (c) 2004-2016 HUBzero Foundation, LLC 15 15 * 16 16 * See the file "license.terms" for information on usage and 17 17 * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 18 18 * ====================================================================== 19 * 20 * Authors: 21 * Nicholas Kisseberth <nkissebe@purdue.edu> 22 * George A. Howlett <gah@purdue.edu> 23 * Leif Delgass <ldelgass@purdue.edu> 19 24 */ 20 25 … … 124 129 #endif /* LOGDIR */ 125 130 131 #ifndef STATSDIR 132 #define STATSDIR "/var/tmp/visservers" 133 #endif /*STATSDIR*/ 134 126 135 #define CVT2SECS(x) ((double)(x).tv_sec) + ((double)(x).tv_usec * 1.0e-6) 127 136 … … 191 200 int rockOffset; 192 201 int cacheId; 193 int error;194 202 int status; 195 203 int width, height; /* Size of viewport. */ … … 228 236 #if WANT_DEBUG 229 237 static void 230 PrintToLog TCL_VARARGS_DEF(const char *, arg1) 231 { 232 const char *format; 238 PrintToLog(const char *format, ...) 239 { 233 240 va_list args; 234 241 235 format = TCL_VARARGS_START(const char *, arg1, args);242 va_start(args, format); 236 243 fprintf(stderr, "pymolproxy: "); 237 244 vfprintf(stderr, format, args); 245 va_end(args); 238 246 fprintf(stderr, "\n"); 239 247 fflush(stderr); … … 261 269 length += vsnprintf(message + length, MSG_LEN - length, fmt, lst); 262 270 message[MSG_LEN] = '\0'; 271 va_end(lst); 272 263 273 if (debug) { 264 DEBUG("%s \n", message);274 DEBUG("%s", message); 265 275 } else { 266 276 syslog(priority, message, length); … … 269 279 270 280 static void 271 Record TCL_VARARGS_DEF(const char *, arg1) 272 { 273 const char *format; 281 Record(const char *format, ...) 282 { 274 283 va_list args; 275 284 276 format = TCL_VARARGS_START(const char *, arg1, args);285 va_start(args, format); 277 286 vfprintf(frecord, format, args); 287 va_end(args); 278 288 fflush(frecord); 279 289 } … … 288 298 size_t length; 289 299 290 if (proxyPtr->error) {291 return TCL_ERROR;292 }293 294 300 va_start(ap, format); 295 result = vsnprintf(buffer, BUFSIZ -1, format, ap);301 result = vsnprintf(buffer, BUFSIZ, format, ap); 296 302 va_end(ap); 297 298 #ifdef EXEC_DEBUG 299 DEBUG("to-pymol>(%s) code=%d", buffer, result); 303 if (result >= BUFSIZ) { 304 ERROR("Buffer too small for command (len=%d)", result); 305 proxyPtr->status = TCL_ERROR; 306 return proxyPtr->status; 307 } 308 309 #if EXEC_DEBUG 310 DEBUG("to-pymol>(%s) len=%d", buffer, result); 300 311 #endif 301 312 if (recording) { … … 309 320 ERROR("short write to pymol (wrote=%d, should have been %d): %s", 310 321 numWritten, length, strerror(errno)); 311 } 312 proxyPtr->status = result; 313 return proxyPtr->status; 314 } 315 316 317 318 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 319 /* 320 * Copyright (C) 2011, Purdue Research Foundation 321 * 322 * Author: George A. Howlett <gah@purdue.edu> 323 */ 322 proxyPtr->status = TCL_ERROR; 323 } 324 return proxyPtr->status; 325 } 324 326 325 327 static void … … 550 552 clear_error(PymolProxy *proxyPtr) 551 553 { 552 proxyPtr->error = 0;553 554 proxyPtr->status = TCL_OK; 554 555 } 555 556 #ifndef STATSDIR557 #define STATSDIR "/var/tmp/visservers"558 #endif /*STATSDIR*/559 556 560 557 static int … … 733 730 } 734 731 735 736 732 static int 737 733 CartoonCmd(ClientData clientData, Tcl_Interp *interp, int argc, … … 842 838 return p->status; 843 839 } 844 845 840 846 841 static int … … 1269 1264 } 1270 1265 1271 1272 1266 static int 1273 1267 PpmCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]) … … 1291 1285 return p->status; 1292 1286 } 1293 1294 1287 1295 1288 static int … … 1798 1791 } 1799 1792 1800 1801 1793 /* 1802 1794 * ZoomCmd -- … … 1848 1840 } 1849 1841 1850 1851 1852 1842 static int 1853 1843 ExecuteCommand(Tcl_Interp *interp, Tcl_DString *dsPtr) … … 1866 1856 if (result != TCL_OK) { 1867 1857 #if EXEC_DEBUG 1868 DEBUG("result was %s \n", Tcl_GetString(Tcl_GetObjResult(interp)));1858 DEBUG("result was %s", Tcl_GetString(Tcl_GetObjResult(interp))); 1869 1859 #endif 1870 1860 } … … 1998 1988 } 1999 1989 2000 2001 1990 static void 2002 1991 WriteImages(ImageList *listPtr, int fd) … … 2064 2053 #endif 2065 2054 } 2066 2067 2055 2068 2056 static void … … 2116 2104 2117 2105 #if DEBUG 2118 DEBUG("Entering InitProxy \n");2106 DEBUG("Entering InitProxy"); 2119 2107 #endif 2120 2108 /* Create two pipes for communication with the external application. One … … 2133 2121 child = fork(); 2134 2122 if (child < 0) { 2135 ERROR("can't fork process: %s \n", strerror(errno));2123 ERROR("can't fork process: %s", strerror(errno)); 2136 2124 return -3; 2137 2125 } … … 2167 2155 close(f); 2168 2156 } 2169 INFO(" attempting to start\"%s\"", argv[0]);2157 INFO("Executing \"%s\"", argv[0]); 2170 2158 execvp(argv[0], argv); 2171 2159 ERROR("can't exec `%s': %s", argv[0], strerror(errno)); … … 2178 2166 2179 2167 #if DEBUG 2180 DEBUG("Started %s DISPLAY=%s \n", argv[0], getenv("DISPLAY"));2168 DEBUG("Started %s DISPLAY=%s", argv[0], getenv("DISPLAY")); 2181 2169 #endif 2182 2170 /* close opposite end of pipe, these now belong to the child process */ … … 2205 2193 for (cp = cmdProcs; cp->name != NULL; cp++) { 2206 2194 #if DEBUG 2207 DEBUG("Adding command %s \n", cp->name);2195 DEBUG("Adding command %s", cp->name); 2208 2196 #endif 2209 2197 Tcl_CreateCommand(interp, cp->name, cp->proc, p, NULL); … … 2274 2262 return result; 2275 2263 } 2276 2277 2264 2278 2265 static void * … … 2299 2286 status = GetLine(&p->client, &numBytes, &line); 2300 2287 if (status != BUFFER_OK) { 2301 ERROR("can't read client stdout (numBytes=%d): %s \n", numBytes,2288 ERROR("can't read client stdout (numBytes=%d): %s", numBytes, 2302 2289 strerror(errno)); 2303 2290 goto done; … … 2383 2370 } 2384 2371 #if WRITE_DEBUG 2385 DEBUG("Writer: line found is %s\n", line);2372 DEBUG("Writer: line found is \"%.*s\"", (int)len, line); 2386 2373 #endif 2387 2374 if (strncmp(line, "image follows: ", 15) != 0) { … … 2390 2377 if (sscanf(line, "image follows: %d %s %d %d\n", &numBytes, cacheId, 2391 2378 &frameNum, &rockOffset) != 4) { 2392 ERROR("can't get # bytes from \"% s\"", line);2379 ERROR("can't get # bytes from \"%.*s\"", (int)len, line); 2393 2380 DEBUG("Leaving Writer thread"); 2394 2381 return NULL; 2395 2382 } 2396 2383 #if WRITE_DEBUG 2397 DEBUG("found image line \"%.*s\"", numBytes, line);2384 DEBUG("found image line (%d bytes)", numBytes); 2398 2385 #endif 2399 2386 sprintf(header, "nv>image %d %s %d %d\n", numBytes, cacheId, … … 2401 2388 hdrLength = strlen(header); 2402 2389 #if WRITE_DEBUG 2403 DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d \n", numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength);2390 DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d", numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength); 2404 2391 #endif 2405 2392 imgPtr = NewImage(&list, numBytes + hdrLength); … … 2457 2444 ERROR("Short write on version string", strerror(errno)); 2458 2445 } 2459 INFO("Starting pymolproxy (threaded version)");2446 DEBUG("Starting pymolproxy"); 2460 2447 2461 2448 InitProxy(&proxy, argv + 1);
Note: See TracChangeset
for help on using the changeset viewer.