1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_P
#define _H_P
#include"os_python.h"
#include"AtomInfo.h"
#include"PyMOLGlobals.h"
#define cLockAPI 1
#define cLockInbox 2
#define cLockOutbox 3
#define cPLog_pml_lf 0
#define cPLog_pml 1
#define cPLog_pym 2
#define cPLog_no_flush 3
int PLabelAtomAlt(PyMOLGlobals * G, AtomInfoType * at, char *model, char *expr,
int index);
#ifdef _PYMOL_NOPY
#define PRunStringInstance(G,x)
#define PRunStringModule(G,x)
#define PAutoBlock(G) 1
#define PAutoUnblock(G,a)
#define PBlock(G)
#define PUnblock(G)
#define PBlockLegacy()
#define PUnblockLegacy()
#define PLockAPIAsGlut(G,block_if_busy)
#define PUnlockAPIAsGlut(G)
#define PUnlockAPIAsGlutNoFlush(G)
#define PLockAPI(G)
#define PUnlockAPI(G)
#define PLockStatus(G)
#define PLockStatusAttempt()G 1
#define PUnlockStatusG()
#define PBlockAndUnlockAPI(G)
#define PBlockAndUnlockAPI(G)
#define PLockAPIAndUnblock(G)
#define PTryLockAPIAndUnblock(G)
#define PFlush(G)
#define PFlushFast(G)
#define PParse(G,s)
#define PDo(G,s)
#define PLog(G,a,b)
#define PLogFlush(G)
#define PIsGlutThread() 1
#define PComplete(G,a,b) 0
#define PSGIStereo(G,a)
#define PPovrayRender(a,b,c,d,e,f,g) 0
#define PTruthCallStr(a,b,c)
#define PSleep(G,a)
#define PSleepWhileBusy(G,a)
#define PSleepUnlocked(G,a)
#define PFree()
#define PInit(G,a)
#define PSetupEmbedded(G,a,b)
#define PConvertOptions(a,b)
#define PGetOptions(a)
#define PAlterAtom(G,a,b,c,d,e,f) 0
#define PLabelAtom(G,a,b,c,d) 0
#define PAlterAtomState(G,a,b,c,d,e,f,g) 0
#else
ov_status PCacheSet(PyMOLGlobals * G, PyObject * entry, PyObject * output);
ov_status PCacheGet(PyMOLGlobals * G,
PyObject ** result_output, PyObject ** result_entry,
PyObject * input);
void PInit(PyMOLGlobals * G, int global_instance);
void PSetupEmbedded(PyMOLGlobals * G, int argc, char **argv);
struct PyMOLOptionRec;
void PConvertOptions(CPyMOLOptions * rec, PyObject * options);
void PGetOptions(CPyMOLOptions * rec);
void PFree(void);
void PExit(PyMOLGlobals * G, int code);
void PParse(PyMOLGlobals * G, char *str); /* only accepts one command */
void PDo(PyMOLGlobals * G, char *str); /* accepts multple commands seperated by newlines */
int PAlterAtom(PyMOLGlobals * G, AtomInfoType * at, char *expr,
int read_only, char *model, int index, PyObject * space);
int PLabelAtom(PyMOLGlobals * G, AtomInfoType * at, char *model, char *expr, int index);
int PAlterAtomState(PyMOLGlobals * G, float *v, char *expr, int read_only,
AtomInfoType * at, char *model, int index, PyObject * space);
void PLog(PyMOLGlobals * G, char *str, int lf);
void PLogFlush(PyMOLGlobals * G);
void PSleep(PyMOLGlobals * G, int usec);
void PSleepWhileBusy(PyMOLGlobals * G, int usec);
void PSleepUnlocked(PyMOLGlobals * G, int usec);
int PLockAPI(PyMOLGlobals * G, int block_if_busy);
void PUnlockAPI(PyMOLGlobals * G);
int PLockAPIAsGlut(PyMOLGlobals * G, int block_if_busy);
void PUnlockAPIAsGlut(PyMOLGlobals * G);
void PUnlockAPIAsGlutNoFlush(PyMOLGlobals * G);
void PLockStatus(PyMOLGlobals * G);
int PLockStatusAttempt(PyMOLGlobals * G);
void PUnlockStatus(PyMOLGlobals * G);
void PBlock(PyMOLGlobals * G);
void PUnblock(PyMOLGlobals * G);
void PBlockLegacy(void);
void PUnblockLegacy(void);
int PAutoBlock(PyMOLGlobals * G);
void PAutoUnblock(PyMOLGlobals * G, int flag);
void PBlockAndUnlockAPI(PyMOLGlobals * G);
void PLockAPIAndUnblock(PyMOLGlobals * G);
int PTryLockAPIAndUnblock(PyMOLGlobals * G);
int PFlush(PyMOLGlobals * G);
int PFlushFast(PyMOLGlobals * G);
void PXDecRef(PyObject * obj);
PyObject *PXIncRef(PyObject * obj);
void PSGIStereo(PyMOLGlobals * G, int flag);
void PDefineFloat(PyMOLGlobals * G, char *name, float value);
void PRunStringModule(PyMOLGlobals * G, char *str);
void PRunStringInstance(PyMOLGlobals * G, char *str);
void PDumpTraceback(PyObject * err);
void PDumpException(void);
int PComplete(PyMOLGlobals * G, char *str, int buf_size);
int PTruthCallStr(PyObject * object, char *method, char *argument);
int PTruthCallStr0(PyObject * object, char *method);
int PTruthCallStr1i(PyObject * object, char *method, int argument);
int PTruthCallStr1s(PyObject * object, char *method, char *argument);
int PTruthCallStr4i(PyObject * object, char *method, int a1, int a2, int a3, int a4);
int PPovrayRender(PyMOLGlobals * G, char *header, char *inp, char *file, int width,
int height, int antialias);
int PIsGlutThread(void);
PyObject *PGetFontDict(PyMOLGlobals * G, float size, int face, int style);
typedef struct {
int id;
PyThreadState *state;
} SavedThreadRec;
/* instance-specific Python object, containers, closures, and threads */
#define MAX_SAVED_THREAD ((PYMOL_MAX_THREADS)+3)
struct _CP_inst {
/* instance-specific storage */
PyObject *obj;
PyObject *dict;
PyObject *exec;
PyObject *cmd;
PyObject *parse; /* parse closure */
PyObject *complete; /* complete partial command / TAB action */
PyObject *cmd_do;
PyObject *cache;
/* locks and threads */
PyObject *lock; /* API locks */
PyObject *lock_attempt;
PyObject *unlock;
PyObject *lock_c; /* C locks */
PyObject *unlock_c;
PyObject *lock_status; /* status locks */
PyObject *lock_status_attempt; /* status locks */
PyObject *unlock_status;
PyObject *lock_glut; /* GLUT locks */
PyObject *unlock_glut;
int glut_thread_keep_out;
SavedThreadRec savedThread[MAX_SAVED_THREAD];
};
/* PyObject *GetBondsDict(void); */
/* all of the following Python objects must be invariant global
modules & module dictionaries for the application */
extern PyObject *P_menu; /* used by Menu */
extern PyObject *P_xray; /* used by Symmetry */
extern PyObject *P_chempy; /* used by CoordSet and Selector for construction of models */
extern PyObject *P_models; /* used by Selector for construction of models */
extern PyObject *P_setting; /* used by Setting.c */
extern unsigned int P_glut_thread_id;
#endif
#endif
|