亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tolua_event.c

?? tolua++是一個對lua進行封裝調(diào)用的工具
?? C
字號:
/* tolua: event functions** Support code for Lua bindings.** Written by Waldemar Celes** TeCGraf/PUC-Rio** Apr 2003** $Id: $*//* This code is free software; you can redistribute it and/or modify it.** The software provided hereunder is on an "as is" basis, and** the author has no obligation to provide maintenance, support, updates,** enhancements, or modifications.*/#include <stdio.h>#include "tolua++.h"/* Store at ubox	* It stores, creating the corresponding table if needed,	* the pair key/value in the corresponding ubox table*/static void storeatubox (lua_State* L, int lo){	#ifdef LUA_VERSION_NUM		lua_getfenv(L, lo);		if (lua_rawequal(L, -1, TOLUA_NOPEER)) {			lua_pop(L, 1);			lua_newtable(L);			lua_pushvalue(L, -1);			lua_setfenv(L, lo);	/* stack: k,v,table  */		};		lua_insert(L, -3);		lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */		lua_pop(L, 1);	#else	 /* stack: key value (to be stored) */		lua_pushstring(L,"tolua_peers");		lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: k v ubox */		lua_pushvalue(L,lo);		lua_rawget(L,-2);                       /* stack: k v ubox ubox[u] */		if (!lua_istable(L,-1))		{			lua_pop(L,1);                          /* stack: k v ubox */			lua_newtable(L);                       /* stack: k v ubox table */			lua_pushvalue(L,1);			lua_pushvalue(L,-2);                   /* stack: k v ubox table u table */			lua_rawset(L,-4);                      /* stack: k v ubox ubox[u]=table */		}		lua_insert(L,-4);                       /* put table before k */		lua_pop(L,1);                           /* pop ubox */		lua_rawset(L,-3);                       /* store at table */		lua_pop(L,1);                           /* pop ubox[u] */	#endif}/* Module index function*/static int module_index_event (lua_State* L){	lua_pushstring(L,".get");	lua_rawget(L,-3);	if (lua_istable(L,-1))	{		lua_pushvalue(L,2);  /* key */		lua_rawget(L,-2);		if (lua_iscfunction(L,-1))		{			lua_call(L,0,1);			return 1;		}		else if (lua_istable(L,-1))			return 1;	}	/* call old index meta event */	if (lua_getmetatable(L,1))	{		lua_pushstring(L,"__index");		lua_rawget(L,-2);		lua_pushvalue(L,1);		lua_pushvalue(L,2);		if (lua_isfunction(L,-1))		{			lua_call(L,2,1);			return 1;		}		else if (lua_istable(L,-1))		{			lua_gettable(L,-3);			return 1;		}	}	lua_pushnil(L);	return 1;}/* Module newindex function*/static int module_newindex_event (lua_State* L){	lua_pushstring(L,".set");	lua_rawget(L,-4);	if (lua_istable(L,-1))	{		lua_pushvalue(L,2);  /* key */		lua_rawget(L,-2);		if (lua_iscfunction(L,-1))		{			lua_pushvalue(L,1); /* only to be compatible with non-static vars */			lua_pushvalue(L,3); /* value */			lua_call(L,2,0);			return 0;		}	}	/* call old newindex meta event */	if (lua_getmetatable(L,1) && lua_getmetatable(L,-1))	{		lua_pushstring(L,"__newindex");		lua_rawget(L,-2);		if (lua_isfunction(L,-1))		{		 lua_pushvalue(L,1);		 lua_pushvalue(L,2);		 lua_pushvalue(L,3);			lua_call(L,3,0);		}	}	lua_settop(L,3);	lua_rawset(L,-3);	return 0;}/* Class index function	* If the object is a userdata (ie, an object), it searches the field in	* the alternative table stored in the corresponding "ubox" table.*/static int class_index_event (lua_State* L){ int t = lua_type(L,1);	if (t == LUA_TUSERDATA)	{		/* Access alternative table */		#ifdef LUA_VERSION_NUM /* new macro on version 5.1 */		lua_getfenv(L,1);		if (!lua_rawequal(L, -1, TOLUA_NOPEER)) {			lua_pushvalue(L, 2); /* key */			lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */			if (!lua_isnil(L, -1))				return 1;		};		#else		lua_pushstring(L,"tolua_peers");		lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: obj key ubox */		lua_pushvalue(L,1);		lua_rawget(L,-2);                       /* stack: obj key ubox ubox[u] */		if (lua_istable(L,-1))		{			lua_pushvalue(L,2);  /* key */			lua_rawget(L,-2);                      /* stack: obj key ubox ubox[u] value */			if (!lua_isnil(L,-1))				return 1;		}		#endif		lua_settop(L,2);                        /* stack: obj key */		/* Try metatables */		lua_pushvalue(L,1);                     /* stack: obj key obj */		while (lua_getmetatable(L,-1))		{                                       /* stack: obj key obj mt */			lua_remove(L,-2);                      /* stack: obj key mt */			if (lua_isnumber(L,2))                 /* check if key is a numeric value */			{				/* try operator[] */				lua_pushstring(L,".geti");				lua_rawget(L,-2);                      /* stack: obj key mt func */				if (lua_isfunction(L,-1))				{					lua_pushvalue(L,1);					lua_pushvalue(L,2);					lua_call(L,2,1);					return 1;				}			}			else			{			 lua_pushvalue(L,2);                    /* stack: obj key mt key */				lua_rawget(L,-2);                      /* stack: obj key mt value */				if (!lua_isnil(L,-1))					return 1;				else					lua_pop(L,1);				/* try C/C++ variable */				lua_pushstring(L,".get");				lua_rawget(L,-2);                      /* stack: obj key mt tget */				if (lua_istable(L,-1))				{					lua_pushvalue(L,2);					lua_rawget(L,-2);                      /* stack: obj key mt value */					if (lua_iscfunction(L,-1))					{						lua_pushvalue(L,1);						lua_pushvalue(L,2);						lua_call(L,2,1);						return 1;					}					else if (lua_istable(L,-1))					{						/* deal with array: create table to be returned and cache it in ubox */						void* u = *((void**)lua_touserdata(L,1));						lua_newtable(L);                /* stack: obj key mt value table */						lua_pushstring(L,".self");						lua_pushlightuserdata(L,u);						lua_rawset(L,-3);               /* store usertype in ".self" */						lua_insert(L,-2);               /* stack: obj key mt table value */						lua_setmetatable(L,-2);         /* set stored value as metatable */						lua_pushvalue(L,-1);            /* stack: obj key met table table */						lua_pushvalue(L,2);             /* stack: obj key mt table table key */						lua_insert(L,-2);               /*  stack: obj key mt table key table */						storeatubox(L,1);               /* stack: obj key mt table */						return 1;					}				}			}			lua_settop(L,3);		}		lua_pushnil(L);		return 1;	}	else if (t== LUA_TTABLE)	{		module_index_event(L);		return 1;	}	lua_pushnil(L);	return 1;}/* Newindex function	* It first searches for a C/C++ varaible to be set.	* Then, it either stores it in the alternative ubox table (in the case it is	* an object) or in the own table (that represents the class or module).*/static int class_newindex_event (lua_State* L){ int t = lua_type(L,1);	if (t == LUA_TUSERDATA)	{	 /* Try accessing a C/C++ variable to be set */		lua_getmetatable(L,1);		while (lua_istable(L,-1))                /* stack: t k v mt */		{			if (lua_isnumber(L,2))                 /* check if key is a numeric value */			{				/* try operator[] */				lua_pushstring(L,".seti");				lua_rawget(L,-2);                      /* stack: obj key mt func */				if (lua_isfunction(L,-1))				{					lua_pushvalue(L,1);					lua_pushvalue(L,2);					lua_pushvalue(L,3);					lua_call(L,3,0);					return 0;				}			}			else			{				lua_pushstring(L,".set");				lua_rawget(L,-2);                      /* stack: t k v mt tset */				if (lua_istable(L,-1))				{					lua_pushvalue(L,2);					lua_rawget(L,-2);                     /* stack: t k v mt tset func */					if (lua_iscfunction(L,-1))					{						lua_pushvalue(L,1);						lua_pushvalue(L,3);						lua_call(L,2,0);						return 0;					}					lua_pop(L,1);                          /* stack: t k v mt tset */				}				lua_pop(L,1);                           /* stack: t k v mt */				if (!lua_getmetatable(L,-1))            /* stack: t k v mt mt */					lua_pushnil(L);				lua_remove(L,-2);                       /* stack: t k v mt */			}		}	 lua_settop(L,3);                          /* stack: t k v */		/* then, store as a new field */		storeatubox(L,1);	}	else if (t== LUA_TTABLE)	{		module_newindex_event(L);	}	return 0;}static int class_call_event(lua_State* L) {	if (lua_istable(L, 1)) {		lua_pushstring(L, ".call");		lua_rawget(L, 1);		if (lua_isfunction(L, -1)) {			lua_insert(L, 1);			lua_call(L, lua_gettop(L)-1, 1);			return 1;		};	};	tolua_error(L,"Attempt to call a non-callable object.",NULL);	return 0;};static int do_operator (lua_State* L, const char* op){	if (lua_isuserdata(L,1))	{		/* Try metatables */		lua_pushvalue(L,1);                     /* stack: op1 op2 */		while (lua_getmetatable(L,-1))		{                                       /* stack: op1 op2 op1 mt */			lua_remove(L,-2);                      /* stack: op1 op2 mt */			lua_pushstring(L,op);                  /* stack: op1 op2 mt key */			lua_rawget(L,-2);                      /* stack: obj key mt func */			if (lua_isfunction(L,-1))			{				lua_pushvalue(L,1);				lua_pushvalue(L,2);				lua_call(L,2,1);				return 1;			}			lua_settop(L,3);		}	}	tolua_error(L,"Attempt to perform operation on an invalid operand",NULL);	return 0;}static int class_add_event (lua_State* L){	return do_operator(L,".add");}static int class_sub_event (lua_State* L){	return do_operator(L,".sub");}static int class_mul_event (lua_State* L){	return do_operator(L,".mul");}static int class_div_event (lua_State* L){	return do_operator(L,".div");}static int class_lt_event (lua_State* L){	return do_operator(L,".lt");}static int class_le_event (lua_State* L){	return do_operator(L,".le");}static int class_eq_event (lua_State* L){	return do_operator(L,".eq");}/*static int class_gc_event (lua_State* L){	void* u = *((void**)lua_touserdata(L,1));	fprintf(stderr, "collecting: looking at %p\n", u);	lua_pushstring(L,"tolua_gc");	lua_rawget(L,LUA_REGISTRYINDEX);	lua_pushlightuserdata(L,u);	lua_rawget(L,-2);	if (lua_isfunction(L,-1))	{		lua_pushvalue(L,1);		lua_call(L,1,0); 		lua_pushlightuserdata(L,u);		lua_pushnil(L);		lua_rawset(L,-3);	}	lua_pop(L,2);	return 0;}*/TOLUA_API int class_gc_event (lua_State* L){	void* u = *((void**)lua_touserdata(L,1));	int top;	/*fprintf(stderr, "collecting: looking at %p\n", u);*/	/*	lua_pushstring(L,"tolua_gc");	lua_rawget(L,LUA_REGISTRYINDEX);	*/	lua_pushvalue(L, lua_upvalueindex(1));	lua_pushlightuserdata(L,u);	lua_rawget(L,-2);            /* stack: gc umt    */	lua_getmetatable(L,1);       /* stack: gc umt mt */	/*fprintf(stderr, "checking type\n");*/	top = lua_gettop(L);	if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */	{		/*fprintf(stderr, "Found type!\n");*/		/* get gc function */		lua_pushliteral(L,".collector");		lua_rawget(L,-2);           /* stack: gc umt mt collector */		if (lua_isfunction(L,-1)) {			/*fprintf(stderr, "Found .collector!\n");*/		}		else {			lua_pop(L,1);			/*fprintf(stderr, "Using default cleanup\n");*/			lua_pushcfunction(L,tolua_default_collect);		}		lua_pushvalue(L,1);         /* stack: gc umt mt collector u */		lua_call(L,1,0);		lua_pushlightuserdata(L,u); /* stack: gc umt mt u */		lua_pushnil(L);             /* stack: gc umt mt u nil */		lua_rawset(L,-5);           /* stack: gc umt mt */	}	lua_pop(L,3);	return 0;}/* Register module events	* It expects the metatable on the top of the stack*/TOLUA_API void tolua_moduleevents (lua_State* L){	lua_pushstring(L,"__index");	lua_pushcfunction(L,module_index_event);	lua_rawset(L,-3);	lua_pushstring(L,"__newindex");	lua_pushcfunction(L,module_newindex_event);	lua_rawset(L,-3);}/* Check if the object on the top has a module metatable*/TOLUA_API int tolua_ismodulemetatable (lua_State* L){	int r = 0;	if (lua_getmetatable(L,-1))	{		lua_pushstring(L,"__index");		lua_rawget(L,-2);		r = (lua_tocfunction(L,-1) == module_index_event);		lua_pop(L,2);	}	return r;}/* Register class events	* It expects the metatable on the top of the stack*/TOLUA_API void tolua_classevents (lua_State* L){	lua_pushstring(L,"__index");	lua_pushcfunction(L,class_index_event);	lua_rawset(L,-3);	lua_pushstring(L,"__newindex");	lua_pushcfunction(L,class_newindex_event);	lua_rawset(L,-3);	lua_pushstring(L,"__add");	lua_pushcfunction(L,class_add_event);	lua_rawset(L,-3);	lua_pushstring(L,"__sub");	lua_pushcfunction(L,class_sub_event);	lua_rawset(L,-3);	lua_pushstring(L,"__mul");	lua_pushcfunction(L,class_mul_event);	lua_rawset(L,-3);	lua_pushstring(L,"__div");	lua_pushcfunction(L,class_div_event);	lua_rawset(L,-3);	lua_pushstring(L,"__lt");	lua_pushcfunction(L,class_lt_event);	lua_rawset(L,-3);	lua_pushstring(L,"__le");	lua_pushcfunction(L,class_le_event);	lua_rawset(L,-3);	lua_pushstring(L,"__eq");	lua_pushcfunction(L,class_eq_event);	lua_rawset(L,-3);	lua_pushstring(L,"__call");	lua_pushcfunction(L,class_call_event);	lua_rawset(L,-3);	lua_pushstring(L,"__gc");	lua_pushstring(L, "tolua_gc_event");	lua_rawget(L, LUA_REGISTRYINDEX);	/*lua_pushcfunction(L,class_gc_event);*/	lua_rawset(L,-3);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线免费看| 精品国产凹凸成av人网站| 中文字幕av一区二区三区免费看| 美女www一区二区| 日韩精品中文字幕一区| 久久精品国产久精国产| 久久女同互慰一区二区三区| 国产精品一区在线| 亚洲国产高清不卡| 色一区在线观看| 午夜精品福利一区二区蜜股av| 欧美精品三级日韩久久| 麻豆精品视频在线观看| 久久久久久久一区| 色综合久久综合网97色综合 | 日本韩国欧美一区二区三区| 一区二区三区不卡在线观看| 欧美美女bb生活片| 国产精品白丝av| 一区二区三区中文字幕| 777久久久精品| 粗大黑人巨茎大战欧美成人| 亚洲精品美国一| 日韩欧美亚洲一区二区| 成人免费不卡视频| 日韩中文字幕区一区有砖一区| 调教+趴+乳夹+国产+精品| 制服视频三区第一页精品| 国产成人免费在线视频| 亚洲精品乱码久久久久久| 中文字幕一区二区三区乱码在线 | 欧美电视剧在线观看完整版| 精东粉嫩av免费一区二区三区 | 国产亚洲欧美日韩在线一区| 99re视频精品| 毛片一区二区三区| 亚洲色图制服诱惑 | 久久品道一品道久久精品| 91福利在线观看| 国产一区二区中文字幕| 亚洲一区二区av电影| 精品久久国产字幕高潮| 色婷婷综合在线| 国产精品综合在线视频| 五月婷婷久久综合| 中文字幕在线观看一区| 精品国产sm最大网站免费看| 91黄色激情网站| 成人av资源站| 狠狠色丁香婷综合久久| 亚洲自拍偷拍九九九| 国产精品免费网站在线观看| 日韩视频免费直播| 欧美无砖专区一中文字| 91视频观看视频| 国产精品一品二品| 久久国产剧场电影| 亚洲成人自拍一区| 亚洲激情在线播放| 男女性色大片免费观看一区二区| 日本一二三不卡| 日韩精品一区二区三区在线 | 欧美三级蜜桃2在线观看| 丰满少妇在线播放bd日韩电影| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲精品水蜜桃| 亚洲欧洲精品一区二区精品久久久| 精品国产在天天线2019| 欧美一卡二卡在线观看| 欧美精选一区二区| 欧美日韩国产免费| 欧美日韩一区二区欧美激情| 欧洲亚洲精品在线| 91久久精品国产91性色tv| 91伊人久久大香线蕉| 播五月开心婷婷综合| 不卡在线视频中文字幕| 成人午夜大片免费观看| 国产成人三级在线观看| 国产69精品久久久久毛片| 国产成人免费xxxxxxxx| 国产精品99久久久| 成人午夜在线视频| www.成人网.com| 色哟哟国产精品| 欧美亚洲免费在线一区| 欧美日韩色一区| 欧美裸体bbwbbwbbw| 337p亚洲精品色噜噜| 日韩一区二区三区免费看| 欧美va亚洲va国产综合| 久久婷婷国产综合国色天香| 久久精品男人天堂av| 国产精品人妖ts系列视频| 亚洲丝袜制服诱惑| 亚洲国产成人porn| 麻豆精品一区二区三区| 国产精品一二三区| 91在线免费看| 欧美日韩黄色一区二区| 玉足女爽爽91| 日韩精品电影在线| 国产精品原创巨作av| 不卡高清视频专区| 欧美日韩精品免费| 亚洲精品在线观看网站| 国产精品天天看| 亚洲国产精品一区二区久久恐怖片 | www国产成人| 国产精品国产精品国产专区不蜜| 亚洲精品乱码久久久久久 | 7777精品伊人久久久大香线蕉的 | 17c精品麻豆一区二区免费| 一区二区三区在线免费视频| 日韩黄色免费电影| 国产精品12区| 欧美私模裸体表演在线观看| 日韩亚洲欧美高清| **欧美大码日韩| 青青草成人在线观看| 成人久久18免费网站麻豆| 欧美性生活影院| 亚洲国产三级在线| 国产一区二区三区精品欧美日韩一区二区三区 | 激情久久久久久久久久久久久久久久| 国产精品一区免费在线观看| 在线一区二区三区| 久久看人人爽人人| 五月天欧美精品| 成人午夜在线视频| 日韩精品影音先锋| 亚洲欧美经典视频| 国产美女视频91| 欧美日韩一区二区三区高清 | 99久久99久久精品免费看蜜桃| 欧美老女人在线| 亚洲色图一区二区三区| 激情五月播播久久久精品| 欧美在线观看视频一区二区 | 国产精品无人区| 久久精品国产精品亚洲综合| 91激情在线视频| 中文字幕在线观看一区| 国产乱淫av一区二区三区| 欧美精品成人一区二区三区四区| 亚洲欧洲性图库| 国产.欧美.日韩| 欧美videossexotv100| 视频一区免费在线观看| 色综合久久综合网| 1024成人网| 成人动漫在线一区| 国产视频一区二区三区在线观看| 日韩激情在线观看| 欧美日韩综合在线免费观看| 亚洲日穴在线视频| 成人免费va视频| 亚洲国产精品传媒在线观看| 精品一二三四区| 日韩欧美电影一区| 免费人成精品欧美精品| 这里是久久伊人| 午夜精品aaa| 在线播放日韩导航| 污片在线观看一区二区| 欧洲国内综合视频| 一区二区三区四区在线| 日本电影欧美片| 一区二区三区四区五区视频在线观看| av一区二区三区在线| 亚洲国产高清不卡| 99久久婷婷国产综合精品| 国产精品进线69影院| 97精品电影院| 亚洲欧美偷拍三级| 91久久一区二区| 亚洲一区二区欧美日韩| 欧美猛男gaygay网站| 日韩精品视频网站| 精品国产在天天线2019| 国产一本一道久久香蕉| 日本一区二区成人| 在线这里只有精品| 天天综合色天天| 欧美成人伊人久久综合网| 国内精品久久久久影院一蜜桃| 国产视频一区二区在线观看| 成人在线视频一区二区| 综合久久久久久| 欧美亚洲动漫精品| 蜜桃视频在线观看一区二区| 欧美精品一区二区精品网| 粉嫩av亚洲一区二区图片| 中文字幕亚洲成人| 欧美日韩国产乱码电影| 欧美日韩aaaaaa| 麻豆精品视频在线观看视频| 国产日韩v精品一区二区| 91亚洲精品一区二区乱码| 亚洲成人动漫一区|