global.h

Go to the documentation of this file.
00001 /*
00002 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall.
00003 #
00004 # This file is part of the PyMite VM.
00005 # The PyMite VM is free software: you can redistribute it and/or modify
00006 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
00007 #
00008 # The PyMite VM is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00011 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
00012 # is seen in the file COPYING in this directory.
00013 */
00014 
00015 
00016 #ifndef __GLOBAL_H__
00017 #define __GLOBAL_H__
00018 
00019 
00029 #define PM_PBUILTINS    (pPmObj_t)(gVmGlobal.builtins)
00030 
00032 #define PM_NONE         (pPmObj_t)(gVmGlobal.pnone)
00033 
00035 #define PM_FALSE        (pPmObj_t)(gVmGlobal.pfalse)
00036 
00038 #define PM_TRUE         (pPmObj_t)(gVmGlobal.ptrue)
00039 
00041 #define PM_ZERO         (pPmObj_t)(gVmGlobal.pzero)
00042 
00044 #define PM_ONE          (pPmObj_t)(gVmGlobal.pone)
00045 
00047 #define PM_NEGONE       (pPmObj_t)(gVmGlobal.pnegone)
00048 
00050 #define PM_CODE_STR     (pPmObj_t)(gVmGlobal.pcodeStr)
00051 
00052 #ifdef HAVE_CLASSES
00053 
00054 #define PM_INIT_STR     (pPmObj_t)(gVmGlobal.pinitStr)
00055 #endif /* HAVE_CLASSES */
00056 
00057 #ifdef HAVE_GENERATORS
00058 
00059 #define PM_GENERATOR_STR (pPmObj_t)(gVmGlobal.pgenStr)
00060 
00061 #define PM_NEXT_STR (pPmObj_t)(gVmGlobal.pnextStr)
00062 #endif /* HAVE_GENERATORS */
00063 
00064 #ifdef HAVE_ASSERT
00065 
00066 #define PM_EXCEPTION_STR (pPmObj_t)(gVmGlobal.pexnStr)
00067 #endif /* HAVE_ASSERT */
00068 
00072 typedef struct PmVmGlobal_s
00073 {
00075     pPmObj_t pnone;
00076 
00078     pPmInt_t pzero;
00079 
00081     pPmInt_t pone;
00082 
00084     pPmInt_t pnegone;
00085 
00087     pPmInt_t pfalse;
00088 
00090     pPmInt_t ptrue;
00091 
00093     pPmString_t pcodeStr;
00094 
00096     pPmDict_t builtins;
00097 
00099     PmImgPaths_t imgPaths;
00100 
00102     PmNativeFrame_t nativeframe;
00103 
00105     uint8_t errVmRelease;
00106 
00108     uint8_t errFileId;
00109 
00111     uint16_t errLineNum;
00112 
00114     pPmList_t threadList;
00115 
00117     pPmThread_t pthread;
00118 
00119 #ifdef HAVE_CLASSES
00120     /* NOTE: placing this field before the nativeframe field causes errors */
00122     pPmString_t pinitStr;
00123 #endif /* HAVE_CLASSES */
00124 
00125 #ifdef HAVE_GENERATORS
00126 
00127     pPmString_t pgenStr;
00129     pPmString_t pnextStr;
00130 #endif /* HAVE_GENERATORS */
00131 
00132 #ifdef HAVE_ASSERT
00133 
00134     pPmString_t pexnStr;
00135 #endif /* HAVE_ASSERT */
00136 
00138     uint8_t reschedule;
00139 } PmVmGlobal_t,
00140  *pPmVmGlobal_t;
00141 
00142 
00143 extern volatile PmVmGlobal_t gVmGlobal;
00144 
00145 
00151 PmReturn_t global_init(void);
00152 
00162 PmReturn_t global_setBuiltins(pPmFunc_t pmod);
00163 
00174 PmReturn_t global_loadBuiltins(void);
00175 
00176 #endif /* __GLOBAL_H__ */

Generated on Wed Feb 24 13:37:02 2010 for Python-on-a-chip by  doxygen 1.5.9