bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] add and version


From: jake
Subject: [bug-gnu-libiconv] add and version
Date: Thu, 10 Jul 2008 12:29:15 -0400 (EDT)

Hello Bruno,

a couple more questions from playing with adding one
of my own binary 8 bit encodings following the procedures
in the NOTES. I based my original mapping from
ftp://ftp.unicode.org:/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
added a couple of entries and then generated the following
cp1252full.h using "8bit_tab_to_h"

then I added the following to

-- encodings.def
DEFENCODING(( "CP1252FULL",
              "WINDOWS-1252-FULL",
              "MS-ANSI-FULL",
              "CP1252PREGEX",
            ),
            cp1252full,
            { cp1252full_mbtowc, NULL },      { cp1252full_wctomb, NULL })

--- flags.h
#define ei_cp1252full_oflags (HAVE_ACCENTS | HAVE_QUOTATION_MARKS)

--- converters.h
#include "cp1252full.h"

make distclean && ./configure --enable-static=yes --enable-shared=no
--enable-relocatable --enable-extra-encodings && make

everything compiles, and I see the symbols
in "lib/.libs/libiconv.a"

001368a0 s _cp1252full_2uni
00006350 t _cp1252full_mbtowc
00136840 s _cp1252full_page01
00136820 s _cp1252full_page02
001367e0 s _cp1252full_page20
001367c0 s _cp1252full_pagefb
000063a0 t _cp1252full_wctomb

However, when I do src/iconv_no_i18n -l, I don't see my addition in
the listing, likewise using "iconvlist()" from within a C program.
and naturally iconv_open/iconv crashes when using this mapping

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xffffffff
0x000180a4 in libiconv (icd=0xffffffff, inbuf=0xbffff7c0, inbytesleft=0xbffff7b8, outbuf=0xbffff7bc, outbytesleft=0xbffff7b4) at iconv.c:451
451         return cd->lfuncs.loop_convert(icd,
(gdb) where
#0 0x000180a4 in libiconv (icd=0xffffffff, inbuf=0xbffff7c0, inbytesleft=0xbffff7b8, outbuf=0xbffff7bc, outbytesleft=0xbffff7b4) at iconv.c:451
#1  0x00001e84 in whichbad () at main.c:246
#2  0x000021f4 in main (argc=1, argv=0xbffff838) at main.c:329
(gdb) list
446     {
447       conv_t cd = (conv_t) icd;
448       if (inbuf == NULL || *inbuf == NULL)
449         return cd->lfuncs.loop_reset(icd,outbuf,outbytesleft);
450       else
451         return cd->lfuncs.loop_convert(icd,
452 (const char* *)inbuf,inbytesleft,
453                                        outbuf,outbytesleft);
454     }


What am I missing?



according to the ChangeLog, configure.ac updated the
version to 1.12, however, the iconv.h* in the "include"
directories are still marked as 1.11

#define _LIBICONV_VERSION 0x010B



----

--- generated cp1252full.h ---
/*
 * CP1252FULL
 */

static const unsigned short cp1252full_2uni[32] = {
  /* 0x80 */
  0x20ac, 0xfb01, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
  0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfb02, 0x017d, 0x2260,
  /* 0x90 */
  0x221e, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
  0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xf8ff, 0x017e, 0x0178,
};

static int
cp1252full_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
{
  unsigned char c = *s;
  if (c < 0x80)
    *pwc = (ucs4_t) c;
  else if (c < 0xa0)
    *pwc = (ucs4_t) cp1252full_2uni[c-0x80];
  else
    *pwc = (ucs4_t) c;
  return 1;
}

static const unsigned char cp1252full_page01[72] = {
  0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
  0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
  0x9f, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
  0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
};
static const unsigned char cp1252full_page02[32] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
  0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
};
static const unsigned char cp1252full_page20[48] = {
  0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
  0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */
  0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
  0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
  0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
};
static const unsigned char cp1252full_pagefb[8] = {
  0x00, 0x81, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
};

static int
cp1252full_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
  unsigned char c = 0;
  if (wc < 0x0080) {
    *r = wc;
    return 1;
  }
  else if (wc >= 0x00a0 && wc < 0x0100)
    c = wc;
  else if (wc >= 0x0150 && wc < 0x0198)
    c = cp1252full_page01[wc-0x0150];
  else if (wc >= 0x02c0 && wc < 0x02e0)
    c = cp1252full_page02[wc-0x02c0];
  else if (wc >= 0x2010 && wc < 0x2040)
    c = cp1252full_page20[wc-0x2010];
  else if (wc == 0x20ac)
    c = 0x80;
  else if (wc == 0x2122)
    c = 0x99;
  else if (wc == 0x221e)
    c = 0x90;
  else if (wc == 0x2260)
    c = 0x8f;
  else if (wc == 0xf8ff)
    c = 0x9d;
  else if (wc >= 0xfb00 && wc < 0xfb08)
    c = cp1252full_pagefb[wc-0xfb00];
  if (c != 0) {
    *r = c;
    return 1;
  }
  return RET_ILUNI;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]