示例#1
0
int		part2(char *dir_path, char *prenom, t_individu **individu)
{
  t_individu	*temp;

  temp = *individu;
  while (temp)
    {
      if (strcmp(temp->prenom, prenom) == 0)
	{
	  printf("%s %s\n", prenom, last_name(dir_path));
	  printf("né le %i %s %i (%i)\n", get_day(temp->date),
		 get_month(temp->date), atoi(&temp->date[6]), temp->cp);
	  if (temp->sexe == 0)
	    printf("de sexe masculin\n");
	  else
	    printf("de sexe feminin\n");
	  printf("%i %s%c%c %i %i\n", temp->sexe + 1, &temp->date[8], temp->date[3],
		 temp->date[4], temp->cp, temp->secu);
	  printf("%s", temp->cv);
	  return (0);
	}
      temp = temp->next;
    }
  fprintf(stderr, "Erreur: Il n'y a pas de %s dans la famille %s!\n",
	  prenom, last_name(dir_path));
  return (1);
}
示例#2
0
DataFrame human_parse::parse_vector(std::vector < std::string > names){
  
  // Measure and construct output
  unsigned int input_size = names.size();
  std::vector < std::string > salutation(input_size);
  std::vector < std::string > first_name(input_size);
  std::vector < std::string > middle_name(input_size);
  std::vector < std::string > last_name(input_size);
  std::vector < std::string > suffix(input_size);
  std::vector < std::string > holding(5);
  
  // For each element, go nuts
  for(unsigned int i = 0; i < input_size; i++){
    if((i % 10000) == 0){
      Rcpp::checkUserInterrupt();
    }
    
    holding = parse_single(names[i]);
    salutation[i] = holding[0];
    first_name[i] = holding[1];
    middle_name[i] = holding[2];
    last_name[i] = holding[3];
    suffix[i] = holding[4];

  }
  
  return DataFrame::create(_["salutation"] = salutation,
                           _["first_name"] = first_name,
                           _["middle_name"] = middle_name,
                           _["last_name"] = last_name,
                           _["suffix"] = suffix,
                           _["full_name"] = names,
                           _["stringsAsFactors"] = false);
}
示例#3
0
bool g_filesystem::discover_absolute_path(g_thread* requester, char* absolute_path, g_fs_transaction_handler_discovery* handler, bool follow_symlinks) {

	// check if this node is already discovered
	g_fs_node* parent = 0;
	g_fs_node* child = 0;
	g_local<char> last_name(new char[G_PATH_MAX]);
	g_filesystem::find_existing(absolute_path, &parent, &child, last_name(), follow_symlinks);

	// if the node already exists, tell the handler that discovery was successful
	if (child) {
		handler->status = G_FS_DISCOVERY_SUCCESSFUL;
		handler->node = child;
		handler->all_nodes_discovered = true;
		handler->finish_transaction(requester, child->get_delegate());

	} else {
		// otherwise, request the driver delegate to discover it and set to sleep
		g_fs_delegate* delegate = parent->get_delegate();
		if (delegate) {
			g_fs_transaction_id transaction = delegate->request_discovery(requester, parent, last_name(), handler);
			requester->wait(new g_waiter_fs_transaction(handler, transaction, delegate));
			return false;
		}

		// if no driver delegate, error
		if (parent == root) {
			g_log_warn("%! mountpoint for '%s' does not exist", "filesystem", absolute_path);
		} else {
			g_log_warn("%! discovery of '%s' failed due to missing delegate on node %i", "filesystem", absolute_path, parent->id);
		}
		handler->status = G_FS_DISCOVERY_ERROR;
		handler->all_nodes_discovered = true;
		handler->finish_transaction(requester, 0);
	}

	return true;
}
示例#4
0
DataFrame human_parse::parse_vector(CharacterVector names){
  
  // Measure and construct output
  unsigned int input_size = names.size();
  CharacterVector salutation(input_size);
  CharacterVector first_name(input_size);
  CharacterVector middle_name(input_size);
  CharacterVector last_name(input_size);
  CharacterVector suffix(input_size);
  CharacterVector holding(5);
  
  // For each element, go nuts
  for(unsigned int i = 0; i < input_size; i++){
    if((i % 10000) == 0){
      Rcpp::checkUserInterrupt();
    }
    
    if(names[i] == NA_STRING){
      salutation[i] = NA_STRING;
      first_name[i] = NA_STRING;
      middle_name[i] = NA_STRING;
      last_name[i] = NA_STRING;
      suffix[i] = NA_STRING;
    } else {
      holding = parse_single(Rcpp::as<std::string>(names[i]));
      salutation[i] = holding[0];
      first_name[i] = holding[1];
      middle_name[i] = holding[2];
      last_name[i] = holding[3];
      suffix[i] = holding[4];
    }


  }
  
  return DataFrame::create(_["salutation"] = salutation,
                           _["first_name"] = first_name,
                           _["middle_name"] = middle_name,
                           _["last_name"] = last_name,
                           _["suffix"] = suffix,
                           _["full_name"] = names,
                           _["stringsAsFactors"] = false);
}