2 # This file is Copyright 2003, 2006, 2007, 2009, 2010 Dean Hall.
4 # This file is part of the PyMite VM.
5 # The PyMite VM is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
8 # The PyMite VM is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
12 # is seen in the file COPYING in this directory.
21 * \brief Function Object Type
23 * Function object type header.
29 * A function is like an instance of a code obj.
30 * Contains ptr to its code obj and has its own attributes dict.
32 * The first (__main__) module that is executed has a function obj
33 * created for it to execute the bytecode which builds the module.
35 typedef struct PmFunc_s
37 /** Object descriptor */
40 /** Ptr to code obj */
43 /** Ptr to attribute dict */
46 /** Ptr to globals dict */
49 #ifdef HAVE_DEFAULTARGS
50 /** Ptr to tuple holding default args */
51 pPmTuple_t f_defaultargs
;
52 #endif /* HAVE_DEFAULTARGS */
55 /** Ptr to tuple of cell values */
57 #endif /* HAVE_CLOSURES */
64 * Creates a Function Obj for the given Code Obj.
65 * Allocate space for a Func obj and fill the fields.
67 * @param pco ptr to code obj
68 * @param pglobals ptr to globals dict (from containing func/module)
69 * @param r_pfunc Return by reference; pointer to new function
70 * @return Return status
72 PmReturn_t
func_new(pPmObj_t pco
, pPmObj_t pglobals
, pPmObj_t
*r_pfunc
);
74 #endif /* __FUNC_H__ */