Diff for /embedaddon/libiconv/tools/cjk_tab_to_h.c between versions 1.1 and 1.1.1.3

version 1.1, 2012/02/21 22:57:49 version 1.1.1.3, 2021/03/17 13:38:46
Line 1 Line 1
/* Copyright (C) 1999-2004, 2006-2007 Free Software Foundation, Inc./* Copyright (C) 1999-2004, 2006-2007, 2010, 2012, 2016, 2018 Free Software Foundation, Inc.
    This file is part of the GNU LIBICONV Tools.     This file is part of the GNU LIBICONV Tools.
   
    This program is free software: you can redistribute it and/or modify     This program is free software: you can redistribute it and/or modify
Line 12 Line 12
    GNU General Public License for more details.     GNU General Public License for more details.
   
    You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
   Inc., along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ 
   
 /*  /*
  * Generates a CJK character set table from a .TXT table as found on   * Generates a CJK character set table from a .TXT table as found on
Line 76  typedef struct { Line 75  typedef struct {
 static void output_title (const char *charsetname)  static void output_title (const char *charsetname)
 {  {
   printf("/*\n");    printf("/*\n");
  printf(" * Copyright (C) 1999-2007 Free Software Foundation, Inc.\n");  printf(" * Copyright (C) 1999-2016 Free Software Foundation, Inc.\n");
   printf(" * This file is part of the GNU LIBICONV Library.\n");    printf(" * This file is part of the GNU LIBICONV Library.\n");
   printf(" *\n");    printf(" *\n");
   printf(" * The GNU LIBICONV Library is free software; you can redistribute it\n");    printf(" * The GNU LIBICONV Library is free software; you can redistribute it\n");
Line 91  static void output_title (const char *charsetname) Line 90  static void output_title (const char *charsetname)
   printf(" *\n");    printf(" *\n");
   printf(" * You should have received a copy of the GNU Library General Public\n");    printf(" * You should have received a copy of the GNU Library General Public\n");
   printf(" * License along with the GNU LIBICONV Library; see the file COPYING.LIB.\n");    printf(" * License along with the GNU LIBICONV Library; see the file COPYING.LIB.\n");
  printf(" * If not, write to the Free Software Foundation, Inc., 51 Franklin Street,\n");  printf(" * If not, see <https://www.gnu.org/licenses/>.\n");
  printf(" * Fifth Floor, Boston, MA 02110-1301, USA.\n"); 
   printf(" */\n");    printf(" */\n");
   printf("\n");    printf("\n");
   printf("/*\n");    printf("/*\n");
Line 340  static void output_charset2uni (const char* name, Enco Line 338  static void output_charset2uni (const char* name, Enco
   }    }
   
   printf("static int\n");    printf("static int\n");
  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", name);  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  unsigned char c1 = s[0];\n");    printf("  unsigned char c1 = s[0];\n");
   printf("  if (");    printf("  if (");
Line 451  static void output_charset2uni_noholes_monotonic (cons Line 449  static void output_charset2uni_noholes_monotonic (cons
   printf("\n");    printf("\n");
   
   printf("static int\n");    printf("static int\n");
  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", name);  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  unsigned char c1 = s[0];\n");    printf("  unsigned char c1 = s[0];\n");
   printf("  if (");    printf("  if (");
Line 616  static void output_uni2charset_dense (const char* name Line 614  static void output_uni2charset_dense (const char* name
     if (p >= 0)      if (p >= 0)
       printf("\n");        printf("\n");
   }    }
  printf("static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name);  printf("static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  if (n >= 2) {\n");    printf("  if (n >= 2) {\n");
   printf("    unsigned short c = 0;\n");    printf("    unsigned short c = 0;\n");
Line 800  static void output_uni2charset_sparse (const char* nam Line 798  static void output_uni2charset_sparse (const char* nam
   printf("\n");    printf("\n");
   
   printf("static int\n");    printf("static int\n");
  printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name);  printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  if (n >= 2) {\n");    printf("  if (n >= 2) {\n");
   printf("    const Summary16 *summary = NULL;\n");    printf("    const Summary16 *summary = NULL;\n");
Line 822  static void output_uni2charset_sparse (const char* nam Line 820  static void output_uni2charset_sparse (const char* nam
   printf("      if (used & ((unsigned short) 1 << i)) {\n");    printf("      if (used & ((unsigned short) 1 << i)) {\n");
   if (monotonic || !is_large)    if (monotonic || !is_large)
     printf("        unsigned short c;\n");      printf("        unsigned short c;\n");
  printf("        /* Keep in `used' only the bits 0..i-1. */\n");  printf("        /* Keep in 'used' only the bits 0..i-1. */\n");
   printf("        used &= ((unsigned short) 1 << i) - 1;\n");    printf("        used &= ((unsigned short) 1 << i) - 1;\n");
  printf("        /* Add `summary->indx' and the number of bits set in `used'. */\n");  printf("        /* Add 'summary->indx' and the number of bits set in 'used'. */\n");
   printf("        used = (used & 0x5555) + ((used & 0xaaaa) >> 1);\n");    printf("        used = (used & 0x5555) + ((used & 0xaaaa) >> 1);\n");
   printf("        used = (used & 0x3333) + ((used & 0xcccc) >> 2);\n");    printf("        used = (used & 0x3333) + ((used & 0xcccc) >> 2);\n");
   printf("        used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);\n");    printf("        used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);\n");
Line 1555  static void do_gb18030uni (const char* name) Line 1553  static void do_gb18030uni (const char* name)
   printf("\n");    printf("\n");
   
   printf("static int\n");    printf("static int\n");
  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", name);  printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  unsigned char c1 = s[0];\n");    printf("  unsigned char c1 = s[0];\n");
   printf("  if (c1 >= 0x81 && c1 <= 0x84) {\n");    printf("  if (c1 >= 0x81 && c1 <= 0x84) {\n");
Line 1609  static void do_gb18030uni (const char* name) Line 1607  static void do_gb18030uni (const char* name)
   printf("\n");    printf("\n");
   
   printf("static int\n");    printf("static int\n");
  printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name);  printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)\n", name);
   printf("{\n");    printf("{\n");
   printf("  if (n >= 4) {\n");    printf("  if (n >= 4) {\n");
   printf("    unsigned int i = wc;\n");    printf("    unsigned int i = wc;\n");
Line 1821  static void do_jisx0213 (const char* name) Line 1819  static void do_jisx0213 (const char* name)
         if ((count % 8) == 0) printf(" ");          if ((count % 8) == 0) printf(" ");
         printf(" ");          printf(" ");
         sprintf(buf,"0x%04x",pagestart[i]);          sprintf(buf,"0x%04x",pagestart[i]);
        if (strlen(buf) < 7) printf("%*s",7-strlen(buf),"");        if (strlen(buf) < 7) printf("%*s",(int)(7-strlen(buf)),"");
         printf("%s,",buf);          printf("%s,",buf);
         count++;          count++;
         if ((count % 8) == 0) printf("\n");          if ((count % 8) == 0) printf("\n");
Line 2070  static void do_jisx0213 (const char* name) Line 2068  static void do_jisx0213 (const char* name)
   printf("      unsigned short used = summary->used;\n");    printf("      unsigned short used = summary->used;\n");
   printf("      unsigned int i = ucs & 0x0f;\n");    printf("      unsigned int i = ucs & 0x0f;\n");
   printf("      if (used & ((unsigned short) 1 << i)) {\n");    printf("      if (used & ((unsigned short) 1 << i)) {\n");
  printf("        /* Keep in `used' only the bits 0..i-1. */\n");  printf("        /* Keep in 'used' only the bits 0..i-1. */\n");
   printf("        used &= ((unsigned short) 1 << i) - 1;\n");    printf("        used &= ((unsigned short) 1 << i) - 1;\n");
  printf("        /* Add `summary->indx' and the number of bits set in `used'. */\n");  printf("        /* Add 'summary->indx' and the number of bits set in 'used'. */\n");
   printf("        used = (used & 0x5555) + ((used & 0xaaaa) >> 1);\n");    printf("        used = (used & 0x5555) + ((used & 0xaaaa) >> 1);\n");
   printf("        used = (used & 0x3333) + ((used & 0xcccc) >> 2);\n");    printf("        used = (used & 0x3333) + ((used & 0xcccc) >> 2);\n");
   printf("        used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);\n");    printf("        used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);\n");
Line 2131  int main (int argc, char *argv[]) Line 2129  int main (int argc, char *argv[])
   else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext"))    else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext"))
     do_big5(name);      do_big5(name);
   else if (!strcmp(name,"hkscs1999") || !strcmp(name,"hkscs2001")    else if (!strcmp(name,"hkscs1999") || !strcmp(name,"hkscs2001")
           || !strcmp(name,"hkscs2004"))           || !strcmp(name,"hkscs2004") || !strcmp(name,"hkscs2008"))
     do_hkscs(name);      do_hkscs(name);
   else if (!strcmp(name,"johab_hangul"))    else if (!strcmp(name,"johab_hangul"))
     do_johab_hangul(name);      do_johab_hangul(name);

Removed from v.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>