Kiwi Engine
VM for interpreter
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
KEFunction.h
Go to the documentation of this file.
1 
8 #ifndef KEFUNCTION_H
9 #define KEFUNCTION_H
10 
11 #include <Coconut/Coconut.h>
12 #include "KEObject.h"
13 #include "KEForwarders.h"
14 
18 struct KEFunction {
25 };
26 
28 typedef struct KEFunction * (*KECloneFunctionFuncRef)(struct KEFunction * src, struct CNResource * resource) ;
29 
36 } ;
37 
43 struct KEFunction *
44 KEAllocateFunction(struct CNResource * resource) ;
45 
53 struct KEFunction *
54 KEAllocateSuperFunction(size_t size, const struct KEFunctionMethods * methods, struct CNResource * resource) ;
55 
60 static inline void
61 KERetainFunction(struct KEFunction * dst)
62 {
63  KERetainObject(&(dst->superClass)) ;
64 }
65 
70 static inline void
71 KEReleaseFunction(struct KEFunction * dst)
72 {
73  KEReleaseObject(&(dst->superClass)) ;
74 }
75 
81 static inline struct CNResource *
82 KEResourceOfFunction(struct KEFunction * src)
83 {
84  return KEResourceOfObject(&(src->superClass)) ;
85 }
86 
92 static inline const struct KEFunctionMethods *
93 KEMethodsOfFunction(struct KEFunction * src)
94 {
95  return (const struct KEFunctionMethods *) KEMethodsOfObject(&(src->superClass)) ;
96 }
97 
103 void
104 KESetInstructionToFunction(struct KEFunction * dst, struct KEInstruction * src) ;
105 
111 void
112 KESetHiddenParametersToFunction(struct KEFunction * dst, struct KEValueTable * src) ;
113 
119 static inline struct KEFunction *
120 KECloneFunction(struct KEFunction * src, struct CNResource * resource)
121 {
122  const struct KEFunctionMethods * methods = KEMethodsOfFunction(src) ;
123  KECloneFunctionFuncRef clonefunc = methods->cloneFunc ;
124  return (*clonefunc)(src, resource) ;
125 }
126 
132 void
133 KEDumpFunction(struct CNText * outbuf, struct KEFunction * src) ;
134 
135 #endif /* KEFUNCTION_H */
struct KEFunction * KEAllocateSuperFunction(size_t size, const struct KEFunctionMethods *methods, struct CNResource *resource)
Alloxate Function object.
void KEDumpFunction(struct CNText *outbuf, struct KEFunction *src)
Dump context of the function.
struct KEObjectMethods superClass
Definition: KEFunction.h:33
struct KEFunction * KEAllocateFunction(struct CNResource *resource)
Alloxate Function object.
void KESetHiddenParametersToFunction(struct KEFunction *dst, struct KEValueTable *src)
Set hidden parameters to the function.
struct KEInstruction * functionInstruction
Definition: KEFunction.h:24
Definition: KEFunction.h:18
Define KEObject class.
KEProgram class.
Definition: KEValueTable.h:17
struct KEObject superClass
Definition: KEFunction.h:20
Definition: KEInstruction.h:115
Definition: KEObject.h:42
Methods for KELineInfo class.
Definition: KEFunction.h:31
KECloneFunctionFuncRef cloneFunc
Definition: KEFunction.h:35
void KESetInstructionToFunction(struct KEFunction *dst, struct KEInstruction *src)
Set instruction to the function.
struct KEValueTable * hiddenParameters
Definition: KEFunction.h:22
Definition: KEObject.h:32
Forward declarations of the data type in KiwiEngine.
struct KEFunction *(* KECloneFunctionFuncRef)(struct KEFunction *src, struct CNResource *resource)
Definition: KEFunction.h:28