当前位置: 首页>>代码示例>>C++>>正文


C++ MSG_OUT函数代码示例

本文整理汇总了C++中MSG_OUT函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_OUT函数的具体用法?C++ MSG_OUT怎么用?C++ MSG_OUT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MSG_OUT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: new_conn

/* Create a new easy handle, and add it to the global curl_multi */
static void new_conn(char *url, GlobalInfo *g)
{
  ConnInfo *conn;
  CURLMcode rc;

  conn = g_malloc0(sizeof(ConnInfo));
  conn->error[0]='\0';
  conn->easy = curl_easy_init();
  if(!conn->easy) {
    MSG_OUT("curl_easy_init() failed, exiting!\n");
    exit(2);
  }
  conn->global = g;
  conn->url = g_strdup(url);
  curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url);
  curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb);
  curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn);
  curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE);
  curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
  curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
  curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS?0L:1L);
  curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
  curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn);
  curl_easy_setopt(conn->easy, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(conn->easy, CURLOPT_CONNECTTIMEOUT, 30L);
  curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 1L);
  curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 30L);

  MSG_OUT("Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url);
  rc = curl_multi_add_handle(g->multi, conn->easy);
  mcode_or_die("new_conn: curl_multi_add_handle", rc);

  /* note that the add_handle() will set a time-out to trigger very soon so
     that the necessary socket_action() call will be called by this app */
}
开发者ID:Andersbakken,项目名称:curl,代码行数:36,代码来源:ghiper.c

示例2: check_multi_info

/* Check for completed transfers, and remove their easy handles */
static void check_multi_info(GlobalInfo *g)
{
    char *eff_url;
    CURLMsg *msg;
    int msgs_left;
    ConnInfo *conn;
    CURL *easy;
    CURLcode res;

    MSG_OUT("REMAINING: %d\n", g->still_running);
    while ((msg = curl_multi_info_read(g->multi, &msgs_left)))
    {
        if (msg->msg == CURLMSG_DONE)
        {
            easy = msg->easy_handle;
            res = msg->data.result;
            curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn);
            curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url);
            MSG_OUT("DONE: %s => (%d) %s\n", eff_url, res, conn->error);
            curl_multi_remove_handle(g->multi, easy);
            free(conn->url);
            curl_easy_cleanup(easy);
            free(conn);
        }
    }
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:27,代码来源:ghiper.c

示例3: sock_cb

/* CURLMOPT_SOCKETFUNCTION */
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
  GlobalInfo *g = (GlobalInfo*) cbp;
  SockInfo *fdp = (SockInfo*) sockp;
  static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };

  MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
  if (what == CURL_POLL_REMOVE) {
    MSG_OUT("\n");
    remsock(fdp);
  } else {
    if (!fdp) {
      MSG_OUT("Adding data: %s%s\n",
             what&CURL_POLL_IN?"READ":"",
             what&CURL_POLL_OUT?"WRITE":"" );
      addsock(s, e, what, g);
    }
    else {
      MSG_OUT(
        "Changing action from %d to %d\n", fdp->action, what);
      setsock(fdp, s, e, what, g);
    }
  }
  return 0;
}
开发者ID:Aakanksha,项目名称:c-twitter,代码行数:26,代码来源:ghiper.c

示例4: init_fifo

int init_fifo(void)
{
 struct stat st;
 const char *fifo = "hiper.fifo";
 int socket;

 if (lstat (fifo, &st) == 0) {
  if ((st.st_mode & S_IFMT) == S_IFREG) {
   errno = EEXIST;
   perror("lstat");
   exit (1);
  }
 }

 unlink (fifo);
 if (mkfifo (fifo, 0600) == -1) {
  perror("mkfifo");
  exit (1);
 }

 socket = open (fifo, O_RDWR | O_NONBLOCK, 0);

 if (socket == -1) {
  perror("open");
  exit (1);
 }
 MSG_OUT("Now, pipe some URL's into > %s\n", fifo);

 return socket;

}
开发者ID:Aakanksha,项目名称:c-twitter,代码行数:31,代码来源:ghiper.c

示例5: mcode_or_die

/* Die if we get a bad CURLMcode somewhere */
static void mcode_or_die(const char *where, CURLMcode code)
{
    if ( CURLM_OK != code )
    {
        const char *s;
        switch (code)
        {
        case     CURLM_BAD_HANDLE:
            s="CURLM_BAD_HANDLE";
            break;
        case     CURLM_BAD_EASY_HANDLE:
            s="CURLM_BAD_EASY_HANDLE";
            break;
        case     CURLM_OUT_OF_MEMORY:
            s="CURLM_OUT_OF_MEMORY";
            break;
        case     CURLM_INTERNAL_ERROR:
            s="CURLM_INTERNAL_ERROR";
            break;
        case     CURLM_BAD_SOCKET:
            s="CURLM_BAD_SOCKET";
            break;
        case     CURLM_UNKNOWN_OPTION:
            s="CURLM_UNKNOWN_OPTION";
            break;
        case     CURLM_LAST:
            s="CURLM_LAST";
            break;
        default:
            s="CURLM_unknown";
        }
        MSG_OUT("ERROR: %s returns %s\n", where, s);
        exit(code);
    }
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:36,代码来源:ghiper.c

示例6: cmd_useskill

static RESULT cmd_useskill(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{
	int    idx;
	RESULT ret;
	if(get_game_status(pContext) == Status_None)
	{
		MSG_OUT("当前不在游戏中!\n");
		return R_E_STATUS;
	}

	ret = R_DEF;

	if(argc >= 2 && 0 == to_int(argv[1], &idx))
	{
		ret = game_cmd_use_skill(pContext, pEvent, idx);
	}
	else if(argc >= 2 && (0 == strcasecmp(argv[1], "weapon") || 0 == strcasecmp(argv[1], "w")) )
	{
		ret = game_cmd_use_weapon(pContext, pEvent);
	}
	else if(argc >= 2 && (0 == strcasecmp(argv[1], "armor") || 0 == strcasecmp(argv[1], "a")) )
	{
		ret = game_cmd_use_armor(pContext, pEvent);
	}
	else
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}
	
	return ret;
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:32,代码来源:cmd.cpp

示例7: event_cb

/* Called by glib when we get action on a multi socket */
static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
{
  GlobalInfo *g = (GlobalInfo*) data;
  CURLMcode rc;
  int fd = g_io_channel_unix_get_fd(ch);

  int action =
    (condition & G_IO_IN ? CURL_CSELECT_IN : 0) |
    (condition & G_IO_OUT ? CURL_CSELECT_OUT : 0);

  rc = curl_multi_socket_action(g->multi, fd, action, &g->still_running);
  mcode_or_die("event_cb: curl_multi_socket_action", rc);

  check_multi_info(g);
  if(g->still_running) {
    return TRUE;
  }
  else {
    MSG_OUT("last transfer done, kill timeout\n");
    if(g->timer_event) {
      g_source_remove(g->timer_event);
    }
    return FALSE;
  }
}
开发者ID:Andersbakken,项目名称:curl,代码行数:26,代码来源:ghiper.c

示例8: cmd_load

static RESULT cmd_load(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{
	GameEventContext    event;
	//RESULT ret;
	if(pContext->status != Status_None)
	{
		MSG_OUT("已经在游戏中,不能加载一个游戏进度!\n");
		return R_E_STATUS;
	}

	if(argc != 2)
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}
	
	// load game

	INIT_EVENT(&event, GameEvent_LoadGame, INVALID_PLAYER , INVALID_PLAYER, pEvent);
	event.file_name = argv[1];

	//ret = game_load(pContext, argv[1]);
	
	//if(R_SUCC != ret)
	//{
	//	return ret;
	//}

	// game main
	return game_main(pContext, &event);
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:31,代码来源:cmd.cpp

示例9: prog_cb

/* CURLOPT_PROGRESSFUNCTION */
static int prog_cb(void *p, double dltotal, double dlnow, double ult,
                   double uln)
{
  ConnInfo *conn = (ConnInfo *)p;
  MSG_OUT("Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal);
  return 0;
}
开发者ID:Andersbakken,项目名称:curl,代码行数:8,代码来源:ghiper.c

示例10: cmd_discard

static RESULT cmd_discard(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{
	int idx[MAX_PARAM_NUM];
	int cnt = 0;
	int n;

	if(get_game_status(pContext) == Status_None)
	{
		MSG_OUT("当前不在游戏中!\n");
		return R_E_STATUS;
	}

	if(argc < 2)
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}

	
	for(n = 1; n < argc && cnt < MAX_PARAM_NUM; n++)
	{
		if(0 != to_int(argv[n], &idx[cnt]))
		{
			param_error(argv[0]);
			return R_E_PARAM;
		}
		cnt++;
	}


	return game_cmd_discard_card(pContext, pEvent, idx, cnt);
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:32,代码来源:cmd.cpp

示例11: game_cmd_use_skill

RESULT game_cmd_use_skill(GameContext* pGame, GameEventContext* pEvent, int idx)
{
	RESULT  ret;
	//char name[128];
	int skill_num;
	Player* p = CUR_PLAYER(pGame);

	//const HeroConfig* pHero = get_hero_config(p->hero);

	//if(pHero == NULL)
	//{
	//	MSG_OUT("skill (%d) not exist!\n", idx );
	//	return R_E_PARAM;
	//}

	skill_num = p->hero == HeroID_None ? 0 : hero_skill_num(p->hero);

	if(idx < 1 || idx > skill_num)
	{
		MSG_OUT("无效的技能序号 [%d] !\n", idx );
		return R_E_PARAM;
	}

	if(YES != can_use_skill(pGame, pEvent))
	{
		MSG_OUT("你当前不能发动技能!\n");
		return R_E_STATUS;
	}


	if(USE_MANUAL != call_hero_skill_can_use(p->hero, idx, pGame, pEvent, pGame->cur_player))
	{
		MSG_OUT("当前你不能发动技能【%s】!\n", get_hero_skill_name(p->hero, idx) );
		return R_E_STATUS;
	}

	// todo: trigger event per use skill

	MSG_OUT("【%s】发动武将技能【%s】。\n", p->name, get_hero_skill_name(p->hero, idx));

	ret = call_hero_skill_event(p->hero, idx, pGame, pEvent, pGame->cur_player);

	// post trigger use skill

	(void)ret;
	return R_SUCC;
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:47,代码来源:skill.cpp

示例12: cmd_comm

static void  cmd_comm(GameContext* pContext, GameEventContext* pEvent, char*  cmd)
{
	// 这里直接检测 info 和 quit 指令
	const char* argv[MAX_PARAM_NUM];
	int argc;
	char* next;
	char* w;
	int n;

	next =  cmd;
	argc = 0;
	memset(argv, 0, sizeof(argv));
	while( NULL != (w = get_word(next, &next) ) )
	{
		if(argc < (int)COUNT(argv))
		{
			argv[argc++] = w;
		}
	}

	if(*next != 0)
	{
		MSG_OUT("error cmd at col %d!\n", (int)(next - cmd));
	}
	else if(argc > 0)
	{
		for(n= 0; n < CMD_NUM; n++)
		{
			if(s_cmdDispatch[n].flag == cmd_f_comm &&  
				(!strcmp(argv[0], s_cmdDispatch[n].name) || (s_cmdDispatch[n].sort_name && !strcmp(argv[0], s_cmdDispatch[n].sort_name))))
			{
				break;
			}
		}

		if(n < CMD_NUM)
		{

			(*s_cmdDispatch[n].func)(argv, argc, pContext, pEvent);
		}
		else
		{
			MSG_OUT("invalid cmd : %s!\n", argv[0]);
		}
	}
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:46,代码来源:cmd.cpp

示例13: cmd_reload

static RESULT cmd_reload(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{
	if(pContext->status != Status_None)
	{
		MSG_OUT("在游戏中不能重新加载脚本,请先结束本局游戏!\n");
		return R_E_STATUS;
	}

	return reload_game_script();
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:10,代码来源:cmd.cpp

示例14: game_cmd_use_armor

RESULT game_cmd_use_armor(GameContext* pGame, GameEventContext* pEvent)
{
	RESULT ret;
	Player* p = CUR_PLAYER(pGame);
	VCard     vcard;
	PosCard   pcard;
	//char temp[128];

	if(R_SUCC != get_player_card(p, CardWhere_PlayerEquip, EquipIdx_Armor, &vcard))
	{
		MSG_OUT("你没有装备%s!\n", equip_idx_str(EquipIdx_Armor));
		return R_E_FAIL;
	}

	pcard.card = vcard.vcard;

	if(YES != can_use_skill(pGame, pEvent))
	{
		MSG_OUT("你当前不能发动技能!\n");
		return R_E_STATUS;
	}


	pcard.where = CardWhere_PlayerEquip;
	pcard.pos = EquipIdx_Armor;

	if(USE_MANUAL != game_card_can_use(pGame, pEvent, get_game_cur_player(pGame), &pcard))
	{
		MSG_OUT("你装备的%s【%s】当前不能使用!\n", equip_idx_str(EquipIdx_Armor), get_card_name(pcard.card.id));
		return R_E_FAIL;
	}

	MSG_OUT("【%s】发动【%s】的%s效果。\n", p->name, get_card_name(pcard.card.id), equip_idx_str(EquipIdx_Armor));

	set_player_card_flag(p, pcard.where, pcard.pos, CardFlag_InUse);
	ret = call_card_event(pcard.card.id, pGame, pEvent, get_game_cur_player(pGame));
	set_player_card_flag(p, pcard.where, pcard.pos, CardFlag_None);

	(void)ret;
	return R_SUCC;
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:41,代码来源:skill.cpp

示例15: cmd_help_i

static void cmd_help_i(const char* cmd)
{
	int n;
	if(cmd == NULL)
	{
		for(n = 0; n < CMD_NUM; n++)
		{
			if(s_cmdDispatch[n].brief != NULL)
			{
				MSG_OUT("%s\n", s_cmdDispatch[n].brief);
			}
		}
	}
	else
	{
		for(n = 0; n < CMD_NUM; n++)
		{
			if(!strcmp(cmd, s_cmdDispatch[n].name) || (s_cmdDispatch[n].sort_name && !strcmp(cmd, s_cmdDispatch[n].sort_name)))
			{
				if(s_cmdDispatch[n].brief != NULL)
				{
					MSG_OUT("%s\n", s_cmdDispatch[n].brief);
					if(s_cmdDispatch[n].detail != NULL)
					{
						MSG_OUT("%s\n", s_cmdDispatch[n].detail);
					}
				}
				else
				{
					MSG_OUT("no help info for cmd \'%s\'\n", cmd);
				}
				break;
			}
		}

		if(n >= CMD_NUM)
		{
			MSG_OUT("cmd \'%s\' not found!\n", cmd);
		}
	}
}
开发者ID:voidpaper,项目名称:sgs2010,代码行数:41,代码来源:cmd.cpp


注:本文中的MSG_OUT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。