global.h

Go to the documentation of this file.
00001 /*
00002 # This file is Copyright 2003, 2006, 2007, 2009, 2010 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 
00069 #ifdef HAVE_BYTEARRAY
00070 
00071 #define PM_BYTEARRAY_STR (pPmObj_t)(gVmGlobal.pbaStr)
00072 #endif /* HAVE_BYTEARRAY */
00073 
00077 typedef struct PmVmGlobal_s
00078 {
00080     pPmObj_t pnone;
00081 
00083     pPmInt_t pzero;
00084 
00086     pPmInt_t pone;
00087 
00089     pPmInt_t pnegone;
00090 
00092     pPmInt_t pfalse;
00093 
00095     pPmInt_t ptrue;
00096 
00098     pPmString_t pcodeStr;
00099 
00101     pPmDict_t builtins;
00102 
00104     PmImgPaths_t imgPaths;
00105 
00107     PmNativeFrame_t nativeframe;
00108 
00110     uint8_t errVmRelease;
00111 
00113     uint8_t errFileId;
00114 
00116     uint16_t errLineNum;
00117 
00119     pPmList_t threadList;
00120 
00122     pPmThread_t pthread;
00123 
00124 #ifdef HAVE_CLASSES
00125     /* NOTE: placing this field before the nativeframe field causes errors */
00127     pPmString_t pinitStr;
00128 #endif /* HAVE_CLASSES */
00129 
00130 #ifdef HAVE_GENERATORS
00131 
00132     pPmString_t pgenStr;
00134     pPmString_t pnextStr;
00135 #endif /* HAVE_GENERATORS */
00136 
00137 #ifdef HAVE_ASSERT
00138 
00139     pPmString_t pexnStr;
00140 #endif /* HAVE_ASSERT */
00141 
00142 #ifdef HAVE_BYTEARRAY
00143 
00144     pPmString_t pbaStr;
00145 #endif /* HAVE_BYTEARRAY */
00146 
00147 #ifdef HAVE_PRINT
00148 
00149     uint8_t needSoftSpace;
00151     uint8_t somethingPrinted;
00152 #endif /* HAVE_PRINT */
00153 
00155     uint8_t reschedule;
00156 } PmVmGlobal_t,
00157  *pPmVmGlobal_t;
00158 
00159 
00160 extern volatile PmVmGlobal_t gVmGlobal;
00161 
00162 
00168 PmReturn_t global_init(void);
00169 
00179 PmReturn_t global_setBuiltins(pPmFunc_t pmod);
00180 
00191 PmReturn_t global_loadBuiltins(void);
00192 
00193 #endif /* __GLOBAL_H__ */

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9