#include <my_global.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
Go to the source code of this file.
Defines | |
| #define | CHARSETS_SUBDIR "sql/share/charsets" |
| #define | CTYPE_TABLE_SIZE 257 |
| #define | ROW_LEN 16 |
| #define | SORT_ORDER_TABLE_SIZE 256 |
| #define | TO_LOWER_TABLE_SIZE 256 |
| #define | TO_UPPER_TABLE_SIZE 256 |
Functions | |
| int | main (int argc, char **argv) |
| void | print_array (FILE *f, const char *set, const char *name, int n) |
| void | print_arrays_for (char *set) |
Variables | |
| char | buf [1024] |
| char * | endptr |
| char * | p |
| char * | prog |
|
|
Definition at line 28 of file conf_to_src.c. Referenced by main(). |
|
|
Definition at line 29 of file conf_to_src.c. Referenced by print_arrays_for(). |
|
|
Definition at line 33 of file conf_to_src.c. Referenced by print_array(). |
|
|
Definition at line 32 of file conf_to_src.c. Referenced by print_arrays_for(). |
|
|
Definition at line 30 of file conf_to_src.c. Referenced by print_arrays_for(). |
|
|
Definition at line 31 of file conf_to_src.c. Referenced by print_arrays_for(). |
|
||||||||||||
|
Definition at line 41 of file conf_to_src.c. References CHARSETS_SUBDIR, exit, print_arrays_for(), and prog. 00042 { 00043 prog = *argv; 00044 00045 if (argc < 2) { 00046 fprintf(stderr, "usage: %s source-dir [charset [, charset]]\n", prog); 00047 exit(EXIT_FAILURE); 00048 } 00049 00050 --argc; ++argv; /* skip program name */ 00051 00052 if (chdir(*argv) != 0) { 00053 fprintf(stderr, "%s: can't cd to %s\n", prog, *argv); 00054 exit(EXIT_FAILURE); 00055 } 00056 --argc; ++argv; 00057 00058 if (chdir(CHARSETS_SUBDIR) != 0) { 00059 fprintf(stderr, "%s: can't cd to %s\n", prog, CHARSETS_SUBDIR); 00060 exit(EXIT_FAILURE); 00061 } 00062 00063 while (argc--) 00064 print_arrays_for(*argv++); 00065 00066 exit(EXIT_SUCCESS); 00067 }
|
|
||||||||||||||||||||
|
Definition at line 70 of file conf_to_src.c. References buf, endptr, NULL, p, ROW_LEN, strtol(), and val. Referenced by main(), and print_arrays_for(). 00071 { 00072 int i; 00073 char val[100]; 00074 00075 printf("uchar %s_%s[] = {\n", name, set); 00076 00077 p = buf; 00078 *buf = '\0'; 00079 for (i = 0; i < n; ++i) 00080 { 00081 /* get a word from f */ 00082 endptr = p; 00083 for (;;) 00084 { 00085 while (isspace(*endptr)) 00086 ++endptr; 00087 if (*endptr && *endptr != '#') /* not comment */ 00088 break; 00089 if ((fgets(buf, sizeof(buf), f)) == NULL) 00090 return; /* XXX: break silently */ 00091 endptr = buf; 00092 } 00093 00094 p = val; 00095 while (!isspace(*endptr)) 00096 *p++ = *endptr++; 00097 *p = '\0'; 00098 p = endptr; 00099 00100 /* write the value out */ 00101 00102 if (i == 0 || i % ROW_LEN == n % ROW_LEN) 00103 printf(" "); 00104 00105 printf("%3d", (unsigned char) strtol(val, (char **) NULL, 16)); 00106 00107 if (i < n - 1) 00108 printf(","); 00109 00110 if ((i+1) % ROW_LEN == n % ROW_LEN) 00111 printf("\n"); 00112 } 00113 00114 printf("};\n\n"); 00115 }
|
|
|
Definition at line 118 of file conf_to_src.c. References buf, CTYPE_TABLE_SIZE, exit, f(), NULL, print_array(), prog, SORT_ORDER_TABLE_SIZE, TO_LOWER_TABLE_SIZE, and TO_UPPER_TABLE_SIZE. Referenced by main(). 00119 { 00120 FILE *f; 00121 00122 sprintf(buf, "%s.conf", set); 00123 00124 if ((f = fopen(buf, "r")) == NULL) { 00125 fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set); 00126 exit(EXIT_FAILURE); 00127 } 00128 00129 printf("\ 00130 /* The %s character set. Generated automatically by configure and\n\ 00131 * the %s program\n\ 00132 */\n\n", 00133 set, prog); 00134 00135 /* it would be nice if this used the code in mysys/charset.c, but... */ 00136 print_array(f, set, "ctype", CTYPE_TABLE_SIZE); 00137 print_array(f, set, "to_lower", TO_LOWER_TABLE_SIZE); 00138 print_array(f, set, "to_upper", TO_UPPER_TABLE_SIZE); 00139 print_array(f, set, "sort_order", SORT_ORDER_TABLE_SIZE); 00140 printf("\n"); 00141 00142 fclose(f); 00143 00144 return; 00145 }
|
|
|
|
Definition at line 38 of file conf_to_src.c. Referenced by fetch_string_with_conversion(), Gis_read_stream::get_next_number(), print_array(), and Item_func_conv::val_str(). |
|
|
|
Definition at line 37 of file conf_to_src.c. |
1.4.3