void initall() { extern void initbest(),inittrans(),initplay(); initbest(); inittrans(); initplay(); }
static void trlistcb(int resp, struct conduit *conduit) { struct data *data; struct dc_transfer *dt; data = conduit->cdata; if(resp != 200) return; for(dt = dc_transfers; dt != NULL; dt = dt->next) { if(dt->dir != DC_TRNSD_DOWN) continue; inittrans(conduit, dt); } }
void initvmd() { // Assume that VMD should not initialize or use MPI // It is conceivable we would want to be able to load the VMD // Python module into a MPI-based Python run, and enable the // MPI features of VMD, but we'll have to determine the best way // to detect this and it will need to be tested since we may have // to handle this case differently than the normal MPI case where // VMD explicitly does MPI initialization and shutdown itself. int mpienabled = 0; // If there's already a VMDapp in get_vmdapp, then we must be running // inside a standalone VMD instead of being loaded as a python extension. // Don't throw an error - just load the methods for interoperability // in case vmd.so is in the PYTHONPATH of the standalone application. if (get_vmdapp() != NULL) { (void)Py_InitModule((char *)"vmd", VMDAppMethods); return; } int argc=1; char *argv[1]; argv[0] = Py_GetProgramFullPath(); if (!VMDinitialize(&argc, (char ***) &argv, mpienabled)) { return; } // XXX this is a hack, and it would be better to tie this into // VMDApp more directly at some later point, but the regular // VMD startup code is similarly lame, so we'll use it for now. const char *disp = getenv("VMDDISPLAYDEVICE"); if (!disp) disp="text"; int loc[2] = { 50, 50 }; int size[2] = { 400, 400 }; VMDgetDisplayFrame(loc, size); VMDApp *app = new VMDApp(1, argv, mpienabled); app->VMDinit(1, argv, disp, loc, size); // read application defaults VMDreadInit(app); // read user-defined startup files VMDreadStartup(app); set_vmdapp(app); // set my local static the_app = app; PyObject *vmdmodule = Py_InitModule((char *)"vmd", VMDAppMethods); initanimate(); initatomsel(); initaxes(); initcolor(); initdisplay(); initgraphics(); initimd(); initlabel(); initmaterial(); initmolecule(); initmolrep(); initmouse(); initrender(); inittrans(); initvmdmenu(); #ifdef VMDNUMPY initvmdnumpy(); #endif if (PyErr_Occurred()) return; static const char *modules[] = { "animate", "atomsel", "axes", "color", "display", "graphics", "imd", "label", "material", "molecule", "molrep", "mouse", "render", "trans", "vmdmenu", "vmdnumpy" }; for (unsigned i=0; i<sizeof(modules)/sizeof(const char *); i++) { const char *m = modules[i]; #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION < 5) #define CAST_HACK (char *) #else #define CAST_HACK #endif PyModule_AddObject(vmdmodule, CAST_HACK m, PyImport_ImportModule( CAST_HACK m)); } event_tstate = PyThreadState_Get(); #if defined(VMD_SHARED) PyOS_InputHook = vmd_input_hook; #endif }
static void dcfdcb(struct conduit *conduit, int fd, GdkInputCondition condition) { struct data *data; struct dc_response *resp; struct dc_intresp *ires; struct dc_transfer *dt; struct dtdata *dtd; data = conduit->cdata; if(((condition & GDK_INPUT_READ) && dc_handleread()) || ((condition & GDK_INPUT_WRITE) && dc_handlewrite())) { disconnected(conduit); return; } while((resp = dc_getresp()) != NULL) { if(!wcscmp(resp->cmdname, L".connect")) { if(dc_checkprotocol(resp, DC_LATEST)) { dc_disconnect(); disconnected(conduit); } else { dc_loginasync(NULL, 1, noconv, (void (*)(int, wchar_t *, void *))logincb, conduit); } } else if(!wcscmp(resp->cmdname, L".notify")) { dc_uimisc_handlenotify(resp); switch(resp->code) { case 610: if((ires = dc_interpret(resp)) != NULL) { if((dt = dc_findtransfer(ires->argv[0].val.num)) != NULL) { if(dt->dir == DC_TRNSD_DOWN) inittrans(conduit, dt); } dc_freeires(ires); } break; case 613: if((ires = dc_interpret(resp)) != NULL) { if((dt = dc_findtransfer(ires->argv[0].val.num)) != NULL) { if(((dtd = dt->udata) != NULL) && (dtd->ct != NULL)) { if(dtd->ct->size != dt->size) transfersetsize(dtd->ct, dt->size); } } dc_freeires(ires); } break; case 615: if((ires = dc_interpret(resp)) != NULL) { if((dt = dc_findtransfer(ires->argv[0].val.num)) != NULL) { if(((dtd = dt->udata) != NULL) && (dtd->ct != NULL)) { if(dtd->ct->pos != dt->curpos) transfersetpos(dtd->ct, dt->curpos); } } dc_freeires(ires); } break; } } dc_freeresp(resp); } updatewrite(conduit); }