Changeset 1533


Ignore:
Timestamp:
Jun 26, 2009 1:17:25 PM (15 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/pymolproxy/pymolproxy.c

    r1428 r1533  
    102102
    103103static FILE *flog;
    104 static int debug = 0;
     104static int debug = 1;
    105105#ifdef notdef
    106106static long _flags = 0;
     
    263263    for (;;) {
    264264        /* Look for the next newline (the next full line). */
     265#ifdef notdef
    265266        trace("in GetLine: mark=%d fill=%d\n", readPtr->mark, readPtr->fill);
     267#endif
    266268        for (i = readPtr->mark; i < readPtr->fill; i++) {
    267269            if (readPtr->bytes[i] == '\n') {
     
    355357        return proxyPtr->status;
    356358    }
     359#ifdef notdef
    357360    trace("Entering Expect(want=%s, maxSize=%d)\n", match, maxSize);
     361#endif
    358362    c = match[0];
    359363    length = strlen(match);
     
    364368        line = GetLine(&proxyPtr->server, &nBytes);
    365369        if (line != NULL) {
     370#ifdef notdef
    366371            trace("pymol says:%.*s", nBytes, out);
     372#endif
    367373            if ((c == line[0]) && (strncmp(line, match, length) == 0)) {
    368374                if (maxSize < nBytes) {
     
    371377                memcpy(out, line, nBytes);
    372378                clear_error(proxyPtr);
     379#ifdef notdef
    373380                trace("Leaving Expect: got (%.*s)\n", nBytes, out);
     381#endif
    374382                return BUFFER_OK;
    375383            }
     
    518526    start = CVT2SECS(tv);
    519527
     528    trace("command from client is (%s)", cmd);
    520529    result = Tcl_Eval(interp, cmd);
    521     trace("Executed (%s)", cmd);
    522530
    523531    gettimeofday(&tv, NULL);
     
    566574    }
    567575       
     576#ifdef notdef
    568577    trace("WriteImage: want to write %d bytes.", imgPtr->bytesLeft);
     578#endif
    569579    for (bytesLeft = imgPtr->bytesLeft; bytesLeft > 0; /*empty*/) {
    570580        ssize_t nWritten;
    571 
     581#ifdef notdef
    572582        trace("WriteImage: try to write %d bytes.", bytesLeft);
     583#endif
    573584        nWritten = write(fd, imgPtr->data + imgPtr->nWritten, bytesLeft);
     585#ifdef notdef
    574586        trace("WriteImage: wrote %d bytes.", nWritten);
     587#endif
    575588        if (nWritten < 0) {
    576589            trace("Error writing fd(%d), %d/%s.", fd, errno,
     
    635648
    636649static int
    637 Pymol(PymolProxy *proxyPtr, char *format, ...)
     650Pymol(PymolProxy *proxyPtr, const char *format, ...)
    638651{
    639652    va_list ap;
     
    703716{
    704717    if (proxyPtr->flags & PAN_PENDING) {
    705         Pymol(proxyPtr,"move x,%f; move y,%f\n", proxyPtr->xPan,proxyPtr->yPan);
     718        Pymol(proxyPtr,"move x,%f\nmove y,%f\n", proxyPtr->xPan,proxyPtr->yPan);
    706719        proxyPtr->flags &= ~PAN_PENDING;
    707720    }
     
    714727        /* Every pymol command line generates a new rendering. Execute all
    715728         * three turns as a single command line. */
    716         Pymol(proxyPtr,"turn x,%f; turn y,%f; turn z,%f\n",
     729        Pymol(proxyPtr,"turn x,%f\nturn y,%f\nturn z,%f\n",
    717730              proxyPtr->xAngle, proxyPtr->yAngle, proxyPtr->zAngle);
    718731        proxyPtr->xAngle = proxyPtr->yAngle = proxyPtr->zAngle = 0.0f;
     
    743756           const char *argv[])
    744757{
    745     int defer = 0, push = 0, arg;
     758    int defer = 0, push = 0, i;
    746759    double scale;
    747760    const char *model = "all";
     
    750763    clear_error(proxyPtr);
    751764    scale = 0.25f;
    752     for(arg = 1; arg < argc; arg++) {
    753         if ( strcmp(argv[arg],"-defer") == 0 ) {
     765    for(i = 1; i < argc; i++) {
     766        if ( strcmp(argv[i],"-defer") == 0 ) {
    754767            defer = 1;
    755         } else if (strcmp(argv[arg],"-push") == 0) {
     768        } else if (strcmp(argv[i],"-push") == 0) {
    756769            push = 1;
    757         } else if (strcmp(argv[arg],"-model") == 0) {
    758             if (++arg < argc)
    759                 model = argv[arg];
     770        } else if (strcmp(argv[i],"-model") == 0) {
     771            if (++i < argc) {
     772                model = argv[i];
     773            }
    760774        } else {
    761             if (Tcl_GetDouble(interp, argv[arg], &scale) != TCL_OK) {
     775            if (Tcl_GetDouble(interp, argv[i], &scale) != TCL_OK) {
    762776                return TCL_ERROR;
    763777            }
     
    785799              const char *argv[])
    786800{
    787     float radius, transparency;
    788     int ghost = 0, defer = 0, push = 0, arg;
    789     const char *model = "all";
    790     PymolProxy *proxyPtr = clientData;
    791 
    792     clear_error(proxyPtr);
    793 
    794     for(arg = 1; arg < argc; arg++) {
    795         if ( strcmp(argv[arg],"-defer") == 0 )
    796             defer = 1;
    797         else if (strcmp(argv[arg],"-push") == 0)
    798             push = 1;
    799         else if (strcmp(argv[arg],"-ghost") == 0)
    800             ghost = 1;
    801         else if (strcmp(argv[arg],"-normal") == 0)
    802             ghost = 0;
    803         else if (strcmp(argv[arg],"-model") == 0) {
    804             if (++arg < argc)
    805                 model = argv[arg];
    806         }
    807         else
    808             model = argv[arg];
    809     }
    810 
     801    PymolProxy *proxyPtr = clientData;
     802    const char *model;
     803    int defer, push, i;
     804
     805    clear_error(proxyPtr);
     806    defer = push = FALSE;
     807    model = "all";
     808    for (i = 1; i < argc; i++) {
     809        if (strcmp(argv[i],"-defer") == 0 ) {
     810            defer = TRUE;
     811        } else if (strcmp(argv[i],"-push") == 0) {
     812            push = TRUE;
     813        } else if (strcmp(argv[i],"-model") == 0) {
     814            if (++i < argc) {
     815                model = argv[i];
     816            }
     817        } else {
     818            model = argv[i];
     819        }
     820    }
    811821    proxyPtr->flags |= INVALIDATE_CACHE; /* Ball 'n Stick */
    812822    if (!defer || push) {
     
    816826        proxyPtr->flags |= FORCE_UPDATE;
    817827    }
    818     Pymol(proxyPtr, "hide everything,%s\n",model);
    819     Pymol(proxyPtr, "set stick_color,white,%s\n",model);
    820     if (ghost) {
    821         radius = 0.1f;
    822         transparency = 0.75f;
    823     } else {
    824         radius = 0.14f;
    825         transparency = 0.0f;
    826     }
    827     Pymol(proxyPtr, "set stick_radius,%g,%s\n", radius, model);
    828 #ifdef notdef
    829     Pymol(proxyPtr, "set sphere_scale=0.25,%s\n", model);
    830 #endif
    831     Pymol(proxyPtr, "set sphere_transparency,%g,%s\n", transparency, model);
    832     Pymol(proxyPtr, "set stick_transparency,%g,%s\n", transparency, model);
    833     Pymol(proxyPtr, "show sticks,%s\n", model);
    834     Pymol(proxyPtr, "show spheres,%s\n", model);
     828    Pymol(proxyPtr, "hide everything,%s\nset stick_color,white,%s\n", model,
     829          model);
     830    Pymol(proxyPtr, "show sticks,%s\nshow spheres,%s\n", model, model);
    835831
    836832    if (proxyPtr->flags & SHOW_LABELS) {
     
    886882                 const char *argv[])
    887883{
    888     int defer = 0, push = 0, arg;
     884    int defer = 0, push = 0, i;
    889885    double scale;
    890886    const char *model = "all";
     
    893889    clear_error(proxyPtr);
    894890    scale = 0.25f;
    895     for(arg = 1; arg < argc; arg++) {
    896         if ( strcmp(argv[arg],"-defer") == 0 ) {
     891    for(i = 1; i < argc; i++) {
     892        if ( strcmp(argv[i],"-defer") == 0 ) {
    897893            defer = 1;
    898         } else if (strcmp(argv[arg],"-push") == 0) {
     894        } else if (strcmp(argv[i],"-push") == 0) {
    899895            push = 1;
    900         } else if (strcmp(argv[arg],"-model") == 0) {
    901             if (++arg < argc)
    902                 model = argv[arg];
     896        } else if (strcmp(argv[i],"-model") == 0) {
     897            if (++i < argc)
     898                model = argv[i];
    903899        } else {
    904             if (Tcl_GetDouble(interp, argv[arg], &scale) != TCL_OK) {
     900            if (Tcl_GetDouble(interp, argv[i], &scale) != TCL_OK) {
    905901                return TCL_ERROR;
    906902            }
     
    930926    PymolProxy *proxyPtr = clientData;
    931927    const char *model = "all";
    932     int arg, defer = 0, push = 0;
    933 
    934     clear_error(proxyPtr);
    935 
    936     for(arg = 1; arg < argc; arg++) {
    937 
    938         if (strcmp(argv[arg], "-defer") == 0 )
     928    int i, defer = 0, push = 0;
     929
     930    clear_error(proxyPtr);
     931
     932    for(i = 1; i < argc; i++) {
     933
     934        if (strcmp(argv[i], "-defer") == 0 )
    939935            defer = 1;
    940         else if (strcmp(argv[arg], "-push") == 0 )
     936        else if (strcmp(argv[i], "-push") == 0 )
    941937            push = 1;
    942938        else
    943             model = argv[arg];
     939            model = argv[i];
    944940       
    945941    }
     
    965961    PymolProxy *proxyPtr = clientData;
    966962    const char *model = "all";
    967     int arg, defer = 0, push = 0;
    968 
    969     clear_error(proxyPtr);
    970 
    971     for(arg = 1; arg < argc; arg++) {
     963    int i, defer = 0, push = 0;
     964
     965    clear_error(proxyPtr);
     966
     967    for(i = 1; i < argc; i++) {
    972968               
    973         if (strcmp(argv[arg],"-defer") == 0)
     969        if (strcmp(argv[i],"-defer") == 0)
    974970            defer = 1;
    975         else if (strcmp(argv[arg], "-push") == 0 )
     971        else if (strcmp(argv[i], "-push") == 0 )
    976972            push = 1;
    977973        else
    978             model = argv[arg];
     974            model = argv[i];
    979975
    980976    }
     
    996992    PymolProxy *proxyPtr = clientData;
    997993    int frame = 0;
    998     int arg, push = 0, defer = 0;
    999 
    1000     clear_error(proxyPtr);
    1001 
    1002     for(arg = 1; arg < argc; arg++) {
    1003         if ( strcmp(argv[arg],"-defer") == 0 )
     994    int i, push = 0, defer = 0;
     995
     996    clear_error(proxyPtr);
     997
     998    for(i = 1; i < argc; i++) {
     999        if ( strcmp(argv[i],"-defer") == 0 )
    10041000            defer = 1;
    1005         else if (strcmp(argv[arg],"-push") == 0 )
     1001        else if (strcmp(argv[i],"-push") == 0 )
    10061002            push = 1;
    10071003        else
    1008             frame = atoi(argv[arg]);
     1004            frame = atoi(argv[i]);
    10091005    }
    10101006               
     
    10301026{
    10311027    PymolProxy *proxyPtr = clientData;
    1032     int state = 1;
    1033     int arg, push = 0, defer = 0;
    1034 
    1035     clear_error(proxyPtr);
    1036 
    1037     for(arg = 1; arg < argc; arg++) {
    1038         if ( strcmp(argv[arg],"-defer") == 0 )
    1039             defer = 1;
    1040         else if (strcmp(argv[arg],"-push") == 0 )
    1041             push = 1;
    1042         else if (strcmp(argv[arg],"on") == 0 )
    1043             state = 1;
    1044         else if (strcmp(argv[arg],"off") == 0 )
    1045             state = 0;
    1046         else if (strcmp(argv[arg],"toggle") == 0 )
    1047             state = ((proxyPtr->flags & SHOW_LABELS) == 0);
    1048     }
    1049 
     1028    int i, push, defer, state, size;
     1029    const char *model;
     1030
     1031    clear_error(proxyPtr);
     1032    model = "all";
     1033    size = 14;
     1034    state = TRUE;
     1035    push = defer = FALSE;
     1036    for(i = 1; i < argc; i++) {
     1037        if (strcmp(argv[i],"-defer") == 0) {
     1038            defer = TRUE;
     1039        } else if (strcmp(argv[i],"-push") == 0) {
     1040            push = TRUE;
     1041        } else if (strcmp(argv[i],"-model") == 0) {
     1042            if (++i < argc) {
     1043                model = argv[i];
     1044            }
     1045        } else if (strcmp(argv[i],"-size") == 0) {
     1046            if (++i < argc) {
     1047                size = atoi(argv[i]);
     1048            }
     1049        } else if (Tcl_GetBoolean(interp, argv[i], &state) != TCL_OK) {
     1050            return TCL_ERROR;
     1051        }
     1052    }
    10501053    proxyPtr->flags |= INVALIDATE_CACHE;  /* Label */
    10511054    if (!defer || push) {
     
    10551058        proxyPtr->flags |= FORCE_UPDATE;
    10561059    }
     1060    Pymol(proxyPtr, "set label_color,white,%s\nset label_size,%d,%s\n",
     1061          model, size, model);
    10571062    if (state) {
    1058         Pymol(proxyPtr, "set label_color,white,all\n");
    1059         Pymol(proxyPtr, "set label_size,14,all\n");
    1060         Pymol(proxyPtr, "label all,\"%%s%%s\" %% (ID,name)\n");
    1061     }
    1062     else
    1063         Pymol(proxyPtr, "label all\n");
    1064 
     1063        Pymol(proxyPtr, "label %s,\"%%s%%s\" %% (ID,name)\n", model);
     1064    } else {
     1065        Pymol(proxyPtr, "label %s\n", model);
     1066    }
    10651067    if (state) {
    10661068        proxyPtr->flags |= SHOW_LABELS;
     
    10751077         const char *argv[])
    10761078{
    1077     int ghost = 0, defer = 0, push = 0, arg;
    1078     const char *model = "all";
    1079     PymolProxy *proxyPtr = clientData;
    1080     float lineWidth;
    1081 
    1082     clear_error(proxyPtr);
    1083 
    1084     for(arg = 1; arg < argc; arg++) {
    1085         if ( strcmp(argv[arg],"-defer") == 0 )
    1086             defer = 1;
    1087         else if (strcmp(argv[arg],"-push") == 0)
    1088             push = 1;
    1089         else if (strcmp(argv[arg],"-ghost") == 0)
    1090             ghost = 1;
    1091         else if (strcmp(argv[arg],"-normal") == 0)
    1092             ghost = 0;
    1093         else if (strcmp(argv[arg],"-model") == 0) {
    1094             if (++arg < argc)
    1095                 model = argv[arg];
    1096         }
    1097         else
    1098             model = argv[arg];
    1099     }
    1100 
     1079    PymolProxy *proxyPtr = clientData;
     1080    const char *model;
     1081    int defer, push, i;
     1082
     1083    clear_error(proxyPtr);
     1084    defer = push = FALSE;
     1085    model = "all";
     1086    for(i = 1; i < argc; i++) {
     1087        if ( strcmp(argv[i],"-defer") == 0 ) {
     1088            defer = TRUE;
     1089        } else if (strcmp(argv[i],"-push") == 0) {
     1090            push = TRUE;
     1091        } else if (strcmp(argv[i],"-model") == 0) {
     1092            if (++i < argc) {
     1093                model = argv[i];
     1094            }
     1095        } else {
     1096            model = argv[i];
     1097        }
     1098    }
    11011099    proxyPtr->flags |= INVALIDATE_CACHE; /* Lines */
    11021100    if (!defer || push) {
     
    11061104        proxyPtr->flags |= FORCE_UPDATE;
    11071105    }
    1108     Pymol(proxyPtr, "hide everything,%s\n",model);
    1109 
    1110     lineWidth = (ghost) ? 0.25f : 1.0f;
    1111     Pymol(proxyPtr, "set line_width,%g,%s\n", lineWidth, model);
    1112     Pymol(proxyPtr, "show lines,%s\n", model);
    1113     if (proxyPtr->flags & SHOW_LABELS) {
    1114         Pymol(proxyPtr, "show labels,%s\n", model);
    1115     }
     1106    Pymol(proxyPtr, "hide everything,%s\nshow lines,%s\n", model, model);
    11161107    return proxyPtr->status;
    11171108}
     
    11241115    PymolProxy *proxyPtr = clientData;
    11251116    int state = 1;
    1126     int arg, defer = 0, push = 0, varg = 1;
     1117    int i, defer = 0, push = 0, varg = 1;
    11271118   
    11281119    if (proxyPtr == NULL)
     
    11301121    clear_error(proxyPtr);
    11311122    pdbdata = name = NULL;      /* Suppress compiler warning. */
    1132     for(arg = 1; arg < argc; arg++) {
    1133         if ( strcmp(argv[arg],"-defer") == 0 )
     1123    for(i = 1; i < argc; i++) {
     1124        if ( strcmp(argv[i],"-defer") == 0 )
    11341125            defer = 1;
    1135         else if (strcmp(argv[arg],"-push") == 0)
     1126        else if (strcmp(argv[i],"-push") == 0)
    11361127            push = 1;
    11371128        else if (varg == 1) {
    1138             pdbdata = argv[arg];
     1129            pdbdata = argv[i];
    11391130            varg++;
    11401131        } else if (varg == 2) {
    1141             name = argv[arg];
     1132            name = argv[i];
    11421133            varg++;
    11431134        } else if (varg == 3) {
    1144             state = atoi( argv[arg] );
     1135            state = atoi( argv[i] );
    11451136            varg++;
    11461137        }
     
    13421333    }
    13431334    /* Force pymol to update the current scene. */
    1344     Pymol(proxyPtr,"refresh ; ray %d,%d ; png -, dpi=300\n", width, height);
     1335    Pymol(proxyPtr,"refresh\nray %d,%d\npng -, dpi=300\n", width, height);
    13451336    Expect(proxyPtr, "png image follows: ", buffer, 800);
    13461337
     
    14191410        proxyPtr->flags |= FORCE_UPDATE;
    14201411    }
    1421     Pymol(proxyPtr, "reset\n");
    1422     Pymol(proxyPtr, "zoom complete=1\n");
     1412    Pymol(proxyPtr, "reset\nzoom complete=1\n");
    14231413    return proxyPtr->status;
    14241414}
     
    15271517           const char *argv[])
    15281518{
    1529     int defer = 0, ghost = 0, push = 0, arg;
    1530     float scale;
    1531     const char *model = "all";
    1532     PymolProxy *proxyPtr = clientData;
    1533 
    1534     clear_error(proxyPtr);
    1535     scale = 0.41f;
    1536     for(arg = 1; arg < argc; arg++) {
    1537         if ( strcmp(argv[arg],"-defer") == 0 ) {
    1538             defer = 1;
    1539         } else if (strcmp(argv[arg],"-push") == 0) {
    1540             push = 1;
    1541         } else if (strcmp(argv[arg],"-ghost") == 0) {
    1542             ghost = 1;
    1543         } else if (strcmp(argv[arg],"-normal") == 0) {
    1544             ghost = 0;
    1545         } else if (strcmp(argv[arg],"-model") == 0) {
    1546             if (++arg < argc)
    1547                 model = argv[arg];
    1548         } else if (strcmp(argv[arg],"-scale") == 0) {
    1549             if (++arg < argc)
    1550                 scale = atof(argv[arg]);
    1551         }
    1552         else
    1553             model = argv[arg];
    1554     }
    1555 
     1519    PymolProxy *proxyPtr = clientData;
     1520    const char *model;
     1521    int defer, push, i;
     1522
     1523    clear_error(proxyPtr);
     1524    defer = push = FALSE;
     1525    model = "all";
     1526    for(i = 1; i < argc; i++) {
     1527        if ( strcmp(argv[i],"-defer") == 0 ) {
     1528            defer = TRUE;
     1529        } else if (strcmp(argv[i],"-push") == 0) {
     1530            push = TRUE;
     1531        } else if (strcmp(argv[i],"-model") == 0) {
     1532            if (++i < argc) {
     1533                model = argv[i];
     1534            }
     1535        } else {
     1536            model = argv[i];
     1537        }
     1538    }
    15561539    proxyPtr->flags |= INVALIDATE_CACHE; /* Spheres */
    15571540    if (!defer || push) {
     
    15611544        proxyPtr->flags |= FORCE_UPDATE;
    15621545    }
    1563     Pymol(proxyPtr, "hide everything, %s\n", model);
    1564 #ifdef notdef
    1565     Pymol(proxyPtr, "set sphere_scale,%f,%s\n", scale, model);
    1566 #endif
    1567     //Pymol(proxyPtr, "set sphere_quality,2,%s\n", model);
    1568     Pymol(proxyPtr, "set ambient,.2,%s\n", model);
    1569 
    1570     if (ghost)
    1571         Pymol(proxyPtr, "set sphere_transparency,.75,%s\n", model);
    1572     else
    1573         Pymol(proxyPtr, "set sphere_transparency,0,%s\n", model);
    1574 
    1575     Pymol(proxyPtr, "show spheres,%s\n", model);
    1576 
    1577     if (proxyPtr->flags & SHOW_LABELS) {
    1578         Pymol(proxyPtr, "show labels,%s\n", model);
    1579     }
     1546    Pymol(proxyPtr, "set sphere_quality,2,%s\nhide everything,%s\n",
     1547          model, model);
     1548    Pymol(proxyPtr, "set ambient,.2,%s\nshow spheres,%s\n", model, model);
    15801549    return proxyPtr->status;
    15811550}
     
    15871556    PymolProxy *proxyPtr = clientData;
    15881557    int width = 640, height = 480;
    1589     int defer = 0, push = 0, arg, varg = 1;
    1590 
    1591     clear_error(proxyPtr);
    1592 
    1593     for(arg = 1; arg < argc; arg++) {
    1594         if ( strcmp(argv[arg],"-defer") == 0 )
     1558    int defer = 0, push = 0, i, varg = 1;
     1559
     1560    clear_error(proxyPtr);
     1561
     1562    for(i = 1; i < argc; i++) {
     1563        if ( strcmp(argv[i],"-defer") == 0 )
    15951564            defer = 1;
    1596         else if ( strcmp(argv[arg], "-push") == 0 )
     1565        else if ( strcmp(argv[i], "-push") == 0 )
    15971566            push = 1;
    15981567        else if (varg == 1) {
    1599             width = atoi(argv[arg]);
     1568            width = atoi(argv[i]);
    16001569            height = width;
    16011570            varg++;
    16021571        }
    16031572        else if (varg == 2) {
    1604             height = atoi(argv[arg]);
     1573            height = atoi(argv[i]);
    16051574            varg++;
    16061575        }
     
    16221591}
    16231592
     1593
     1594static int
     1595TransparencyCmd(ClientData clientData, Tcl_Interp *interp, int argc,
     1596                const char *argv[])
     1597{
     1598    PymolProxy *proxyPtr = clientData;
     1599    const char *model, *cmd;
     1600    float transparency;
     1601    int defer, push;
     1602    int i;
     1603
     1604    clear_error(proxyPtr);
     1605    model = "all";
     1606    defer = push = FALSE;
     1607    transparency = 0.0f;
     1608    for(i = 1; i < argc; i++) {
     1609        if ( strcmp(argv[i],"-defer") == 0 ) {
     1610            defer = 1;
     1611        } else if (strcmp(argv[i],"-push") == 0) {
     1612            push = 1;
     1613        } else if (strcmp(argv[i],"-model") == 0) {
     1614            if (++i < argc) {
     1615                model = argv[i];
     1616            }
     1617        } else {
     1618            transparency = atof(argv[i]);
     1619        }
     1620    }
     1621    proxyPtr->flags |= INVALIDATE_CACHE;
     1622    if (!defer || push) {
     1623        proxyPtr->flags |= UPDATE_PENDING;
     1624    }
     1625    if (push) {
     1626        proxyPtr->flags |= FORCE_UPDATE;
     1627    }
     1628    cmd = "set sphere_transparency,%g,%s\nset stick_transparency,%g,%s\n";
     1629    Pymol(proxyPtr, cmd, transparency, model, transparency, model);
     1630    return proxyPtr->status;
     1631}
     1632
    16241633static int
    16251634VMouseCmd(ClientData clientData, Tcl_Interp *interp, int argc,
     
    16271636{
    16281637    PymolProxy *proxyPtr = clientData;
    1629     int arg, defer = 0, push = 0, varg = 1;
     1638    int i, defer = 0, push = 0, varg = 1;
    16301639    int arg1 = 0, arg2 = 0, arg3 = 0, arg4 = 0, arg5 = 0;
    16311640
    16321641    clear_error(proxyPtr);
    16331642
    1634     for(arg = 1; arg < argc; arg++) {
    1635         if (strcmp(argv[arg], "-defer") == 0)
     1643    for(i = 1; i < argc; i++) {
     1644        if (strcmp(argv[i], "-defer") == 0)
    16361645            defer = 1;
    1637         else if (strcmp(argv[arg], "-push") == 0)
     1646        else if (strcmp(argv[i], "-push") == 0)
    16381647            push = 1;
    16391648        else if (varg == 1) {
    1640             arg1 = atoi(argv[arg]);
     1649            arg1 = atoi(argv[i]);
    16411650            varg++;
    16421651        }
    16431652        else if (varg == 2) {
    1644             arg2 = atoi(argv[arg]);
     1653            arg2 = atoi(argv[i]);
    16451654            varg++;
    16461655        }
    16471656        else if (varg == 3) {
    1648             arg3 = atoi(argv[arg]);
     1657            arg3 = atoi(argv[i]);
    16491658            varg++;
    16501659        }
    16511660        else if (varg == 4) {
    1652             arg4 = atoi(argv[arg]);
     1661            arg4 = atoi(argv[i]);
    16531662            varg++;
    16541663        }
    16551664        else if (varg == 5) {
    1656             arg5 = atoi(argv[arg]);
     1665            arg5 = atoi(argv[i]);
    16571666            varg++;
    16581667        }
     
    16881697    double factor = 0.0;
    16891698    PymolProxy *proxyPtr = clientData;
    1690     int defer = 0, push = 0, arg, varg = 1;
    1691 
    1692     clear_error(proxyPtr);
    1693 
    1694     for(arg = 1; arg < argc; arg++) {
    1695         if (strcmp(argv[arg],"-defer") == 0)
     1699    int defer = 0, push = 0, i, varg = 1;
     1700
     1701    clear_error(proxyPtr);
     1702
     1703    for(i = 1; i < argc; i++) {
     1704        if (strcmp(argv[i],"-defer") == 0)
    16961705            defer = 1;
    1697         else if (strcmp(argv[arg],"-push") == 0)
     1706        else if (strcmp(argv[i],"-push") == 0)
    16981707            push = 1;
    16991708        else if (varg == 1) {
    17001709            double value;
    1701             if (Tcl_GetDouble(interp, argv[arg], &value) != TCL_OK) {
     1710            if (Tcl_GetDouble(interp, argv[i], &value) != TCL_OK) {
    17021711                return TCL_ERROR;
    17031712            }
     
    18291838    Tcl_CreateCommand(interp, "screen",        ScreenCmd,        &proxy, NULL);
    18301839    Tcl_CreateCommand(interp, "spheres",       SpheresCmd,       &proxy, NULL);
     1840    Tcl_CreateCommand(interp, "transparency",  TransparencyCmd,  &proxy, NULL);
    18311841    Tcl_CreateCommand(interp, "viewport",      ScreenCmd,        &proxy, NULL);
    18321842    Tcl_CreateCommand(interp, "vmouse",        VMouseCmd,        &proxy, NULL);
Note: See TracChangeset for help on using the changeset viewer.