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


C++ command_status函数代码示例

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


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

示例1: execute_and_or_command

void execute_and_or_command(command_t command)
{


        if(command->type == AND_COMMAND){
                execute_wrapper(command->u.command[0]);
                command->status = command->u.command[0]->status;
                if(command_status(command->u.command[0]) == 0){
                        execute_wrapper(command->u.command[1]);
                        command->status = command->u.command[1]->status;
                }
                else
                		command->status = 1;

        }

        if(command->type == OR_COMMAND){
                execute_wrapper(command->u.command[0]);
                command->status = command->u.command[0]->status;
                //printf("%d\n",command->status);
                if(command_status(command->u.command[0]) > 0){
                        execute_wrapper(command->u.command[1]);
                        command->status = command->u.command[1]->status;
                }
                else
                	command->status = 0;
        }        
        
}        
开发者ID:csucla2015,项目名称:cs111-lab1,代码行数:29,代码来源:execute-command.c

示例2: hci_link_control

static void hci_link_control(uint16_t ocf, int plen, uint8_t *data)
{
	uint8_t status;

	const uint16_t ogf = OGF_LINK_CTL;

	switch (ocf) {
	case OCF_CREATE_CONN:
		command_status(ogf, ocf, 0x00);
		create_connection(data);
		break;

	case OCF_ACCEPT_CONN_REQ:
		command_status(ogf, ocf, 0x00);
		accept_connection(data);
		break;

	case OCF_DISCONNECT:
		command_status(ogf, ocf, 0x00);
		disconnect(data);
		break;

	default:
		status = 0x01;
		command_complete(ogf, ocf, 1, &status);
		break;
	}
}
开发者ID:federivas,项目名称:s6500d_official_platform,代码行数:28,代码来源:hciemu.c

示例3: executeANDCommand

void executeANDCommand(command_t c)
{
	callCommand(c->u.command[0]);
	int cStatus1 = command_status(c->u.command[0]);
	if (cStatus1) 	// if true (fails, returns -1), whole AND command fails, you lose, get a life
		c->status = cStatus1;
	else {		// false, first command succeeded, run second command and save status in AND command
		callCommand(c->u.command[1]);
		c->status = command_status(c->u.command[1]);
	}
}
开发者ID:forrestblee,项目名称:CS111-Lab1,代码行数:11,代码来源:execute-command.c

示例4: executingOr

void executingOr(command_t c)
{
    execute_switch(c->u.command[0]);
    if (command_status(c->u.command[0]) == 0)
    {
	c->status = command_status(c->u.command[0]);
    } else {
	execute_switch(c->u.command[1]);
	c->status = command_status(c->u.command[1]);
    }
}
开发者ID:joshstclair,项目名称:CS111,代码行数:11,代码来源:execute-command.c

示例5: executeORCommand

void executeORCommand(command_t c)
{
	callCommand(c->u.command[0]);
	int cStatus1 = command_status(c->u.command[0]);
	if (cStatus1) 	// if true (fails, returns -1), try the other command
	{
		callCommand(c->u.command[1]);
		c->status = command_status(c->u.command[1]);
	}	
	else {		// false, first command succeeded, can forget about the second command
		c->status = cStatus1;
	}
}
开发者ID:forrestblee,项目名称:CS111-Lab1,代码行数:13,代码来源:execute-command.c

示例6: SETDEFAULTIOTYPE

bool xRedisClient::lset(const RedisDBIdx& dbi, const string& key, int index, const string& value) {
	if (0 == key.length()) {
		return false;
	}
	SETDEFAULTIOTYPE(MASTER);
	return command_status(dbi, "LSET %s %d %s", key.c_str(), index, value.c_str());
}
开发者ID:yorickdewid,项目名称:Mavicona,代码行数:7,代码来源:xRedisClient_lists.cpp

示例7: hci_status_param

static void hci_status_param(uint16_t ocf, int plen, uint8_t *data)
{
	read_local_amp_info_rp ai;

	const uint16_t ogf = OGF_STATUS_PARAM;

	switch (ocf) {
	case OCF_READ_LOCAL_AMP_INFO:
		memset(&ai, 0, sizeof(ai));

		/* BT only */
		ai.amp_status = 0x01;
		ai.max_pdu_size = htobl(L2CAP_DEFAULT_MTU);
		ai.controller_type = HCI_AMP;
		ai.max_amp_assoc_length = htobl(HCI_MAX_ACL_SIZE);
		/* No flushing at all */
		ai.max_flush_timeout = 0xFFFFFFFF;
		ai.best_effort_flush_timeout = 0xFFFFFFFF;

		command_complete(ogf, ocf, sizeof(ai), &ai);
		break;

	default:
		command_status(ogf, ocf, 0x01);
		break;
	}
}
开发者ID:intgr,项目名称:bluez,代码行数:27,代码来源:hciemu.c

示例8: command_status

bool CRedisClient::ltrim(const CString &key, int start, int stop)
{
	CString sStart, sStop;
	sStart.Format("%d", start);
	sStop.Format("%d", stop);
	return command_status("LTRIM %s %s %s", (LPCSTR)key, (LPCSTR)sStart, (LPCSTR)sStop);
}
开发者ID:promanz,项目名称:tuisong,代码行数:7,代码来源:redisClient.cpp

示例9: execute_and_command

void 
execute_and_command(command_t c)
{
	command_t left = c->u.command[0];
	command_t right = c->u.command[1];
	execute_command(left, 0);//recursively call the execute command
	if(command_status(left) == 0)
	{
		execute_command(right,0);
		c->status = command_status(right);
	}
	else//the left command is not runned successfully
	{
		//there is no need to execute the right command
		c->status = command_status(left);
	}
}
开发者ID:summerxuan,项目名称:cs111,代码行数:17,代码来源:execute-command_PIPE.c

示例10: main

int
main (int argc, char **argv)
{
  int opt;
  int command_number = 1;
  int print_tree = 0;
  int time_travel = 0;
  program_name = argv[0];

  for (;;)
    switch (getopt (argc, argv, "pt"))
      {
      case 'p': print_tree = 1; break;
      case 't': time_travel = 1; break;
      default: usage (); break;
      case -1: goto options_exhausted;
      }
 options_exhausted:;

  // There must be exactly one file argument.
  if (optind != argc - 1)
    usage ();

  script_name = argv[optind];
  FILE *script_stream = fopen (script_name, "r");
  if (! script_stream)
  {
  return 0;
  //error (1, errno, "%s: cannot open", script_name);
  }
  command_stream_t command_stream =
    make_command_stream (get_next_byte, script_stream);

  command_t last_command = NULL;
  command_t command;
void execute_timeTravel(command_stream_t c);

	if(time_travel ==1)
	{ //execute in time travel mode 
	execute_timeTravel(command_stream);
	}
else{ //this means we are not in timetravel mode
  while ((command = read_command_stream (&command_stream)))
    {
      if (print_tree)
	{
	  printf ("# %d\n", command_number++);
	  print_command (command);
	}
      else
	{
	  last_command = command;
	  execute_command (command);
	}
    }
} //close the else statement
  return print_tree || !last_command ? 0 : command_status (last_command);
}
开发者ID:hackiaveli,项目名称:projects,代码行数:58,代码来源:main.c

示例11: main

int
main (int argc, char **argv)
{
  int opt;
  int command_number = 1;
  int print_tree = 0;
  int time_travel = 0;
  program_name = argv[0];

  for (;;)
    switch (getopt (argc, argv, "pt"))
      {
      case 'p': print_tree = 1; break;
      case 't': time_travel = 1; break;
      default: usage (); break;
      case -1: goto options_exhausted;
      }
 options_exhausted:;

  // There must be exactly one file argument.
  if (optind != argc - 1)
    usage ();

  script_name = argv[optind];
  FILE *script_stream = fopen (script_name, "r");
  if (! script_stream)
    error (1, errno, "%s: cannot open", script_name);
  command_stream_t command_stream =
    make_command_stream (get_next_byte, script_stream);





  command_t last_command = NULL;
  command_t command;
  if (!time_travel){
    while ((command = read_command_stream (command_stream)))
      {
        if (print_tree)
	  {
	    printf ("# %d\n", command_number++);
	    print_command (command);
	  }
        else
	  {
	    last_command = command;
	    execute_command (command, time_travel);
	  }
      }
  }
  else{
    parallel_execute (command_stream);
  }

  return print_tree || !last_command ? 0 : command_status (last_command);
}
开发者ID:sweetbasil,项目名称:CS111,代码行数:57,代码来源:main.c

示例12: hci_link_policy

static void hci_link_policy(uint16_t ocf, int plen, uint8_t *data)
{
	const uint16_t ogf = OGF_INFO_PARAM;

	switch (ocf) {
	default:
		command_status(ogf, ocf, 0x01);
		break;
	}
}
开发者ID:intgr,项目名称:bluez,代码行数:10,代码来源:hciemu.c

示例13: main

int
main (int argc, char **argv)
{
    int command_number = 1;
    bool print_tree = false;
    char const *profile_name = 0;
    program_name = argv[0];
    
    for (;;)
    switch (getopt (argc, argv, "p:t"))
    {
        case 'p': profile_name = optarg; break;
        case 't': print_tree = true; break;
        default: usage (); break;
        case -1: goto options_exhausted;
    }
    options_exhausted:;
    
    // There must be exactly one file argument.
    if (optind != argc - 1)
    usage ();
    
    script_name = argv[optind];
    FILE *script_stream = fopen (script_name, "r");
    if (! script_stream)
    error (1, errno, "%s: cannot open", script_name);
    command_stream_t command_stream =
    make_command_stream (get_next_byte, script_stream);
    int profiling = -1;
    if (profile_name)
    {
        profiling = prepare_profiling (profile_name);
        if (profiling < 0)
        error (1, errno, "%s: cannot open", profile_name);
    }
    
    command_t last_command = NULL;
    command_t command;
    while ((command = read_command_stream (command_stream)))
    {
        if (print_tree)
        {
            printf ("# %dn", command_number++);
            print_command (command);
        }
        else
        {
            last_command = command;
            execute_command (command, profiling);
        }
    }
    
    return print_tree || !last_command ? 0 : command_status (last_command);
}
开发者ID:ishan8,项目名称:Profiling-Shell,代码行数:54,代码来源:main.c

示例14: SETDEFAULTIOTYPE

bool xRedisClient::mset(const DBIArray& vdbi, const VDATA& vData) {
    DBIArray::const_iterator iter_dbi = vdbi.begin();
    VDATA::const_iterator iter_data = vData.begin();
    for (; iter_data != vData.end(); iter_dbi++) {
        const string &key = (*iter_data++);
        const string &value = (*iter_data++);
        const RedisDBIdx& dbi = *iter_dbi;
        SETDEFAULTIOTYPE(SLAVE);
        command_status(dbi, "SET %s %s", key.c_str(), value.c_str());
    }
    return true;
}
开发者ID:HelloLittleJoey,项目名称:xredis,代码行数:12,代码来源:xRedisClient_strings.cpp

示例15: execute_graph

void
execute_graph(int** graph, command_stream_t stream, int N)
{
  int i,j,n = 0, m, np = N;
  while (graph[n]) n++;

  command_t* command_stream = malloc(sizeof(command_t)*n);
  int count = 0, status;
  while(count < n)
      command_stream[count++] = read_command_stream(stream);

  int *executed = malloc(sizeof(int)*n);

  for (i = 0; i<n; i++)
    executed[i] = 0;
  m = n;
  while (m > 0)
    {
      for (i = 0; i < n; i++)
	if (!executed[i])
	  {
	    int dependency = 0;
	    for (j = 0; j < n; j++)
	      if (graph[i][j]) dependency = 1;
	    if (!dependency)
	      {
		if (np == 0) // if the limit of subprocesses is met 
		  {
		    waitpid(WAIT_ANY, &status, WUNTRACED); // wait for any child to return
		    if (errno == EINTR || errno == EINVAL) perror("waitpid");
		    np = 1;
		  } // the check is put right before forking, so that the efficiency is maximized.
		m--; np--;
		executed[i] = 1;
		pid_t pid = fork();
		if (!pid)
		  {/* child process execute the command */
		    execute_command(command_stream[i], 0);
		    for (j = 0; j < n; j++)
		      graph[j][i] = 0;
		    exit(command_status(command_stream[i]));
		  }
	      }
	  }
    }
 
  while (waitpid(WAIT_ANY, &status, WUNTRACED))
     { 
       if (errno == ECHILD) break; 
       if (errno == EINTR || errno == EINVAL) perror("waitpid");
     }
}
开发者ID:Rekoz,项目名称:CS111-Operating_Systems_Principles,代码行数:52,代码来源:execute-command.c


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