您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ u_printf函数代码示例

51自学网 2021-06-03 09:03:23
  C++
这篇教程C++ u_printf函数代码示例写得很实用,希望能帮到您。

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

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

示例1: analyse_word_list

//// this function reads words in the word file and try analyse them//void analyse_word_list(Dictionary* d,			       U_FILE* words,			       U_FILE* result,			       U_FILE* debug,			       U_FILE* new_unknown_words,			       const Alphabet* alph,			       const bool* prefix,const bool* suffix,			       struct utags UTAG,			       vector_ptr* rules,			       vector_ptr* entries){  u_printf("Analysing russian unknown words.../n");  int n=0;  int words_done = 0;  Ustring* s=new_Ustring(MAX_WORD_LENGTH);  while (EOF!=readline(s,words)) {    if (!analyse_word(s->str,d,debug,result,prefix,suffix,alph,UTAG,rules,entries)) {      // if the analysis has failed, we store the word in the new unknown word file      u_fprintf(new_unknown_words,"%S/n",s->str);    } else {      n++;    }    if ( (++words_done % 10000) == 0)      u_printf("%d words done", words_done);  }  free_Ustring(s);  u_printf("%d words decomposed as compound words/n",n);}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:31,


示例2: hfsys_event_callback

static int hfsys_event_callback( uint32_t event_id,void * param){	switch(event_id)	{		case HFE_WIFI_STA_CONNECTED:			u_printf("wifi sta connected!!/n");			break;		case HFE_WIFI_STA_DISCONNECTED:			u_printf("wifi sta disconnected!!/n");			break;		case HFE_DHCP_OK:		{			uint32_t *p_ip;			p_ip = (uint32_t*)param;			u_printf("dhcp ok %08X!/n",*p_ip);		}			break;		case HFE_SMTLK_OK:			u_printf("smtlk ok!/n");			return -1;			break;		case HFE_CONFIG_RELOAD:			u_printf("reload!/n");			break;		default:			break;	}	return 0;}
开发者ID:greatlevi,项目名称:YD_SHUANGFA,代码行数:29,


示例3: do_extract_from_opened_pack_archive_onefile

int do_extract_from_opened_pack_archive_onefile(    unzFile uf,    const char* filename,    int opt_extract_without_path,    const char* prefix_extracting_name,    int transform_path_separator, int quiet){    int iCaseSensitivity = 1;    if (unzLocateFile(uf,filename,iCaseSensitivity)!=UNZ_OK)    {        u_printf("file %s not found in the zipfile/n",filename);        return 2;    }    if (is_last_char_path_separator(prefix_extracting_name))    {        if (quiet == 0)            u_printf("Creating extracting directory: %s/n",prefix_extracting_name);        mkDirPortable(prefix_extracting_name);    }    if (do_extract_from_opened_pack_archive_currentfile(uf,&opt_extract_without_path,prefix_extracting_name,transform_path_separator,quiet) == UNZ_OK)        return 0;    else        return 1;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:27,


示例4: minimize_tree

/** * This function takes a dictionary tree and minimizes it using * Dominique Revuz's algorithm. 'used_inf_values' is used to mark * INF codes that are actually used in the .bin. */void minimize_tree(struct dictionary_node* root,struct bit_array* used_inf_values,Abstract_allocator prv_alloc) {u_printf("Minimizing...                      /n");struct transition_list** transitions_by_height;struct dictionary_node_transition** transitions;//init_minimize_arrays(&transitions_by_height,&transitions);init_minimize_arrays_transition_list(&transitions_by_height);unsigned int H=sort_by_height(root,transitions_by_height,used_inf_values,prv_alloc);unsigned int nb=0;for (unsigned int k1=0;k1<=H;k1++) {	unsigned int nbcur = convert_list_to_array_size(k1,transitions_by_height);	if (nbcur>nb) {		nb = nbcur;	}}init_minimize_arrays_dictionary_node_transition(&transitions,nb);float z;for (unsigned int k=0;k<=H;k++) {   int size=convert_list_to_array(k,transitions_by_height,transitions,nb,prv_alloc);   for (int l=0;l<size;l++) {	   check_nodes(transitions[l]);   }   quicksort(0,size-1,transitions);   merge(size,transitions,prv_alloc);   z=(float)(100.0*(float)(k)/(float)H);   if (z>100.0) z=(float)100.0;   u_printf("%2.0f%% completed...    /r",z);}u_printf("Minimization done.                     /n");free_minimize_arrays(transitions_by_height,transitions);}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:39,


示例5: usage_scores

static void usage_scores() {  display_copyright_notice();  u_printf(      "Usage: SpellCheck [OPTIONS] <dic1> [<dic2> <dic3> ...]/n"      "/n"      "The --scores=XXX option allows you to specify a score for each of the/n"      "%d supported kinds of error. XXX must be made of %d comma-separated integer/n"      "values which respectively mean the following:/n"      "- letter duplication:              devil   => devvil/n"      "- any other letter insertion:      devil   => degvil/n"      "- double letter simplification:    battle  => batle/n"      "- any other letter omission:       battle  => bttle/n"      "- letter inversion:                happy   => ahppy/n"      "- diacritic error:                 %Ctaient => etaient/n"      "- case error:                      London  => london/n"      "- letter close on keyboard:        battle  => bzttle/n"      "- any other letter change:         battle  => blttle/n"      "/n"      "Each hypothesis is given the sum of its errors' scores. The lower/n"      "the score, the better the hypothesis. Default values are:/n"      "--scores=%d",N_SPSubOp,N_SPSubOp,0xE9,default_scores[0]);  for (int i=1;i<N_SPSubOp;i++) {    u_printf(",%d",default_scores[i]);  }  u_printf("/n/n");}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:26,


示例6: sort_thai

/** * Reads all the Thai lines and put them in a sorted tree, then saves them * exploring the tree. */void sort_thai(struct sort_infos* inf) {  u_printf("Loading text.../n");  while (read_line_thai(inf)) {  }  u_printf("%d lines read/n", inf->number_of_lines);  save(inf);}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:11,


示例7: analyse_word_list

//// this function reads words in the word file and try analyse them//void analyse_word_list(const unsigned char* tableau_bin,			       const struct INF_codes* inf,			       U_FILE* words,			       U_FILE* result,			       U_FILE* debug,			       U_FILE* new_unknown_words,			       const Alphabet* alph,			       const bool* prefix,const bool* suffix,			       struct utags UTAG,			       vector_ptr* rules,			       vector_ptr* entries){  unichar s[MAX_WORD_LENGTH];  u_printf("Analysing russian unknown words.../n");  int n=0;  int words_done = 0;  while (EOF!=u_fgets_limit2(s,MAX_WORD_LENGTH,words)) {    if (!analyse_word(s,tableau_bin,debug,result,inf,prefix,suffix,alph,UTAG,rules,entries)) {      // if the analysis has failed, we store the word in the new unknown word file      u_fprintf(new_unknown_words,"%S/n",s);    } else {      n++;    }    if ( (++words_done % 10000) == 0)      u_printf("%d words done", words_done);  }  u_printf("%d words decomposed as compound words/n",n);}
开发者ID:adri87,项目名称:Q-A,代码行数:31,


示例8: app_main

int USER_FUNC app_main (void){	time_t now=time(NULL);		u_printf("[CALLBACK DEMO]sdk version(%s),the app_main start time is %d %s/n",hfsys_get_sdk_version(),now,ctime(&now));		if(hfsys_register_system_event((hfsys_event_callback_t)hfsys_event_callback)!=HF_SUCCESS)	{		u_printf("register system event fail/n");	}		if(hfgpio_fmap_check()!=0)	{		while(1)		{			HF_Debug(DEBUG_ERROR,"gpio map file error/n");			msleep(1000);		}		return 0;	}		show_reset_reason();		while(!hfnet_wifi_is_active())	{		msleep(50);	}		//if(hfnet_start_assis(ASSIS_PORT)!=HF_SUCCESS)	if(hfnet_start_assis_ex(ASSIS_PORT,(hfnet_callback_t)assis_ex_recv_callback)!=HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start httpd fail/n");	}		if(hfnet_start_httpd(HFTHREAD_PRIORITIES_MID)!=HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start httpd fail/n");	}	if(hfnet_start_uart(HFTHREAD_PRIORITIES_LOW,(hfnet_callback_t)uart_recv_callback)!=HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start uart fail!/n");	}	if(hfnet_start_socketa(HFTHREAD_PRIORITIES_LOW,(hfnet_callback_t)socketa_recv_callback)!=HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start socketa fail/n");	}	if(hfnet_start_socketb(HFTHREAD_PRIORITIES_LOW,(hfnet_callback_t)socketb_recv_callback)!=HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start socketb fail/n");	}		//创建一个自动定时器,每1s钟触发一次。	if((hnlink_timer = hftimer_create("NLINK-FALSH-TIMER",1000,true,1,nlink_falsh_timer_callback,0))==NULL)	{		u_printf("create timer fail/n");	}		return 1;}
开发者ID:mys812,项目名称:hf,代码行数:59,


示例9: u_print_unitab

///////////////////////////////////////////////////////////////////////////// Print the contents of a table of unicode strings to the standard output.void u_print_unitab(unitab_t tab) {   int i;   u_printf("/n");   for (i=0; i<tab.n; i++) {      u_printf("%S ", tab.t[i]);   }   u_printf("/n");}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:10,


示例10: display_list_ustring

void display_list_ustring(const struct list_ustring *l){	u_printf("list_ustring = ");	while(l!=NULL){		u_printf("%S",l->string);		l=l->next;	}	u_printf("/n");}
开发者ID:adri87,项目名称:Q-A,代码行数:8,


示例11: main

int main(int argc, char* argv[]){    char *a = NULL;    u_printf("We will try to access NULL");    *a = 'D';    u_printf("%c", a);    return 0;}
开发者ID:Bhavya6187,项目名称:sbunix,代码行数:8,


示例12: wifi_scan

void wifi_scan(void *arg){	while(1)	{		u_printf("ssid,auth,encry,channel,rssi,mac/r/n/r/n");		hfwifi_scan(hfwifi_scan_test);		u_printf("/r/n/r/n********************/r/n/r/n");		msleep(30000);	}}
开发者ID:greatlevi,项目名称:YD_SHUANGFA,代码行数:10,


示例13: socketb_recv_callback

static int USER_FUNC socketb_recv_callback(uint32_t event,char *data,uint32_t len,uint32_t buf_len){	if(event==HFNET_SOCKETB_DATA_READY)		HF_Debug(DEBUG_LEVEL_LOW,"socketb recv %d bytes data %d/n",len,buf_len);	else if(event==HFNET_SOCKETB_CONNECTED)		u_printf("socket b connected!/n");	else if(event==HFNET_SOCKETB_DISCONNECTED)		u_printf("socket b disconnected!/n");				return len;}
开发者ID:greatlevi,项目名称:YD_SHUANGFA,代码行数:11,


示例14: unif_print_vars

////////////////////////////////////////////// Prints the set of instantiations. int unif_print_vars(MultiFlex_ctx* p_multiFlex_ctx) {int v;int i;u_printf("INSTANTIATION VARIABLES:/n");for (v=0;v<(p_multiFlex_ctx->UNIF_VARS).no_vars;v++) {    u_printf("%S:%S=",(p_multiFlex_ctx->UNIF_VARS).vars[v].id,(p_multiFlex_ctx->UNIF_VARS).vars[v].cat->name);    i=(p_multiFlex_ctx->UNIF_VARS).vars[v].val;    u_printf("%S/n",(p_multiFlex_ctx->UNIF_VARS).vars[v].cat->values[i]);}return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:13,


示例15: unif_print_vars

////////////////////////////////////////////// Prints the set of instantiations. int unif_print_vars(unif_vars_T* UNIF_VARS) {int v;int i;u_printf("INSTANTIATION VARIABLES:/n");for (v=0;v<UNIF_VARS->no_vars;v++) {    u_printf("%S:%S=",UNIF_VARS->vars[v].id,UNIF_VARS->vars[v].cat->name);    i=UNIF_VARS->vars[v].val;    u_printf("%S/n",UNIF_VARS->vars[v].cat->values[i]);}return 0;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:13,


示例16: do_extract_from_opened_pack_archive

int do_extract_from_opened_pack_archive(    unzFile uf,    int opt_extract_without_path,    const char* prefix_extracting_name,    int transform_path_separator, int quiet){    uLong i;    unz_global_info gi;    int err;    int retValue = 0;    err = unzGetGlobalInfo(uf,&gi);    if (err!=UNZ_OK)    {        u_printf("error %d with zipfile in unzGetGlobalInfo /n",err);        return 1;    }    if (gi.number_entry != 0)    {        err = unzGoToFirstFile(uf);        if (err!=UNZ_OK)        {            u_printf("error %d with zipfile in unzGetGlobalInfo /n",err);            return 1;        }    }    if (is_last_char_path_separator(prefix_extracting_name))    {        if (quiet == 0)            u_printf("Creating extracting directory: %s/n",prefix_extracting_name);        mkDirPortable(prefix_extracting_name);    }    for (i=0;i<gi.number_entry;i++)    {        if (do_extract_from_opened_pack_archive_currentfile(uf,&opt_extract_without_path,prefix_extracting_name,transform_path_separator,quiet) != UNZ_OK)            break;        if ((i+1)<gi.number_entry)        {            err = unzGoToNextFile(uf);            if (err!=UNZ_OK)            {                u_printf("error %d with zipfile in unzGoToNextFile/n",err);                retValue = 1;            }        }    }    return retValue;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:53,


示例17: analyse_german_word_list

//// this function reads words in the word file and try analyse them//void analyse_german_word_list(const unsigned char* bin,const struct INF_codes* inf,                              U_FILE* words,U_FILE* result,U_FILE* debug,U_FILE* new_unknown_words,                              const char* left,const char* right,const Alphabet* alphabet) {unichar s[1000];u_printf("Analysing german unknown words.../n");int n=0;while (EOF!=u_fgets_limit2(s,1000,words)) {  if (!analyse_german_word(s,debug,result,left,right,inf,alphabet,bin)) {     // if the analysis has failed, we store the word in the new unknown word file     u_fprintf(new_unknown_words,"%S/n",s);  } else {n++;}}u_printf("%d words decomposed as compound words/n",n);}
开发者ID:adri87,项目名称:Q-A,代码行数:17,


示例18: test_uflash_start

USER_FUNC void test_uflash_start(void){	uint32_t i;	uint32_t value;	int pages;		hfuflash_erase_page(0,1);	for(i=0;i<HFFLASH_PAGE_SIZE;)	{		if(hfuflash_write(i,(char*)&i,sizeof(i))<sizeof(i))		{			u_printf("uflash eof/n");			break;		}		i+=sizeof(i);	}		for(i=0;i<HFFLASH_PAGE_SIZE;)	{		if(hfuflash_read(i,(char*)&value,4)<4)		{			u_printf("uflash eof/n");			break;		}		u_printf("%d/n",value);		i+=4;	}	pages = (HFUFLASH_SIZE+HFUFLASH1_SIZE)/HFFLASH_PAGE_SIZE;	for(i=0;i<pages;i++)	{		u_printf("erase test %d/n",i);		msleep(1000);		if(hfuflash_erase_page(i*HFFLASH_PAGE_SIZE,pages-i)!=HF_SUCCESS)		{			u_printf("test erase fail!/n");			return ;		}	}		for(i=0;i<HFUFLASH_SIZE+HFUFLASH1_SIZE;)	{		if(hfuflash_write(i,(char*)&i,sizeof(i))<sizeof(i))		{			u_printf("uflash eof/n");			break;		}		if(hfuflash_read(i,(char*)&value,4)<4)		{			u_printf("uflash eof/n");			break;		}		if(value!=i)		{			u_printf("test fail %d %d/n",i,value);		}		i+=sizeof(i);	}	}
开发者ID:mys812,项目名称:hf,代码行数:59,


示例19: parse_text

void parse_text(struct fst2txt_parameters* p) {fill_buffer(p->text_buffer,p->f_input);int debut=p->fst2->initial_states[1];p->variables=new_Variables(p->fst2->input_variables);int n_blocks=0;u_printf("Block %d",n_blocks);int within_tag=0;while (p->current_origin<p->text_buffer->size) {      if (!p->text_buffer->end_of_file          && p->current_origin>(p->text_buffer->size-MINIMAL_SIZE_PRELOADED_TEXT)) {         /* If must change of block, we update the absolute offset, and we fill the          * buffer. */         p->absolute_offset=p->absolute_offset+p->current_origin;         fill_buffer(p->text_buffer,p->current_origin,p->f_input);         p->current_origin=0;         n_blocks++;         u_printf("/rBlock %d        ",n_blocks);      }      p->output[0]='/0';      empty(p->stack);      p->input_length=0;      //memset(p->buffer,0,p->current_origin);      if (p->buffer[p->current_origin]=='{') {         within_tag=1;      } else if (p->buffer[p->current_origin]=='}') {         within_tag=0;      } else if (!within_tag && (p->buffer[p->current_origin]!=' ' || p->space_policy==START_WITH_SPACE)) {         // we don't start a match on a space        unichar mot_token_buffer[MOT_BUFFER_TOKEN_SIZE];        scan_graph(0,debut,0,0,NULL,mot_token_buffer,p);      }      u_fprintf(p->f_output,"%S",p->output);      if (p->input_length==0) {         // if no input was read, we go on         u_fputc(p->buffer[p->current_origin],p->f_output);         (p->current_origin)++;      }      else {           // we increase current_origin           p->current_origin=p->current_origin+p->input_length;      }}u_printf("/r                           /n");free_Variables(p->variables);p->variables=NULL;}
开发者ID:adri87,项目名称:Q-A,代码行数:49,


示例20: app_tcp_connect_callback

static tcp_socket_connect_callback_t app_tcp_connect_callback(NETSOCKET socket){	u_printf("socket %d connected/n", socket);	g_tcp_connect_flag = 3;	hfnet_tcp_send(socket, "GET / HTTP/1.1/r/n/r/n", strlen("GET / HTTP/1.1/r/n/r/n"));}
开发者ID:sdhczw,项目名称:HF_LPB120_220,代码行数:7,


示例21: load_tagset

/** * This function loads the given tagset file and returns the corresponding tagset_t * structure. */tagset_t* load_tagset(U_FILE* f) {unichar buf[MAXBUF];token_t* toks=NULL;/* First, we read the language name */while (toks==NULL) {   if ((u_fgets(buf,MAXBUF,f)) == EOF) {      error("Tagset definition file is empty/n");      return NULL;   }   line_cleanup(buf);   toks=tokenize(buf);}if (toks->type!=TOK_NAME || toks->next==NULL || toks->next->str==NULL) {   fatal_error("Tagset language needs a name/n");}tagset_t* tagset=new_tagset_t(toks->next->str);int nb=0;pos_section_t* pos;while ((pos=parse_pos_section(f))!=NULL) {   pos->next=tagset->pos_sections;   tagset->pos_sections=pos;   nb++;}free_token_t(toks);u_printf("%d POS definitions loaded./n",nb);return tagset;}
开发者ID:adri87,项目名称:Q-A,代码行数:31,


示例22: soft_reset

void soft_reset(void){	u_printf(INFO,"system well reset /r/n");	NVIC_SystemReset();  	__DSB();  	while (1);}
开发者ID:joyceandpig,项目名称:STM32_USB_MASS,代码行数:7,


示例23: check_valid_INF_lines

void check_valid_INF_lines(const unichar* t, bool* tableau, const struct INF_codes* inf){  u_printf("Check valid %S components.../n",t);  for (int i=0;i<inf->N;i++) {    tableau[i] = check_is_valid_for_an_INF_line(t, inf->codes[i]);  }}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:7,


示例24: app_main

int USER_FUNC  app_main(void){	u_printf("/n%s Start %s %s/n/n",g_hfm_name[__HF_MODULE_ID__],__DATE__,__TIME__);	if(hfnet_start_assis(ASSIS_PORT) != HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start httpd fail/n");	}#ifdef SUPPORT_UART_THROUGH	if(hfnet_start_socketa(0,NULL) != HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start socketa fail/n");	}		if(hfnet_start_socketb(1,NULL) != HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start socketb fail/n");	}	if(hfnet_start_uart_ex(0,NULL,4096) != HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start uart fail!/n");	}#else	if(hfnet_start_uart_ex(0,NULL,1024) != HF_SUCCESS)	{		HF_Debug(DEBUG_WARN,"start uart fail!/n");	}#endif	return 1;}
开发者ID:sdhczw,项目名称:HF_LPB120_220,代码行数:32,


示例25: NMI_Handler

/**  * @brief  This function handles NMI exception.  * @param  None  * @retval None  */void NMI_Handler(void){//	u_printf(ERR_FUN,"");	while(1)	{		u_printf(ERR_FUN,"");	}}
开发者ID:joyceandpig,项目名称:STM32_USB_MASS,代码行数:13,


示例26: analyse_norwegian_unknown_words

/** * This function reads words from the unknown word file and tries to * analyse them. The unknown word file is supposed to contain one word * per line. If a word cannot be analyzed, we print it to the new * unknown word list file. */void analyse_norwegian_unknown_words(struct norwegian_infos* infos) {unichar line[10000];u_printf("Analysing norwegian unknown words.../n");int n=0;/* We read each line of the unknown word list and we try to analyze it */while (EOF!=u_fgets_limit2(line,10000,infos->unknown_word_list)) {  if (!analyse_norwegian_word(line,infos)) {     /* If the analysis has failed, we store the word in the      * new unknown word file */     u_fprintf(infos->new_unknown_word_list,"%S/n",line);  } else {  		/* Otherwise, we increase the number of analyzed words */  		n++;  	}}u_printf("%d words decomposed as compound words/n",n);}
开发者ID:adri87,项目名称:Q-A,代码行数:23,


示例27: DebugMon_Handler

/**  * @brief  This function handles Debug Monitor exception.  * @param  None  * @retval None  */void DebugMon_Handler(void){//	u_printf(ERR_FUN,"");	while(1)	{		u_printf(ERR_FUN,"");	}}
开发者ID:joyceandpig,项目名称:STM32_USB_MASS,代码行数:13,


示例28: main_fst2txt

int main_fst2txt(struct fst2txt_parameters* p) {    p->f_input=u_fopen_existing_versatile_encoding(p->mask_encoding_compatibility_input,p->text_file,U_READ);    if (p->f_input==NULL) {        error("Cannot open file %s/n",p->text_file);        return 1;    }    p->text_buffer=new_buffer_for_file(UNICHAR_BUFFER,p->f_input,CAPACITY_LIMIT);    p->buffer=p->text_buffer->unichar_buffer;    p->f_output=u_fopen_creating_versatile_encoding(p->encoding_output,p->bom_output,p->temp_file,U_WRITE);    if (p->f_output==NULL) {        error("Cannot open temporary file %s/n",p->temp_file);        u_fclose(p->f_input);        return 1;    }    p->fst2=load_abstract_fst2(p->fst_file,1,NULL);    if (p->fst2==NULL) {        error("Cannot load grammar %s/n",p->fst_file);        u_fclose(p->f_input);        u_fclose(p->f_output);        return 1;    }    if (p->alphabet_file!=NULL && p->alphabet_file[0]!='/0') {       p->alphabet=load_alphabet(p->alphabet_file);       if (p->alphabet==NULL) {          error("Cannot load alphabet file %s/n",p->alphabet_file);          u_fclose(p->f_input);          u_fclose(p->f_output);          free_abstract_Fst2(p->fst2,NULL);          return 1;       }    }    u_printf("Applying %s in %s mode.../n",p->fst_file,(p->output_policy==MERGE_OUTPUTS)?"merge":"replace");    build_state_token_trees(p);    parse_text(p);    u_fclose(p->f_input);    u_fclose(p->f_output);    af_remove(p->text_file);    af_rename(p->temp_file,p->text_file);    u_printf("Done./n");    return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:46,


示例29: main_Reg2Grf

int main_Reg2Grf(int argc,char* const argv[]) {if (argc==1) {   usage();   return 0;}Encoding encoding_output = DEFAULT_ENCODING_OUTPUT;int bom_output = DEFAULT_BOM_OUTPUT;int mask_encoding_compatibility_input = DEFAULT_MASK_ENCODING_COMPATIBILITY_INPUT;int val,index=-1;struct OptVars* vars=new_OptVars();while (EOF!=(val=getopt_long_TS(argc,argv,optstring_Reg2Grf,lopts_Reg2Grf,&index,vars))) {   switch(val) {   case 'k': if (vars->optarg[0]=='/0') {                fatal_error("Empty input_encoding argument/n");             }             decode_reading_encoding_parameter(&mask_encoding_compatibility_input,vars->optarg);             break;   case 'q': if (vars->optarg[0]=='/0') {                fatal_error("Empty output_encoding argument/n");             }             decode_writing_encoding_parameter(&encoding_output,&bom_output,vars->optarg);             break;   case 'h': usage(); return 0;   case ':': if (index==-1) fatal_error("Missing argument for option -%c/n",vars->optopt);             else fatal_error("Missing argument for option --%s/n",lopts_Reg2Grf[index].name);   case '?': if (index==-1) fatal_error("Invalid option -%c/n",vars->optopt);             else fatal_error("Invalid option --%s/n",vars->optarg);             break;   }   index=-1;}if (vars->optind!=argc-1) {   fatal_error("Invalid arguments: rerun with --help/n");}U_FILE* f=u_fopen_existing_versatile_encoding(mask_encoding_compatibility_input,argv[vars->optind],U_READ);if (f==NULL) {   fatal_error("Cannot open file %s/n",argv[vars->optind]);}/* We read the regular expression in the file */unichar exp[REG_EXP_MAX_LENGTH];if ((REG_EXP_MAX_LENGTH-1)==u_fgets(exp,REG_EXP_MAX_LENGTH,f)) {   fatal_error("Too long regular expression/n");}u_fclose(f);char grf_name[FILENAME_MAX];get_path(argv[vars->optind],grf_name);strcat(grf_name,"regexp.grf");if (!reg2grf(exp,grf_name,encoding_output,bom_output)) {   return 1;}free_OptVars(vars);u_printf("Expression converted./n");return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:58,


示例30: DLC_print_unit

/////////////////////////////////////////////////////////////////////////////////// Prints single unit into a DELAC file.// If 'unit' void returns 1, if memory allocation problem returns -1, 0 otherwise.int DLC_print_unit(struct l_morpho_t* pL_MORPHO,SU_id_T* unit) {	if (unit == NULL)		return 1;	u_printf("%S", unit->form);	if (unit->lemma) {		u_printf("(%S.%s", unit->lemma->unit, unit->lemma->paradigm);		if (unit->feat) {			unichar* tmp;			tmp = d_get_str_feat(pL_MORPHO,unit->feat);			if (tmp == NULL)				return -1;			u_printf(":%S", tmp);			free(tmp);		}		u_printf(")");	}	return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:21,



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


C++ u_strToUTF8函数代码示例
C++ u_minify函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。