00001 /* 00002 FALCON - The Falcon Programming Language. 00003 FILE: corefunc.h 00004 00005 Language level live function object. 00006 ------------------------------------------------------------------- 00007 Author: Giancarlo Niccolai 00008 Begin: Wed, 07 Jan 2009 14:54:36 +0100 00009 00010 ------------------------------------------------------------------- 00011 (C) Copyright 2009: the FALCON developers (see list in AUTHORS file) 00012 00013 See LICENSE file for licensing details. 00014 */ 00015 00020 #ifndef FLC_CORE_FUNC_H 00021 #define FLC_CORE_FUNC_H 00022 00023 #include <falcon/symbol.h> 00024 #include <falcon/livemodule.h> 00025 00026 #include <falcon/callpoint.h> 00027 00028 namespace Falcon 00029 { 00030 00031 class LiveModule; 00032 class VMachine; 00033 class ItemArray; 00034 00037 class FALCON_DYN_CLASS CoreFunc: public CallPoint 00038 { 00039 LiveModule *m_lm; 00040 const Symbol* m_symbol; 00041 ItemArray* m_closure; 00042 00043 public: 00044 00048 CoreFunc( const Symbol *sym, LiveModule *lm ): 00049 m_lm( lm ), 00050 m_symbol( sym ), 00051 m_closure(0) 00052 {} 00053 00054 CoreFunc( const CoreFunc& other ): 00055 m_closure(0) 00056 { 00057 m_lm = other.m_lm; 00058 m_symbol = other.m_symbol; 00059 } 00060 00061 virtual ~CoreFunc(); 00062 00063 LiveModule *liveModule() const { return m_lm; } 00064 const Symbol *symbol() const { return m_symbol; } 00065 ItemArray* closure() const { return m_closure; } 00066 void closure( ItemArray* cl ) { m_closure = cl; } 00067 00068 virtual void readyFrame( VMachine* vm, uint32 paramCount ); 00069 virtual bool isFunc() const { return true; } 00070 virtual const String& name() const { return m_symbol->name(); } 00071 00072 virtual void gcMark( uint32 gen ); 00073 }; 00074 00075 } 00076 00077 #endif 00078 /* end of corefunc.h */