Пример #1
0
		logger_wrapper::~logger_wrapper()
		{
			if (!dests_.count(level_))
				return;
			auto& outfunc = dests_[level_];
			outfunc(level_, domain_, stream_.str());
		}
Пример #2
0
/* printf */
static void outchar(char x) {
  if (maxlen) {
    maxlen--;
    outfunc(x);
    outlength++;
  }
}
Пример #3
0
void TouchListener::inev(InEv* ev)
{
	Player* py = &g_player[g_curP];

	if(ev->type == INEV_MOUSEUP && ev->key == MOUSE_LEFT && !ev->intercepted)
	{
		//mousemove();

		if(m_over && m_ldown)
		{
			if(clickfunc != NULL)
				clickfunc();

			if(clickfunc2 != NULL)
				clickfunc2(m_param);

			m_over = false;
			m_ldown = false;

			ev->intercepted = true;
			return;	// intercept mouse event
		}

		if(m_ldown)
		{
			m_ldown = false;
			ev->intercepted = true;
			return;
		}

		m_over = false;
	}
	else if(ev->type == INEV_MOUSEDOWN && ev->key == MOUSE_LEFT && !ev->intercepted)
	{
		//mousemove();

		if(m_over)
		{
			m_ldown = true;
			ev->intercepted = true;
			return;	// intercept mouse event
		}
	}
	else if(ev->type == INEV_MOUSEMOVE && !ev->intercepted)
	{
		if(py->mouse.x >= m_pos[0] && py->mouse.x <= m_pos[2] && py->mouse.y >= m_pos[1] && py->mouse.y <= m_pos[3])
		{
			if(overfunc != NULL)
				overfunc();
			if(overfunc2 != NULL)
				overfunc2(m_param);

			m_over = true;

			ev->intercepted = true;
			return;
		}
		else
		{
			if(m_over && outfunc != NULL)
				outfunc();

			m_over = false;
		}
	}
}
Пример #4
0
int main(int argc, char **argv){
	uint i,intype=0,outtype=0;
	bool help = false;
	char *pathstr = NULL, *outpath = NULL;
	path pathObj;
	int (*infunc)(char*,path*,bool);
	int (*outfunc)(path*,char**);
	
	for(i=1;i<argc;++i){
		if(!strncmp(argv[i],"--",2)){
			char* flag = argv[i]+2;
			if(!strcmp(flag,"help"))help = true;
			else if(!strcmp(flag,"to-url"))outtype = URL_TYPE;
			else if(!strcmp(flag,"from-unix"))intype = UNIX_TYPE;
		} else if(argv[i][0] == '-'){
			uint j,len = strlen(argv[i]);
			for(j=1;j<len;++j){
				switch(argv[i][j]){
					case 'h': case '?': help = true; break;
					case 'l': intype = UNIX_TYPE; break;
					case 'U': outtype = URL_TYPE; break;
				}
			}
		} else if(pathstr == NULL){
			pathstr = argv[i];
		}
	}
	
	if(help || pathstr == NULL){
		printf("Path Conversion Utility (C) Wa <logicplace.com>\n"
			"If no from is given it will guess. Can only guess if it's an absolute path.\n"
			"Relative paths will be resolved to an absolute path as necessary (the cwd).\n"
			"%s options path\n"
			"Options:\n"
			"  -h -?  --help    Show this help and exit.\n"
			"  -l  --from-unix  Treat given path as unix-style.\n"
			//"  -L --to-unix  ...\n"
			//"  -u  --from-url   Treat given path as a file:// url.\n"
			"  -U  --to-url     Output path as a file:// url.\n"
		,argv[0]);
		return 0;
	}
	
	#ifdef WINDOWS
		GetCurrentDirectory(sizeof(cCurrentPath), cCurrentPath)
	#else
		getcwd(cCurrentPath, sizeof(cCurrentPath));
	#endif
	
	if(intype == 0){
		if(isURL(pathstr))intype = URL_TYPE;
		else if(isUnixPath(pathstr))intype = UNIX_TYPE;
		else return ERROR_CANNOT_GUESS_PATH;
	}
	
	if(intype == outtype){
		printf(pathstr);
	} else {
		switch(intype){
			case UNIX_TYPE: infunc = fromUnixPath; break;
		}
		infunc(pathstr,&pathObj,needsAbsolute[outtype]);

		switch(outtype){
			case URL_TYPE: outfunc = toURL; break;
			default: outfunc = defaultOut; break;
		}
		outfunc(&pathObj,&outpath);
	
		if(outpath != NULL){
			printf("%s",outpath);
		}
	}
	
	safe_freeall();
	return 0;
}