コード例 #1
0
ファイル: graph_engine.c プロジェクト: jimiszm/peos
void handle_selection(Node n)
{
    int i,j;
    Node parent;
    Node child;
 
    if ((n -> predecessors == NULL) || (MARKED_3(n) == TRUE))
        return;
		                                                                         
    MARKED_3(n) = TRUE;
 
    for(i = 0; i < ListSize(n -> predecessors); i++) {
        parent = (Node) ListIndex(n -> predecessors,i);
        if ((parent -> type) == SELECTION) {
            for(j=0; j < ListSize(parent -> successors); j++) {
                child = (Node) ListIndex(parent -> successors,j);
                if (strcmp((child->name),n->name) != 0) {
                    mark_successors(child,ACT_NONE);
                }
	     }
	}
	if (ORDER(n) >  ORDER(parent))  
        handle_selection(parent);
    }
    return;
}
コード例 #2
0
void User_Interface::run_menu()
{
	int choice = 0;
	do
	{
		choice = menu_selection();
		handle_selection(choice);
	} while (choice != 8);
}
コード例 #3
0
ファイル: graph_engine.c プロジェクト: jimiszm/peos
int action_run(Graph g, char *act_name)
{
    int error;
    Node n;
    n = find_node(g, act_name);
    if (n != NULL) {
        set_node_state(n, ACT_RUN, &error); //only raise error when state is set to ready and done
	make_other_run_suspend(g, act_name);
	mark_iter_nodes(n);  /* handle iterations */
	handle_selection(n); /* handle selections */
	set_super_nodes_run(n); /*set super nodes to run */
        sanitize(g); /* sanitize the markers used */
    } else {
	return -1;
    }
    return 1;
}
コード例 #4
0
ファイル: main.c プロジェクト: foo-foo/epitech-projects
int		main(int ac, char **av)
{
  fd_set	set;
  t_fd		*fds;
  int		ret;

  fds = NULL;
  if (ac != 2)
    return (msg_error(EUSAGE, 0));
  if (signal(SIGINT, &handle_sigint) == SIG_ERR)
    return (msg_error(ESIGNAL, 1));
  if (create_server(atoi(av[1]), &fds) == EXIT_FAILURE)
    return (my_exit(fds, EXIT_FAILURE));
  while (!g_sigint)
    {
      ret = my_select(fds, &set);
      if (ret < 0)
	return (my_exit(fds, EXIT_FAILURE));
      if (ret > 0)
	if (handle_selection(fds, &set) == EXIT_FAILURE)
	  return (my_exit(fds, EXIT_FAILURE));
    }
  return (my_exit(fds, EXIT_SUCCESS));
}