class.h

Go to the documentation of this file.
00001 /*
00002 # This file is Copyright 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 __CLASS_H__
00017 #define __CLASS_H__
00018 
00031 typedef struct PmClass_s
00032 {
00034     PmObjDesc_t od;
00035 
00037     pPmDict_t cl_attrs;
00038     
00040     pPmTuple_t cl_bases;
00041 } PmClass_t,
00042  *pPmClass_t;
00043 
00045 typedef struct PmInstance_s
00046 {
00048     PmObjDesc_t od;
00049 
00051     pPmClass_t cli_class;
00052 
00054     pPmDict_t cli_attrs;
00055 } PmInstance_t, 
00056 *pPmInstance_t;
00057 
00059 typedef struct PmMethod_s
00060 {
00062     PmObjDesc_t od;
00063 
00065     pPmInstance_t m_instance;
00066     
00068     pPmFunc_t m_func;
00069     
00071     pPmDict_t m_attrs;
00072 } PmMethod_t, 
00073 *pPmMethod_t;
00074 
00075 
00086 PmReturn_t class_new(pPmObj_t pmeths, pPmObj_t pbases, pPmObj_t pname,
00087                      pPmObj_t *r_pclass);
00088 
00095 PmReturn_t class_instantiate(pPmObj_t pclass, pPmObj_t *r_pobj);
00096 
00105 PmReturn_t class_method(pPmObj_t pinstance, pPmObj_t pfunc, pPmObj_t *r_pmeth);
00106 
00115 PmReturn_t class_getAttr(pPmObj_t pobj, pPmObj_t pname, pPmObj_t *r_pobj);
00116 
00126 uint8_t class_isSubclass(pPmObj_t ptest_class, pPmObj_t pbase_class);
00127 
00128 #endif /* __CLASS_H__ */

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