codeobj.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 __CODEOBJ_H__
00017 #define __CODEOBJ_H__
00018 
00019 
00029 #define CI_TYPE_FIELD       0
00030 #define CI_SIZE_FIELD       1
00031 #define CI_ARGCOUNT_FIELD   3
00032 #define CI_FLAGS_FIELD      4
00033 #define CI_STACKSIZE_FIELD  5
00034 #define CI_NLOCALS_FIELD    6
00035 #ifdef HAVE_CLOSURES
00036 #define CI_FREEVARS_FIELD   7
00037 #define CI_NAMES_FIELD      8
00038 #else
00039 #define CI_NAMES_FIELD      7
00040 #endif /* HAVE_CLOSURES */
00041 
00043 #define NATIVE_IMAGE_SIZE   4
00044 
00045 /* Masks for co_flags (from Python's code.h) */
00046 #define CO_OPTIMIZED 0x01
00047 #define CO_NEWLOCALS 0x02
00048 #define CO_VARARGS 0x04
00049 #define CO_VARKEYWORDS 0x08
00050 #define CO_NESTED 0x10
00051 #define CO_GENERATOR 0x20
00052 #define CO_NOFREE 0x40
00053 
00061 typedef struct PmCo_s
00062 {
00064     PmObjDesc_t od;
00066     PmMemSpace_t co_memspace:8;
00068     uint8_t const *co_codeimgaddr;
00070     pPmTuple_t co_names;
00072     pPmTuple_t co_consts;
00073 #ifdef HAVE_CLOSURES
00074 
00075     uint8_t co_nfreevars;
00077     pPmTuple_t co_cellvars;
00079     uint16_t co_nlocals;
00080 #endif /* HAVE_CLOSURES */
00081 
00082     uint8_t const *co_codeaddr;
00084     uint8_t co_argcount;
00086     uint8_t co_flags;
00087 } PmCo_t,
00088  *pPmCo_t;
00089 
00097 typedef struct PmNo_s
00098 {
00100     PmObjDesc_t od;
00102     int8_t no_argcount;
00104     int16_t no_funcindx;
00105 } PmNo_t,
00106  *pPmNo_t;
00107 
00108 
00149 PmReturn_t
00150 co_loadFromImg(PmMemSpace_t memspace, uint8_t const **paddr, pPmObj_t *r_pco);
00151 
00180 PmReturn_t no_loadFromImg(PmMemSpace_t memspace,
00181                           uint8_t const **paddr, pPmObj_t *r_pno);
00182 
00183 #endif /* __CODEOBJ_H__ */

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