extern int iniReader() { FILE *handle = NULL; if (fopen_s(&handle, __INIFILE__, "r")) { return 1; } if (handle == NULL) { crashViewer("0x10000002", "接收数据时侦测到空指针错误"); return -2; } while (!feof(handle)) { char temp[__BUFFSIZE__]; fgets(temp, __BUFFSIZE__, handle); if (strchr(temp, '#') != NULL) { continue; } if (strcmp(temp, "[VERSION]\n") == 0) { parseVersion(handle); } else if (strcmp(temp, "[ADMINISTRATOR]\n") == 0) { parseAdmin(handle); } else if (strcmp(temp, "[LOG]\n") == 0) { parseLOG(handle); } else if (strcmp(temp, "[DB]\n") == 0) { parseDB(handle); } else { continue; } } return 0; }
extern int main(int argc, char* argv[]) { #if !UCONFIG_NO_NORMALIZATION char filename[300]; #endif const char *srcDir=NULL, *destDir=NULL, *suffix=NULL; char *basename=NULL; UErrorCode errorCode=U_ZERO_ERROR; U_MAIN_INIT_ARGS(argc, argv); /* preset then read command line options */ options[4].value=u_getDataDirectory(); options[5].value=""; options[6].value="3.0.0"; argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); /* error handling, printing usage message */ if(argc<0) { fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); } if(argc<0 || options[0].doesOccur || options[1].doesOccur) { /* * Broken into chucks because the C89 standard says the minimum * required supported string length is 509 bytes. */ fprintf(stderr, "Usage: %s [-options] [suffix]\n" "\n" "Read the UnicodeData.txt file and other Unicode properties files and\n" "create a binary file " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " with the normalization data\n" "\n", argv[0]); fprintf(stderr, "Options:\n" "\t-h or -? or --help this usage text\n" "\t-v or --verbose verbose output\n" "\t-c or --copyright include a copyright notice\n" "\t-u or --unicode Unicode version, followed by the version like 3.0.0\n"); fprintf(stderr, "\t-d or --destdir destination directory, followed by the path\n" "\t-s or --sourcedir source directory, followed by the path\n" "\tsuffix suffix that is to be appended with a '-'\n" "\t to the source file basenames before opening;\n" "\t 'gennorm new' will read UnicodeData-new.txt etc.\n"); return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; } /* get the options values */ beVerbose=options[2].doesOccur; haveCopyright=options[3].doesOccur; srcDir=options[5].value; destDir=options[4].value; if(argc>=2) { suffix=argv[1]; } else { suffix=NULL; } #if UCONFIG_NO_NORMALIZATION fprintf(stderr, "gennorm writes a dummy " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " because UCONFIG_NO_NORMALIZATION is set, \n" "see icu/source/common/unicode/uconfig.h\n"); generateData(destDir); #else setUnicodeVersion(options[6].value); /* prepare the filename beginning with the source dir */ uprv_strcpy(filename, srcDir); basename=filename+uprv_strlen(filename); if(basename>filename && *(basename-1)!=U_FILE_SEP_CHAR) { *basename++=U_FILE_SEP_CHAR; } /* initialize */ init(); /* process DerivedNormalizationProps.txt (name changed for Unicode 3.2, to <=31 characters) */ if(suffix==NULL) { uprv_strcpy(basename, "DerivedNormalizationProps.txt"); } else { uprv_strcpy(basename, "DerivedNormalizationProps"); basename[30]='-'; uprv_strcpy(basename+31, suffix); uprv_strcat(basename+31, ".txt"); } parseDerivedNormalizationProperties(filename, &errorCode, FALSE); if(U_FAILURE(errorCode)) { /* can be only U_FILE_ACCESS_ERROR - try filename from before Unicode 3.2 */ if(suffix==NULL) { uprv_strcpy(basename, "DerivedNormalizationProperties.txt"); } else { uprv_strcpy(basename, "DerivedNormalizationProperties"); basename[30]='-'; uprv_strcpy(basename+31, suffix); uprv_strcat(basename+31, ".txt"); } parseDerivedNormalizationProperties(filename, &errorCode, TRUE); } /* process UnicodeData.txt */ if(suffix==NULL) { uprv_strcpy(basename, "UnicodeData.txt"); } else { uprv_strcpy(basename, "UnicodeData"); basename[11]='-'; uprv_strcpy(basename+12, suffix); uprv_strcat(basename+12, ".txt"); } parseDB(filename, &errorCode); /* process parsed data */ if(U_SUCCESS(errorCode)) { processData(); /* write the properties data file */ generateData(destDir); cleanUpData(); } #endif return errorCode; }
extern int main(int argc, char* argv[]) { char filename[300]; const char *srcDir=NULL, *destDir=NULL, *suffix=NULL; char *basename=NULL; UErrorCode errorCode=U_ZERO_ERROR; U_MAIN_INIT_ARGS(argc, argv); /* preset then read command line options */ options[DESTDIR].value=u_getDataDirectory(); options[SOURCEDIR].value=""; options[UNICODE_VERSION].value=""; options[ICUDATADIR].value=u_getDataDirectory(); argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); /* error handling, printing usage message */ if(argc<0) { fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); } if(argc<0 || options[HELP_H].doesOccur || options[HELP_QUESTION_MARK].doesOccur) { /* * Broken into chucks because the C89 standard says the minimum * required supported string length is 509 bytes. */ fprintf(stderr, "Usage: %s [-options] [suffix]\n" "\n" "read the UnicodeData.txt file and other Unicode properties files and\n" "create a binary file " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE " with the bidi/shaping properties\n" "\n", argv[0]); fprintf(stderr, "Options:\n" "\t-h or -? or --help this usage text\n" "\t-v or --verbose verbose output\n" "\t-c or --copyright include a copyright notice\n" "\t-u or --unicode Unicode version, followed by the version like 3.0.0\n" "\t-C or --csource generate a .c source file rather than the .icu binary\n"); fprintf(stderr, "\t-d or --destdir destination directory, followed by the path\n" "\t-s or --sourcedir source directory, followed by the path\n" "\t-i or --icudatadir directory for locating any needed intermediate data files,\n" "\t followed by path, defaults to %s\n" "\tsuffix suffix that is to be appended with a '-'\n" "\t to the source file basenames before opening;\n" "\t 'genbidi new' will read UnicodeData-new.txt etc.\n", u_getDataDirectory()); return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; } /* get the options values */ beVerbose=options[VERBOSE].doesOccur; haveCopyright=options[COPYRIGHT].doesOccur; srcDir=options[SOURCEDIR].value; destDir=options[DESTDIR].value; if(argc>=2) { suffix=argv[1]; } else { suffix=NULL; } if(options[UNICODE_VERSION].doesOccur) { setUnicodeVersion(options[UNICODE_VERSION].value); } /* else use the default dataVersion in store.c */ if (options[ICUDATADIR].doesOccur) { u_setDataDirectory(options[ICUDATADIR].value); } /* prepare the filename beginning with the source dir */ uprv_strcpy(filename, srcDir); basename=filename+uprv_strlen(filename); if(basename>filename && *(basename-1)!=U_FILE_SEP_CHAR) { *basename++=U_FILE_SEP_CHAR; } /* initialize */ pv=upvec_open(2, &errorCode); /* process BidiMirroring.txt */ writeUCDFilename(basename, "BidiMirroring", suffix); parseBidiMirroring(filename, &errorCode); /* process additional properties files */ *basename=0; parseBinariesFile(filename, basename, suffix, &propListBinaries, &errorCode); parseSingleEnumFile(filename, basename, suffix, &jtSingleEnum, &errorCode); parseSingleEnumFile(filename, basename, suffix, &jgSingleEnum, &errorCode); /* process UnicodeData.txt */ writeUCDFilename(basename, "UnicodeData", suffix); parseDB(filename, &errorCode); /* set proper bidi class for unassigned code points (Cn) */ parseTwoFieldFile(filename, basename, "DerivedBidiClass", suffix, bidiClassLineFn, &errorCode); /* process parsed data */ if(U_SUCCESS(errorCode)) { /* write the properties data file */ generateData(destDir, options[CSOURCE].doesOccur); } u_cleanup(); return errorCode; }
extern int main(int argc, char* argv[]) { UVersionInfo version; Options moreOptions={ TRUE, FALSE, TRUE }; UErrorCode errorCode = U_ZERO_ERROR; U_MAIN_INIT_ARGS(argc, argv); /* Initialize ICU */ u_init(&errorCode); if (U_FAILURE(errorCode) && errorCode != U_FILE_ACCESS_ERROR) { /* Note: u_init() will try to open ICU property data. * failures here are expected when building ICU from scratch. * ignore them. */ fprintf(stderr, "%s: can not initialize ICU. errorCode = %s\n", argv[0], u_errorName(errorCode)); exit(1); } /* preset then read command line options */ options[DESTDIR].value=u_getDataDirectory(); options[UNICODE].value="4.1"; argc=u_parseArgs(argc, argv, LENGTHOF(options), options); /* error handling, printing usage message */ if(argc<0) { fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); } else if(argc<2) { argc=-1; } if(argc<0 || options[HELP_H].doesOccur || options[HELP_QUESTION_MARK].doesOccur) { /* * Broken into chucks because the C89 standard says the minimum * required supported string length is 509 bytes. */ fprintf(stderr, "Usage: %s [-1[+|-]] [-v[+|-]] [-c[+|-]] [filename_ud [filename_na]]\n" "\n" "Read the UnicodeData.txt file and \n" "create a binary file " DATA_NAME "." DATA_TYPE " with the character names\n" "\n" "\tfilename_ud absolute path/filename for the UnicodeData.txt file\n" "\t (default: standard input)\n" "\tfilename_na absolute path/filename for the NameAliases.txt file\n" "\t (default: no name aliases)\n" "\n", argv[0]); fprintf(stderr, "Options:\n" "\t-h or -? or --help this usage text\n" "\t-v or --verbose verbose output\n" "\t-q or --quiet no output\n" "\t-c or --copyright include a copyright notice\n" "\t-d or --destdir destination directory, followed by the path\n" "\t-u or --unicode Unicode version, followed by the version like 3.0.0\n"); fprintf(stderr, "\t-1 or --unicode1-names store Unicode 1.0 character names\n" "\t --no-iso-comments do not store ISO comments\n" "\t --only-iso-comments write ucomment.icu with only ISO comments\n"); return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; } /* get the options values */ beVerbose=options[VERBOSE].doesOccur; beQuiet=options[QUIET].doesOccur; haveCopyright=options[COPYRIGHT].doesOccur; moreOptions.store10Names=options[UNICODE1_NAMES].doesOccur; moreOptions.storeISOComments=!options[NO_ISO_COMMENTS].doesOccur; if(options[ONLY_ISO_COMMENTS].doesOccur) { moreOptions.storeNames=moreOptions.store10Names=FALSE; moreOptions.storeISOComments=TRUE; } /* set the Unicode version */ u_versionFromString(version, options[UNICODE].value); uprv_memcpy(dataInfo.dataVersion, version, 4); ucdVersion=findUnicodeVersion(version); init(); if(argc>=3) { parseNameAliases(argv[2], &moreOptions); } parseDB(argc>=2 ? argv[1] : "-", &moreOptions); compress(); generateData(options[DESTDIR].value, &moreOptions); u_cleanup(); return 0; }
extern int main(int argc, char* argv[]) { UVersionInfo version; UBool store10Names=FALSE; UErrorCode errorCode = U_ZERO_ERROR; U_MAIN_INIT_ARGS(argc, argv); /* Initialize ICU */ u_init(&errorCode); if (U_FAILURE(errorCode) && errorCode != U_FILE_ACCESS_ERROR) { /* Note: u_init() will try to open ICU property data. * failures here are expected when building ICU from scratch. * ignore them. */ fprintf(stderr, "%s: can not initialize ICU. errorCode = %s\n", argv[0], u_errorName(errorCode)); exit(1); } /* preset then read command line options */ options[5].value=u_getDataDirectory(); options[6].value="4.1"; argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); /* error handling, printing usage message */ if(argc<0) { fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); } else if(argc<2) { argc=-1; } if(argc<0 || options[0].doesOccur || options[1].doesOccur) { /* * Broken into chucks because the C89 standard says the minimum * required supported string length is 509 bytes. */ fprintf(stderr, "Usage: %s [-1[+|-]] [-v[+|-]] [-c[+|-]] filename\n" "\n" "Read the UnicodeData.txt file and \n" "create a binary file " DATA_NAME "." DATA_TYPE " with the character names\n" "\n" "\tfilename absolute path/filename for the Unicode database text file\n" "\t\t(default: standard input)\n" "\n", argv[0]); fprintf(stderr, "Options:\n" "\t-h or -? or --help this usage text\n" "\t-v or --verbose verbose output\n" "\t-q or --quiet no output\n" "\t-c or --copyright include a copyright notice\n" "\t-d or --destdir destination directory, followed by the path\n" "\t-u or --unicode Unicode version, followed by the version like 3.0.0\n" "\t-1 or --unicode1-names store Unicode 1.0 character names\n"); return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; } /* get the options values */ beVerbose=options[2].doesOccur; beQuiet=options[3].doesOccur; haveCopyright=options[4].doesOccur; store10Names=options[7].doesOccur; /* set the Unicode version */ u_versionFromString(version, options[6].value); uprv_memcpy(dataInfo.dataVersion, version, 4); ucdVersion=findUnicodeVersion(version); init(); parseDB(argc>=2 ? argv[1] : "-", store10Names); compress(); generateData(options[5].value); u_cleanup(); return 0; }