Changeset 2688 for trunk/packages
- Timestamp:
- Nov 16, 2011, 12:56:37 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/pymolproxy/pymolproxy2.c
r2637 r2688 94 94 static FILE *frecord; 95 95 static int recording = FALSE; 96 static int pymolIsAlive = TRUE; 96 97 97 98 #define WANT_DEBUG 0 … … 723 724 { 724 725 PymolProxy *p = clientData; 725 int i, push, defer, state, size;726 int i, push, defer, bool, size; 726 727 const char *model; 727 728 … … 729 730 model = "all"; 730 731 size = 14; 731 state= TRUE;732 bool = TRUE; 732 733 push = defer = FALSE; 733 734 for(i = 1; i < argc; i++) { … … 744 745 size = atoi(argv[i]); 745 746 } 746 } else if (Tcl_GetBoolean(interp, argv[i], & state) != TCL_OK) {747 } else if (Tcl_GetBoolean(interp, argv[i], &bool) != TCL_OK) { 747 748 return TCL_ERROR; 748 749 } … … 757 758 SendCmd(p, "set label_color,white,%s\nset label_size,%d,%s\n", 758 759 model, size, model); 759 if ( state) {760 if (bool) { 760 761 SendCmd(p, "label %s,\"%%s%%s\" %% (ID,name)\n", model); 761 762 } else { … … 843 844 p->flags |= FORCE_UPDATE; 844 845 } 846 p->cacheId = state; 845 847 846 848 /* Does not invalidate cache? */ … … 984 986 /* Force pymol to update the current scene. */ 985 987 SendCmd(p, "refresh\n"); 986 #ifdef notdef 987 SendCmd(p, "png \"- %d %d %d\"\n", p->frame, p->cacheId, p->rockOffset); 988 #endif 989 SendCmd(p, "png -\n"); 988 /* This is a hack. We're encoding the filename to pass extra information 989 * to the MyPNGWrite routine inside of pymol. Ideally these would be 990 * parameters of a new "molvispng" command that would be passed all the 991 * way through to MyPNGWrite. 992 * 993 * The extra information is contained in the token we get from the 994 * molvisviewer client, the frame number, and rock offset. */ 995 SendCmd(p, "png -:%d:%d:%d\n", p->cacheId, p->frame, p->rockOffset); 990 996 return p->status; 991 997 } … … 1001 1007 /* Force pymol to update the current scene. */ 1002 1008 SendCmd(p, "refresh\n"); 1003 #ifdef notdef 1004 SendCmd(p, "png \"- %d %d %d\",format=1\n", p->frame, p->cacheId, 1009 /* This is a hack. We're encoding the filename to pass extra information 1010 * to the MyPNGWrite routine inside of pymol. Ideally these would be 1011 * parameters of a new "molvispng" command that would be passed all the 1012 * way through to MyPNGWrite. 1013 * 1014 * The extra information is contained in the token we get from the 1015 * molvisviewer client, the frame number, and rock offset. */ 1016 SendCmd(p, "png -:%d:%d:%d,format=1\n", p->cacheId, p->frame, 1005 1017 p->rockOffset); 1006 #endif1007 SendCmd(p, "png -,format=1\n");1008 1018 p->flags &= ~(UPDATE_PENDING|FORCE_UPDATE); 1009 1019 return p->status; … … 1042 1052 SendCmd(p, "bg_color %s\nrefresh\n", bgcolor); 1043 1053 } 1044 SendCmd(p, "ray %d,%d\n", width, height); 1045 #ifdef notdef 1046 SendCmd(p, "png \"- print 0 0\",dpi=300\nbg_color black\n"); 1047 #endif 1048 SendCmd(p, "png -,dpi=300\nbg_color black\n"); 1054 /* This is a hack. We're encoding the filename to pass extra information 1055 * to the MyPNGWrite routine inside of pymol. Ideally these would be 1056 * parameters of a new "molvispng" command that would be passed all the 1057 * way through to MyPNGWrite. 1058 * 1059 * The extra information is contained in the token we get from the 1060 * molvisviewer client, the frame number, and rock offset. 1061 */ 1062 SendCmd(p, "png -:%s:0:0,width=%d,height=%d,ray=1,dpi=300\n", 1063 token, width, height); 1064 SendCmd(p, "bg_color black\n"); 1049 1065 return p->status; 1050 1066 } … … 1891 1907 { 1892 1908 ERROR("pymol (%d) died unexpectedly", stats.pid); 1909 pymolIsAlive = FALSE; 1893 1910 /*DoExit(1);*/ 1894 1911 } … … 1987 2004 exit(-1); 1988 2005 } else { 2006 pymolIsAlive = TRUE; 1989 2007 signal(SIGCHLD, ChildHandler); 1990 2008 } … … 2104 2122 #endif 2105 2123 Tcl_DStringInit(&command); 2106 for (;;) {2124 while (pymolIsAlive) { 2107 2125 tvPtr = NULL; 2108 2126 #if READ_DEBUG 2109 2127 DEBUG("Start I/O set"); 2110 2128 #endif 2111 while ( WaitForNextLine(&p->client, tvPtr)) {2129 while ((pymolIsAlive) && (WaitForNextLine(&p->client, tvPtr))) { 2112 2130 size_t numBytes; 2113 2131 const char *line; … … 2182 2200 #endif 2183 2201 list.headPtr = list.tailPtr = NULL; 2184 for (;;) {2202 while (pymolIsAlive) { 2185 2203 while (WaitForNextLine(bp, NULL)) { 2186 2204 Image *imgPtr; … … 2200 2218 return NULL; 2201 2219 } 2202 if (strncmp(line, "ppm image follows: ", 16) != 0) { 2220 #if WRITE_DEBUG 2221 DEBUG("Writer: line found is %s\n", line); 2222 #endif 2223 if (strncmp(line, "image follows: ", 15) != 0) { 2203 2224 continue; 2204 2225 } 2205 #ifdef notdef2206 2226 if (sscanf(line, "image follows: %d %s %d %d\n", &numBytes, cacheId, 2207 2227 &frameNum, &rockOffset) != 4) { … … 2210 2230 return NULL; 2211 2231 } 2212 #endif2213 if (sscanf(line, "ppm image follows: %d\n", &numBytes) != 1) {2214 ERROR("can't get # bytes from \"%s\"", line);2215 DEBUG("Leaving Writer thread");2216 return NULL;2217 }2218 2232 #if WRITE_DEBUG 2219 2233 DEBUG("found image line \"%.*s\"", numBytes, line); 2220 2234 #endif 2221 strcpy(cacheId, "0"); 2222 frameNum = 0; 2223 rockOffset = 0; 2224 sprintf(header, "nv>image %d %s %d %d\n", numBytes, cacheId, frameNum, 2225 rockOffset); 2235 sprintf(header, "nv>image %d %s %d %d\n", numBytes, cacheId, 2236 frameNum, rockOffset); 2226 2237 hdrLength = strlen(header); 2227 2238 #if WRITE_DEBUG 2228 DEBUG("Queueing image numBytes=%d frameNum=%d, rockOffset=%d size=%d\n", numBytes, frameNum, rockOffset, numBytes + hdrLength);2239 DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d\n", numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength); 2229 2240 #endif 2230 2241 imgPtr = NewImage(&list, numBytes + hdrLength);
Note: See TracChangeset
for help on using the changeset viewer.