fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

euc_tw.c

Go to the documentation of this file.
00001 /*
00002  * Author: Jean-Marc Lienher ( http://oksid.ch )
00003  * Copyright 2000-2003 by O'ksi'D.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00018  * USA.
00019  *
00020  * Please report all bugs and problems on the following page:
00021  *
00022  *     http://www.fltk.org/str.php
00023  */
00024 
00025 /*      
00026  *    generate the "if(){} else if ..." structure of ucs2fontmap()
00027  */
00028 
00029 #include <wchar.h>
00030 #include <stdio.h>
00031 #include <iconv.h>
00032 char uni[0x10000];
00033 #include "../utf8Utils.c"
00034 
00035 int main(int argc, char **argv) {
00036 
00037   iconv_t cd;
00038 
00039   int i;
00040   cd = iconv_open("EUC-TW", "UTF16");
00041   for(i = 0; i < 0x10000; i++) uni[i] = 0;
00042   for(i = 0x00000000; i < 0xFFFFFFFF; i++) {
00043     char buf[4], ob[6];
00044     char *b = buf;
00045     int ucs = -1;
00046     int l1 = 4, l2 = 6;
00047     char *o = ob ;
00048     buf[0] = i & 0xff;
00049     buf[1] = (i >> 8) & 0xFF;
00050     buf[2] = (i >> 16) & 0xFF;
00051     buf[3] = (i >> 24) & 0xFF;
00052     iconv(cd, NULL, NULL, NULL, NULL);
00053     iconv(cd, &b, &l1, &o, &l2);
00054     if (l2 != 6) {
00055       ucs = (unsigned)ob[0];
00056       ucs += (unsigned) (ob[1] << 8);
00057       //XConvertUtf8ToUcs((unsigned char*)ob, 6 - l2, &ucs); 
00058       printf ("%x --> %X\n", i, ucs & 0xFFFF);
00059     }
00060   }
00061   iconv_close(cd);
00062   return 0;
00063 }
00064 
00065 /*
00066  * End of "$Id$".
00067  */