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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
/*
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"ObjectMolecule.h"
#include"CoordSet.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
#define cPType_string 1
#define cPType_int 2
#define cPType_int_as_string 3
#define cPType_float 4
#define cPType_stereo 5
#define cPType_char_as_type 6
#define cPType_model 7
#define cPType_index 8
#define cPType_int_custom_type 9
#define cPType_xyz_float 10
#define cPType_settings 11
#define cPType_properties 12
#define cPType_state 13
#define cPType_schar 14
#define NUM_ATOM_PROPERTIES 40
#define cPRunType_alter 1
#define cPRunType_alter_state 2
#define cPRunType_label 3
int PLabelExprUsesVariable(PyMOLGlobals * G, const char *expr, const char *var);
int PLabelAtomAlt(PyMOLGlobals * G, AtomInfoType * at, const char *model, const 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,g,h) 0
#define PLabelAtom(G,a,b,c,d,e,f) 0
#define PAlterAtomState(G,a,b,c,d,e,f,g,h,i,j,k) 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, const char *str); /* only accepts one command */
void PDo(PyMOLGlobals * G, const char *str); /* accepts multple commands seperated by newlines */
int PAlterAtom(PyMOLGlobals * G, ObjectMolecule *obj, CoordSet *cs, PyCodeObject *expr_co,
int read_only, int atm, PyObject * space);
int PLabelAtom(PyMOLGlobals * G, ObjectMolecule *obj, CoordSet *cs, PyCodeObject *expr_co, int atm);
int PAlterAtomState(PyMOLGlobals * G, PyCodeObject *expr_co, int read_only,
ObjectMolecule *obj, CoordSet *cs, int atm, int idx,
int state, PyObject * space);
void PLog(PyMOLGlobals * G, const 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, const char *name, float value);
void PRunStringModule(PyMOLGlobals * G, const char *str);
void PRunStringInstance(PyMOLGlobals * G, const char *str);
void PDumpTraceback(PyObject * err);
void PDumpException(void);
int PComplete(PyMOLGlobals * G, char *str, int buf_size);
int PTruthCallStr(PyObject * object, const char *method, const char *argument);
int PTruthCallStr0(PyObject * object, const char *method);
int PTruthCallStr1i(PyObject * object, const char *method, int argument);
int PTruthCallStr1s(PyObject * object, const char *method, const char *argument);
int PTruthCallStr4i(PyObject * object, const char *method, int a1, int a2, int a3, int a4);
int PPovrayRender(PyMOLGlobals * G, const char *header, const char *inp, const char *file, int width,
int height, int antialias);
int PIsGlutThread(void);
PyObject *PGetFontDict(PyMOLGlobals * G, float size, int face, int style);
typedef struct {
long id;
PyThreadState *state;
} SavedThreadRec;
typedef struct {
PyObject_HEAD
// PyObject* dict;
ObjectMolecule *obj;
CoordSet *cs;
AtomInfoType *atomInfo;
int atm;
int idx;
int state;
short read_only; // set for PLabelAtom
PyMOLGlobals * G;
PyObject *dict;
} WrapperObject;
void WrapperObjectReset(WrapperObject *);
typedef struct {
PyObject_HEAD
WrapperObject *wobj;
} SettingPropertyWrapperObject;
/* 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];
WrapperObject *wrapperObject;
SettingPropertyWrapperObject *settingWrapperObject;
};
/* 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 PyTypeObject *P_wrapper; /* used by P.c for lazy-loading settings/properties/attributes */
#endif
#ifndef _PYMOL_NOPY
void PSetAtomPropertyInfo(PyMOLGlobals * G, int propid, short pt, int off);
#endif
char convertStereoToChar(int stereo);
int convertCharToStereo(char stereo);
#endif
|