frame.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 __FRAME_H__
00017 #define __FRAME_H__
00018 
00019 
00032 #define NATIVE_MAX_NUM_LOCALS   8
00033 
00034 
00040 typedef enum PmBlockType_e
00041 {
00043     B_INVALID = 0,
00044 
00046     B_LOOP,
00047 
00049     B_TRY
00050 } PmBlockType_t, *pPmBlockType_t;
00051 
00052 
00060 typedef struct PmBlock_s
00061 {
00063     PmObjDesc_t od;
00064 
00066     pPmObj_t *b_sp;
00067 
00069     uint8_t const *b_handler;
00070 
00072     PmBlockType_t b_type:8;
00073 
00075     struct PmBlock_s *next;
00076 } PmBlock_t,
00077  *pPmBlock_t;
00078 
00079 
00090 typedef struct PmFrame_s
00091 {
00093     PmObjDesc_t od;
00094 
00096     struct PmFrame_s *fo_back;
00097 
00099     pPmFunc_t fo_func;
00100 
00102     PmMemSpace_t fo_memspace:8;
00103 
00105     uint8_t const *fo_ip;
00106 
00108     pPmBlock_t fo_blockstack;
00109 
00111     pPmDict_t fo_attrs;
00112 
00114     pPmDict_t fo_globals;
00115 
00117     pPmObj_t *fo_sp;
00118 
00120     uint8_t fo_isImport:1;
00121 
00122 #ifdef HAVE_CLASSES
00123 
00124     uint8_t fo_isInit:1;
00125 #endif /* HAVE_CLASSES */
00126 
00128     pPmObj_t fo_locals[1];
00129     /* WARNING: Do not put new fields below fo_locals */
00130 } PmFrame_t,
00131  *pPmFrame_t;
00132 
00133 
00145 typedef struct PmNativeFrame_s
00146 {
00148     PmObjDesc_t od;
00149 
00151     struct PmFrame_s *nf_back;
00152 
00154     pPmFunc_t nf_func;
00155 
00157     pPmObj_t nf_stack;
00158 
00160     uint8_t nf_active;
00161 
00163     uint8_t nf_numlocals;
00164 
00166     pPmObj_t nf_locals[NATIVE_MAX_NUM_LOCALS];
00167 } PmNativeFrame_t,
00168  *pPmNativeFrame_t;
00169 
00170 
00180 PmReturn_t frame_new(pPmObj_t pfunc, pPmObj_t *r_pobj);
00181 
00182 #endif /* __FRAME_H__ */

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