Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
squserdata.h
00001 /* see copyright notice in squirrel.h */ 00002 #ifndef _SQUSERDATA_H_ 00003 #define _SQUSERDATA_H_ 00004 00005 struct SQUserData : SQDelegable 00006 { 00007 SQUserData(SQSharedState *ss){ _delegate = 0; _hook = NULL; INIT_CHAIN(); ADD_TO_CHAIN(&_ss(this)->_gc_chain, this); } 00008 ~SQUserData() 00009 { 00010 REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain, this); 00011 SetDelegate(NULL); 00012 } 00013 static SQUserData* Create(SQSharedState *ss, SQInteger size) 00014 { 00015 SQUserData* ud = (SQUserData*)SQ_MALLOC(sq_aligning(sizeof(SQUserData))+size); 00016 new (ud) SQUserData(ss); 00017 ud->_size = size; 00018 ud->_typetag = 0; 00019 return ud; 00020 } 00021 #ifndef NO_GARBAGE_COLLECTOR 00022 void Mark(SQCollectable **chain); 00023 void Finalize(){SetDelegate(NULL);} 00024 SQObjectType GetType(){ return OT_USERDATA;} 00025 #endif 00026 void Release() { 00027 if (_hook) _hook((SQUserPointer)sq_aligning(this + 1),_size); 00028 SQInteger tsize = _size; 00029 this->~SQUserData(); 00030 SQ_FREE(this, sq_aligning(sizeof(SQUserData)) + tsize); 00031 } 00032 00033 00034 SQInteger _size; 00035 SQRELEASEHOOK _hook; 00036 SQUserPointer _typetag; 00037 //SQChar _val[1]; 00038 }; 00039 00040 #endif //_SQUSERDATA_H_
Generated on Tue Jul 12 2022 21:35:49 by
