summaryrefslogtreecommitdiff
path: root/source3/script/makeunicodecasemap.awk
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1999-12-23 01:41:19 +0000
committerJeremy Allison <jra@samba.org>1999-12-23 01:41:19 +0000
commit8dc6098539c9cc210a2d3c2366a65d00aeaeba95 (patch)
tree132ac01509a51d53580b2b975e09b81d655c0aec /source3/script/makeunicodecasemap.awk
parent681e50c096d9ec6c5a3a0066da19fc8dee58446f (diff)
downloadsamba-8dc6098539c9cc210a2d3c2366a65d00aeaeba95.tar.gz
samba-8dc6098539c9cc210a2d3c2366a65d00aeaeba95.tar.bz2
samba-8dc6098539c9cc210a2d3c2366a65d00aeaeba95.zip
Awk script to create #include C code from unicode upper -> lower case map.
Jeremy. (This used to be commit e59fe73f19cdb207db55ea4ba0073f48af2e440e)
Diffstat (limited to 'source3/script/makeunicodecasemap.awk')
-rw-r--r--source3/script/makeunicodecasemap.awk59
1 files changed, 59 insertions, 0 deletions
diff --git a/source3/script/makeunicodecasemap.awk b/source3/script/makeunicodecasemap.awk
new file mode 100644
index 0000000000..4a4640da85
--- /dev/null
+++ b/source3/script/makeunicodecasemap.awk
@@ -0,0 +1,59 @@
+function reset_vals() {
+ upperstr = "";
+ lowerstr = "";
+ flagstr = "0";
+}
+
+function print_val() {
+ upperstr = $13;
+ lowerstr = $14;
+ if ( upperstr == "" )
+ upperstr = strval;
+ if ( lowerstr == "" )
+ lowerstr = strval;
+
+ if ( $3 == "Lu" )
+ flagstr = sprintf("%s|%s", flagstr, "UNI_UPPER");
+ if ( $3 == "Ll" )
+ flagstr = sprintf("%s|%s", flagstr, "UNI_LOWER");
+ if ( val >= 48 && val <= 57)
+ flagstr = sprintf("%s|%s", flagstr, "UNI_DIGIT");
+ if ((val >= 48 && val <= 57) || (val >= 65 && val <= 70) || (val >=97 && val <= 102))
+ flagstr = sprintf("%s|%s", flagstr, "UNI_XDIGIT");
+ if ( val == 32 || (val >=9 && val <= 13))
+ flagstr = sprintf("%s|%s", flagstr, "UNI_SPACE");
+ if( index(flagstr, "0|") == 1)
+ flagstr = substr(flagstr, 3, length(flagstr) - 2);
+ printf("{ 0x%s, 0x%s, %s }, \t\t\t/* %s %s */\n", lowerstr, upperstr, flagstr, strval, $2);
+ val++;
+ strval=sprintf("%04X", val);
+ reset_vals();
+}
+
+BEGIN {
+ val=0
+ FS=";"
+ strval=sprintf("%04X", val);
+ reset_vals();
+}
+
+{
+ if ( $1 == strval ) {
+ print_val();
+ } else {
+ while ( $1 != strval) {
+ printf("{ 0x%04X, 0x%04X, 0 }, \t\t\t/* %s NOMAP */\n", val, val, strval);
+ val++;
+ strval=sprintf("%04X", val);
+ }
+ print_val();
+ }
+}
+
+END {
+ while ( val < 65536 ) {
+ printf("{ 0, 0x%04X, 0x%04X }, \t\t\t/* %s NOMAP */\n", val, val, strval);
+ val++;
+ strval=sprintf("%04X", val);
+ }
+}