这篇教程C++ u_fprintf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中u_fprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ u_fprintf函数的具体用法?C++ u_fprintf怎么用?C++ u_fprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了u_fprintf函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: hash_value/*** Tests whether a given input tag matches a given tag's stored regular expression.** @param[in] test The tag to be tested* @param[in] tag The tag to test against; only uses the hash and regexp members*/uint32_t GrammarApplicator::doesTagMatchRegexp(uint32_t test, const Tag& tag, bool bypass_index) { uint32_t match = 0; uint32_t ih = hash_value(tag.hash, test); if (!bypass_index && index_matches(index_regexp_no, ih)) { match = 0; } else if (!bypass_index && index_matches(index_regexp_yes, ih)) { match = test; } else { const Tag& itag = *(single_tags.find(test)->second); UErrorCode status = U_ZERO_ERROR; uregex_setText(tag.regexp, itag.tag.c_str(), static_cast<int32_t>(itag.tag.size()), &status); if (status != U_ZERO_ERROR) { u_fprintf(ux_stderr, "Error: uregex_setText(MatchSet) returned %s for tag %S before input line %u - cannot continue!/n", u_errorName(status), tag.tag.c_str(), numLines); CG3Quit(1); } status = U_ZERO_ERROR; if (uregex_find(tag.regexp, -1, &status)) { match = itag.hash; } if (status != U_ZERO_ERROR) { u_fprintf(ux_stderr, "Error: uregex_find(MatchSet) returned %s for tag %S before input line %u - cannot continue!/n", u_errorName(status), tag.tag.c_str(), numLines); CG3Quit(1); } if (match) { int32_t gc = uregex_groupCount(tag.regexp, &status); if (gc > 0 && regexgrps.second != 0) { UChar tmp[1024]; for (int i = 1; i <= gc; ++i) { tmp[0] = 0; int32_t len = uregex_group(tag.regexp, i, tmp, 1024, &status); regexgrps.second->resize(std::max(static_cast<size_t>(regexgrps.first) + 1, regexgrps.second->size())); UnicodeString& ucstr = (*regexgrps.second)[regexgrps.first]; ucstr.remove(); ucstr.append(tmp, len); ++regexgrps.first; } } else { index_regexp_yes.insert(ih); } } else { index_regexp_no.insert(ih); } } return match;}
开发者ID:TinoDidriksen,项目名称:cg3,代码行数:55,
示例2: TraitInsteadOfFound /** * This method gets called when a trait method conflict has been resolved * (an insteadof operation) * * @param const UnicodeString& namespace the fully qualified namespace of the class that was found * @param className name of the class that uses the trait * @param traitUsedClassName the class name of the trait to be used * @param traitMethodName name of the trait method that is to being resolved * @param insteadOfList the list of fully qualified trait names that are listed after the insteadof operator */ virtual void TraitInsteadOfFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& traitUsedClassName, const UnicodeString& traitMethodName, const std::vector<UnicodeString>& insteadOfList) { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Trait InsteadOf Found in class %.*S in namespace %.*S. Trait Class %.*S Trait Method %.*S /n", className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), traitUsedClassName.length(), traitUsedClassName.getBuffer(), traitMethodName.length(), traitMethodName.getBuffer() ); u_fprintf(ufout, "Instead of"); for (size_t i = 0; i < insteadOfList.size(); ++i) { u_fprintf(ufout, " %.*S", insteadOfList[i].length(), insteadOfList[i].getBuffer()); } u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:25,
示例3: print_node_valuestatic voidprint_node_value(OlyNodeValue nv, OlyTagType type){ switch ( type ) { case OLY_TAG_SCALAR_STRING: u_fprintf(u_stdout, "STRING: /"%.40S/"/n", nv.value.string_value); break; case OLY_TAG_SCALAR_FLOAT: printf("FLOAT: (%f)/n", nv.value.float_value); break; case OLY_TAG_SCALAR_INT: printf("INT: (%li)/n", nv.value.int_value); break; case OLY_TAG_COMPLEX_MAP: printf("MAP/n"); break; case OLY_TAG_COMPLEX_SEQUENCE: printf("SEQUENCE/n"); break; default: printf("UNKNOWN/n"); break; }}
开发者ID:theFlyRoper,项目名称:oly,代码行数:26,
示例4: resolve_condition_list/** * This function takes a condition list and checks if at least of the * conditions is verified, i.e. there is at least one path to match <E>. * It returns the modified condition list. If there is at least one modification, * then '*modification' is set to 1. See 'resolve_simple_condition' for * the values to be taken by '*matches_E'. */ConditionList resolve_condition_list(ConditionList l,Fst2State* states, int* initial_states,int *modification,int *matches_E,U_FILE*ferr) {ConditionList tmp;if (l==NULL) return NULL;if (l->condition==NULL) { error("NULL internal error in resolve_condition_list/n"); if (ferr != NULL) u_fprintf(ferr,"NULL internal error in resolve_condition_list/n"); return NULL;}l->condition=resolve_simple_condition(l->condition,states,initial_states,modification,matches_E);if (*matches_E==E_IS_MATCHED) { /* If condition is verified, then the graph matches <E>, so we return */ return l;}if (l->condition==NULL) { /* If we have removed the whole condition, we delete it and we * clean the rest of the condition list. */ tmp=l->next; free(l); return resolve_condition_list(tmp,states,initial_states,modification,matches_E,ferr);}/* Otherwise, we clean the rest of the condition list. */l->next=resolve_condition_list(l->next,states,initial_states,modification,matches_E,ferr);return l;}
开发者ID:adri87,项目名称:Q-A,代码行数:33,
示例5: mainint main(int argc, char** argv) { if (argc < 2) { printf("This program requires 1 argument: The path of the PHP file to parse./n"); return -1; } SampleObserver observer; pelet::ParserClass parser; parser.SetVersion(pelet::PHP_54); parser.SetClassObserver(&observer); parser.SetClassMemberObserver(&observer); parser.SetFunctionObserver(&observer); parser.SetVariableObserver(&observer); pelet::LintResultsClass results; bool parsed = parser.ScanFile(argv[1], results); if (parsed) { printf("Parsing complete./n"); } else { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Parse error: %S on line %d/n", results.Error.getTerminatedBuffer(), results.LineNumber); u_fclose(ufout); } // this is only used so that this program can be run through valgrind (memory leak // detector). In real-world usage, this include is not needed. u_cleanup(); return 0;}
开发者ID:robertop,项目名称:pelet,代码行数:29,
示例6: 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,
示例7: fst_file_out_open/** * Opens a .fst2 file in output mode and returns the associated fst_file_out_t * structure, or NULL in case of error. */Elag_fst_file_out* fst_file_out_open(const VersatileEncodingConfig* vec,const char* fname,int type) {Elag_fst_file_out* res=(Elag_fst_file_out*)malloc(sizeof(Elag_fst_file_out));if (res==NULL) { fatal_alloc_error("fst_file_out_open");}if (type<0 || type>=FST_BAD_TYPE) { fatal_error("fst_file_out_open: bad FST_TYPE/n");}if ((res->f=u_fopen(vec,fname,U_WRITE))==NULL) { error("fst_out_open: unable to open '%s'/n",fname); free(res); return NULL;}res->fstart=ftell(res->f);u_fprintf(res->f,"0000000000/n");res->name=strdup(fname);if (res->name==NULL) { fatal_alloc_error("fst_file_out_open");}res->type=type;res->nb_automata=0;res->labels=new_string_hash(16);/* We add <E> to the tags in order to be sure that this special tag will have #0 */get_value_index(EPSILON,res->labels);return res;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:30,
示例8: resolve_conditions_for_one_graph/** * This function tries to resolve the conditions of the graph #n. * It returns 1 if at least one condition was resolved. */int resolve_conditions_for_one_graph(int n,ConditionList* conditions, Fst2State* states,int* initial_states,U_FILE*ferr) {int modification=0;int matches_E=DOES_NOT_KNOW_IF_E_IS_MATCHED;if (conditions[n]==NULL) { error("NULL internal error in resolve_conditions_for_one_graph for graph %d/n",n); if (ferr != NULL) u_fprintf(ferr,"NULL internal error in resolve_conditions_for_one_graph for graph %d/n",n); return modification;}conditions[n]=resolve_condition_list(conditions[n],states,initial_states,&modification,&matches_E,ferr);if (matches_E==E_IS_MATCHED) { /* If at least one condition was verified */ set_bit_mask(&(states[initial_states[n]]->control),UNCONDITIONAL_E_MATCH); /* We can free the conditions */ free_ConditionList(conditions[n]); conditions[n]=NULL; return 1;}if (conditions[n]==NULL) { /* If the graph has no more condition, then we mark it as unable to match <E> */ set_bit_mask(&(states[initial_states[n]]->control),DOES_NOT_MATCH_E); free_ConditionList(conditions[n]); conditions[n]=NULL; return 1;}return modification;}
开发者ID:adri87,项目名称:Q-A,代码行数:32,
示例9: 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,
示例10: t_fprintfvoid t_fprintf(const emlrtStack *sp){ emlrtStack st; st.prev = sp; st.tls = sp->tls; st.site = &ol_emlrtRSI; u_fprintf(&st);}
开发者ID:CalilQ,项目名称:sdruWiLab,代码行数:8,
示例11: TraitUseFound /** * This method gets called when a trait use statement has been found * * @param const UnicodeString& namespace the fully qualified namespace of the class that uses the trait * @param className the fully qualified name of the class that uses the trait * @param traitName the fully qualified name of the trait to be used */ virtual void TraitUseFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& traitName) { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Trait Usage Found in class %.*S in namespace %.*S. Trait Name %.*S /n", className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), traitName.length(), traitName.getBuffer()); u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:15,
示例12: LEXIC_trans_writevoid LEXIC_trans_write(Elag_fst_file_out * fstf, int to) { unichar label[8]; int idx; u_strcpy(label, "<MOT>"); idx=get_value_index(label,fstf->labels); u_fprintf(fstf->f, "%d %d ", idx, to); u_strcpy(label, "<!MOT>"); idx=get_value_index(label,fstf->labels); u_fprintf(fstf->f, "%d %d ", idx, to);}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:17,
示例13: print_nodevoidprint_node( OlyNode *n ){ if (n->key != NULL) { u_fprintf(u_stdout, "Key: "); u_fprintf_u(u_stdout, n->key); u_fprintf(u_stdout," "); } if (n->parent_node != NULL) { u_fprintf(u_stdout, "Parent %lli, ", n->parent_node->node_id); } u_fprintf(u_stdout, "Tuple: %lli, Depth: %u, ", n->node_id, n->depth); print_node_value(n->value, n->value.type);}
开发者ID:theFlyRoper,项目名称:oly,代码行数:17,
示例14: TraitAliasFound /** * Override this method to perform custom logic when a trait method has been aliased * * @param const UnicodeString& namespace the fully qualified namespace of the class that uses the trait * @param traitUsedClassName the class name of the trait to be aliased * @param traitMethodName the fully qualified name of the trait method that is to be aliased (hidden) * this may be empty if the trait adaptation only changes the visibility and * does not need to resolve a trait conflict * @param alias the name of the new alias. alias may be empty when ONLY the visibility is changed. * @param visibility the visbility of the trait method. may be PUBLIC if the visibility was not changed. */ virtual void TraitAliasFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& traitUsedClassName, const UnicodeString& traitMethodName, const UnicodeString& alias, pelet::TokenClass::TokenIds visibility) { UFILE* ufout = u_finit(stdout, NULL, NULL); if (!alias.isEmpty()) { const char* visibilityStr; if (pelet::TokenClass::PRIVATE == visibility) { visibilityStr = "private"; } else if (pelet::TokenClass::PROTECTED == visibility) { visibilityStr = "protected"; } else { visibilityStr = "public"; } u_fprintf(ufout, "Trait Alias Found in class %.*S in namespace %.*S. Trait Class %.*S Trait Method %.*S Trait Alias %.*S New Visibility %s /n", className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), traitUsedClassName.length(), traitUsedClassName.getBuffer(), traitMethodName.length(), traitMethodName.getBuffer(), alias.length(), alias.getBuffer(), visibilityStr ); } else { const char* visibilityStr; if (pelet::TokenClass::PRIVATE == visibility) { visibilityStr = "private"; } else if (pelet::TokenClass::PROTECTED == visibility) { visibilityStr = "protected"; } else { visibilityStr = "public"; } u_fprintf(ufout, "Trait Change in visbility Found in class %.*S in namespace %.*S. Trait Class %.*S Trait Method %.*S New Visibility %s/n", className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), traitUsedClassName.length(), traitUsedClassName.getBuffer(), traitMethodName.length(), traitMethodName.getBuffer(), visibilityStr ); } u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:56,
示例15: FunctionFound /** * This method gets called when a function is found. * * @param const UnicodeString& namespace the fully qualified namespace of the function that was found * @param const UnicodeString& functionName the name of the method that was found * @param const UnicodeString& signature string containing method parameters. String is normalized, meaning that * any extra white space is removed, and every token is separated by one space only. ie. for the code * "public function doWork( $item1, $item2 ) " the signature will be "($item1, $item2)" * @param const UnicodeString& returnType the function's return type, as dictated by the PHPDoc comment * @param const UnicodeString& comment PHPDoc attached to the class * @param lineNumber the line number (1-based) that the function was found in */ virtual void FunctionFound(const UnicodeString& namespaceName, const UnicodeString& functionName, const UnicodeString& signature, const UnicodeString& returnType, const UnicodeString& comment, const int lineNumber) { UFILE* ufout = u_finit(stdout, NULL, NULL); if (returnType.isEmpty()) { u_fprintf(ufout, "Function Found: %.*S in namespace %.*S on line %d. Function Did not have @return in PHPDoc comment/n", functionName.length(), functionName.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber); } else { u_fprintf(ufout, "Function Found: %.*S in namespace %.*S on line %d and it returns %.*S/n", functionName.length(), functionName.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber, returnType.length(), returnType.getBuffer()); } u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:30,
示例16: DefineDeclarationFound /** * This method gets called when a define declaration is found. * * @param const UnicodeString& namespace the fully qualified namespace name that the constant that was found * @param const UnicodeString& variableName the name of the defined variable * @param const UnicodeString& variableValue the variable value * @param const UnicodeString& comment PHPDoc attached to the define * @param lineNumber the line number (1-based) that the define was found in */ virtual void DefineDeclarationFound(const UnicodeString& namespaceName, const UnicodeString& variableName, const UnicodeString& variableValue, const UnicodeString& comment, const int lineNumber) { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Define Found: %.*S in namespace %.*S on line %d/n", variableName.length(), variableName.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber); u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:18,
示例17: ClassFound /** * This method gets called when a class is found. * * @param const UnicodeString& namespace the fully qualified "declared" namespace of the class that was found * @param const UnicodeString& className the name of the class that was found * @param const UnicodeString& signature the list of classes that the class inherits / implements in code format * for example "extends UserClass implements Runnable" * @param const UnicodeString& comment PHPDoc attached to the class * @param lineNumber the line number (1-based) that the class was found in */ virtual void ClassFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& signature, const UnicodeString& comment, const int lineNumber) { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Class Found: %.*S in namespace %.*S on line %d /n", className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber); u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:19,
示例18: 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(U_FILE* f,struct l_morpho_t* pL_MORPHO,SU_id_T* unit) { if (unit == NULL) return 1; u_fprintf(f,"%S", unit->form); if (unit->lemma) { u_fprintf(f,"(%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_fprintf(f,":%S", tmp); free(tmp); } u_fprintf(f,")"); } return 0;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:21,
示例19: u_finitvoid t4p::TagCacheClass::Print() { UFILE* ufout = u_finit(stdout, NULL, NULL); u_fprintf(ufout, "Number of working caches: %d/n", WorkingCaches.size()); u_fclose(ufout); std::map<wxString, t4p::WorkingCacheClass*>::const_iterator it = WorkingCaches.begin(); for (; it != WorkingCaches.end(); ++it) { it->second->SymbolTable.Print(); }}
开发者ID:62BRAINS,项目名称:triumph4php,代码行数:9,
示例20: printIndentvoid printIndent(UFILE *out, int32_t indent) { char inchar[256]; int32_t i = 0; for(i = 0; i<indent; i++) { inchar[i] = ' '; } inchar[indent] = '/0'; u_fprintf(out, "%s", inchar);}
开发者ID:mason105,项目名称:red5cpp,代码行数:9,
示例21: save/** * Saves the lines. */void save(struct sort_infos* inf) { u_printf("Sorting and saving.../n"); /* -1 means that no line at all was already printed */ struct dela_entry* last = (struct dela_entry*)-1; int return_value = explore_node(inf->root, inf, &last); if (return_value == SUCCESS_RETURN_CODE && last != NULL && last!=(struct dela_entry*)-1) { u_fprintf(inf->f_out, "/n"); free_dela_entry(last); }}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:13,
示例22: MethodFound /* This method gets called when a class method is found. * * @param const UnicodeString& namespace the fully qualified namespace of the class that was found * @param const UnicodeString& className the name of the class that was found * @param const UnicodeString& methodName the name of the method that was found * @param const UnicodeString& signature string containing method parameters. String is normalized, meaning that * any extra white space is removed, and every token is separated by one space only. ie. for the code * "public function doWork( $item1, $item2 ) " the signature will be "($item1, $item2)" * @param const UnicodeString& returnType the method's return type, as dictated by the PHPDoc comment * @param const UnicodeString& comment PHPDoc attached to the class * @param visibility the visibility token attached to the method: PUBLIC, PROTECTED, or PRIVATE * @param isStatic true if the method is static * @param lineNumber the line number (1-based) that the method was found in */ virtual void MethodFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& methodName, const UnicodeString& signature, const UnicodeString& returnType, const UnicodeString& comment, pelet::TokenClass::TokenIds visibility, bool isStatic, const int lineNumber) { UFILE* ufout = u_finit(stdout, NULL, NULL); if (returnType.isEmpty()) { u_fprintf(ufout, "Method Found: %.*S in class %.*S in namespace %.*S on line %d. Method did not have @return in PHPDoc comment/n", methodName.length(), methodName.getBuffer(), className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber); } else { u_fprintf(ufout, "Method Found: %.*S in class %.*S in namespace %.*S on line %d and returns %.*S/n", methodName.length(), methodName.getBuffer(), className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber, returnType.length(), returnType.getBuffer()); } u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:33,
示例23: fst_file_close_out/** * Saves the labels of the given .fst2, closes the file * and frees the associated memory. */void fst_file_close_out(Elag_fst_file_out* fstout) {write_fst_tags(fstout);fseek(fstout->f,fstout->fstart,SEEK_SET);/* We print the number of automata on 10 digits */u_fprintf(fstout->f,"%010d",fstout->nb_automata);u_fclose(fstout->f);free_string_hash(fstout->labels);if (fstout->name!=NULL) free(fstout->name);free(fstout);}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:14,
示例24: PropertyFound /** * Override this method to perform any custom logic when a class property is found. * * @param const UnicodeString& namespace the fully qualified namespace of the class that was found * @param const UnicodeString& className the name of the class that was found * @param const UnicodeString& propertyName the name of the property that was found * @param const UnicodeString& propertyType the property's type, as dictated by the PHPDoc comment * @param const UnicodeString& comment PHPDoc attached to the property * @param visibility the visibility token attached to the property: PUBLIC, PROTECTED, or PRIVATE * @param bool isConst true if property is a constant * @param isStatic true if the property is static * @param lineNumber the line number (1-based) that the property was found in */ virtual void PropertyFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& propertyName, const UnicodeString& propertyType, const UnicodeString& comment, pelet::TokenClass::TokenIds visibility, bool isConst, bool isStatic, const int lineNumber) { UFILE* ufout = u_finit(stdout, NULL, NULL); if (propertyType.isEmpty()) { u_fprintf(ufout, "Property Found: %.*S in class %.*S in namespace %.*S on line %d. Did not have @return in PHPDoc comment/n", propertyName.length(), propertyName.getBuffer(), className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber); } else { u_fprintf(ufout, "Property Found: %.*S in class %.*S in namespace %.*S on line %d and is of type %.*S/n", propertyName.length(), propertyName.getBuffer(), className.length(), className.getBuffer(), namespaceName.length(), namespaceName.getBuffer(), lineNumber, propertyType.length(), propertyType.getBuffer()); } u_fclose(ufout); }
开发者ID:robertop,项目名称:pelet,代码行数:32,
示例25: VariableFound /** * Override this method to perform any custom logic when a variable assignment is found. Note that the same * variable may be assigned different values at different times within the same function. * The symbol will be constructed in the following way: * * Example assignment: $name = $this->getName()->toString(); * * Variable: The variable's ChainList will contain the variable's name in index 0: "$name" * ChainList: This is a list of properties / methods * that were successively invoked. * In this example, the expression chain list will have 3 items in * the chain list "$this" "->getName()" and "->toString()". * * The variable itself may contain an array key in it; like so: $person['name'] = $this->getName()->toString(); * In this case, Variable ChainList will contain 1 item: "$name" and the Variable Array Key will contain "name" * * * @param const UnicodeString& namespace the fully qualified namespace of the containing class / function. * @param const UnicodeString& className class where the variable was found. may be empty is variable is scoped * inside a function or is global. * @param const UnicodeString& methodName function/method name where the variable was found. may be empty if * variable is globally scoped. * @param const VariableClass& variable the name of the variable that was found, along with any array keys that were used * in the left hand of the assignment. * @param const ExpressionClass& expression the expression assigned to the variable * @param const UnicodeString& comment PHPDoc attached to the variable * * @see pelet::VariableClass */ virtual void VariableFound(const UnicodeString& namespaceName, const UnicodeString& className, const UnicodeString& methodName, const pelet::VariableClass& variable, pelet::ExpressionClass* expression, const UnicodeString& comment) { UFILE* ufout = u_finit(stdout, NULL, NULL); UnicodeString scope; if (className.isEmpty() && methodName.isEmpty()) { scope = UNICODE_STRING_SIMPLE("<global>"); } else if (className.isEmpty() && !methodName.isEmpty()) { scope = methodName; } else { scope = className + UNICODE_STRING_SIMPLE("::") + methodName; } UnicodeString type; if (variable.IsPhpDocVariable && !variable.PhpDocType.isEmpty()) { type += UNICODE_STRING_SIMPLE("Variable is decorated with a PHPDoc comment: "); type += variable.PhpDocType; } else if (pelet::ExpressionClass::ARRAY == expression->ExpressionType) { type = UNICODE_STRING_SIMPLE("Variable is an array"); } else if (pelet::ExpressionClass::SCALAR == expression->ExpressionType) { type = UNICODE_STRING_SIMPLE("Variable is a primitive"); } else if (pelet::ExpressionClass::VARIABLE == expression->ExpressionType) { type = UNICODE_STRING_SIMPLE("Variable is a variable expression. "); type += UNICODE_STRING_SIMPLE("Chain list is: "); pelet::VariableClass* srcVariable = (pelet::VariableClass*) expression; for (size_t i = 0; i < srcVariable->ChainList.size(); ++i) { if (srcVariable->ChainList[i].IsStatic && i > 0) { type += UNICODE_STRING_SIMPLE("::"); } else if (i > 0) { type += UNICODE_STRING_SIMPLE("->"); } type += srcVariable->ChainList[i].Name; if (srcVariable->ChainList[i].IsFunction) { type += UNICODE_STRING_SIMPLE("()"); } if (i < (srcVariable->ChainList.size() - 1)) { type += UNICODE_STRING_SIMPLE(", "); } } } else if (pelet::ExpressionClass::UNKNOWN == expression->ExpressionType) { type = UNICODE_STRING_SIMPLE("Variable is of unknown type."); } u_fprintf(ufout, "Variable Found: %.*S in scope %S. %S/n", variable.ChainList[0].Name.length(), variable.ChainList[0].Name.getBuffer(), scope.getTerminatedBuffer(), type.getTerminatedBuffer()); }
开发者ID:robertop,项目名称:pelet,代码行数:84,
示例26: protect_special_charactersvoid protect_special_characters(const char *text,Encoding encoding_output,int bom_output,int mask_encoding_compatibility_input){ U_FILE *source; U_FILE *destination; //fprintf(stdout,"protect special character/n"); char temp_name_file[FILENAME_MAX]; char path[FILENAME_MAX]; get_path(text,path); sprintf(temp_name_file,"%stemp",path); source = u_fopen_existing_versatile_encoding(mask_encoding_compatibility_input, text,U_READ); if( source == NULL){ perror("u_fopen/n"); fprintf(stderr,"Cannot open file %s/n",text); exit(1); } destination = u_fopen_versatile_encoding(encoding_output,bom_output,mask_encoding_compatibility_input,temp_name_file,U_WRITE); if( destination == NULL){ perror("u_fopen/n"); fprintf(stderr,"Cannot open file %s/n",temp_name_file); exit(1); } int a; a = u_fgetc(source); while(a!=EOF){ u_fputc((unichar)a,destination); if(a=='{'){ //fprintf(stdout,"opening bracket found/n"); unichar *bracket_string = get_braced_string(source); unichar *protected_bracket_string = protect_braced_string(bracket_string); //u_fprints(protected_bracket_string,destination); u_fprintf(destination,"%S",protected_bracket_string); //u_printf("%S --- ",bracket_string); //u_printf("%S/n",protected_bracket_string); free(bracket_string); free(protected_bracket_string); } a = u_fgetc(source); } u_fclose(source); u_fclose(destination); copy_file(text,temp_name_file); // should delete the 'temp' file}
开发者ID:adri87,项目名称:Q-A,代码行数:55,
示例27: dump_keywordsvoid dump_keywords(vector_ptr* keywords,U_FILE* f) {for (int i=0;i<keywords->nbelems;i++) { KeyWord* k=(KeyWord*)keywords->tab[i]; while (k!=NULL) { if (k->sequence!=NULL && k->lemmatized!=PART_OF_A_LEMMATIZED_KEYWORD) { u_fprintf(f,"%d/t%S/n",k->weight,k->sequence); } k=k->next; }}}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:11,
示例28: dump_values/** * Dumps the values of the given string_hash into the given file (one * string per line). Raises a fatal error if the string_hash has no value. */void dump_values(U_FILE *f,struct string_hash* hash) {if (hash==NULL) { fatal_error("NULL error in dump_values/n");}if (hash->value==NULL) { fatal_error("No values to dump in dump_values/n");}for (int i=0;i<hash->size;i++) { u_fprintf(f,"%S/n",hash->value[i]);}}
开发者ID:adri87,项目名称:Q-A,代码行数:15,
示例29: write_keys_values/** * Writes pairs (key,value) into the file containing statistics. */void write_keys_values(struct string_hash_ptr* table,struct string_hash_tree_node* node,const unichar* str,U_FILE* file){if(node->value_index != NO_VALUE_INDEX){ u_fprintf(file,"%S,.%d/n",str,table->value[node->value_index]);}for(struct string_hash_tree_transition* trans=node->trans;trans!=NULL;trans=trans->next){ unichar* new_str = (unichar*)malloc(DIC_LINE_SIZE); u_sprintf(new_str,"%S%C",str,trans->letter); write_keys_values(table,trans->node,new_str,file); free(new_str);}}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:14,
注:本文中的u_fprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ u_free函数代码示例 C++ u_fclose函数代码示例 |