Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
008-01-08 Jakub Jelinek <jakub@redhat.com>
	* iconv/loop.c (UPDATE_PARAMS): Define to empty statement if not
	defined.
	(REINIT_PARAMS): Likewise.  Undefine before end of file.
	(STANDARD_TO_LOOP_ERR_HANDLER): Use UPDATE_PARAMS before calling
	transliteration hooks and REINIT_PARAMS afterwards.
	* iconvdata/iso-2022-jp.c (BODY): Use a separate variable for
	status.
	(REINIT_PARAMS): Define.
	* iconvdata/ibm1364.c (REINIT_PARAMS): Likewise.
	* iconvdata/ibm930.c (REINIT_PARAMS): Likewise.
	* iconvdata/ibm933.c (REINIT_PARAMS): Likewise.
	* iconvdata/ibm935.c (REINIT_PARAMS): Likewise.
	* iconvdata/ibm937.c (REINIT_PARAMS): Likewise.
	* iconvdata/ibm939.c (REINIT_PARAMS): Likewise.
	* iconvdata/iso-2022-cn.c (REINIT_PARAMS): Likewise.
	* iconvdata/iso-2022-cn-ext.c (REINIT_PARAMS): Likewise.
	* iconvdata/iso-2022-jp-3.c (REINIT_PARAMS): Likewise.
	* iconvdata/iso-2022-kr.c (REINIT_PARAMS): Likewise.
	* iconvdata/Makefile: Add rules to build and run tst-iconv7.c.
	* iconvdata/tst-iconv7.c: New test.
  • Loading branch information
Ulrich Drepper committed Jan 9, 2008
1 parent 148e12e commit 4b1b449
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 45 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Expand Up @@ -5,6 +5,29 @@
* stdlib/Makefile: Add rules to build and run tst-makecontext2.
* stdlib/tst-makecontext2.c: New test.

008-01-08 Jakub Jelinek <jakub@redhat.com>

* iconv/loop.c (UPDATE_PARAMS): Define to empty statement if not
defined.
(REINIT_PARAMS): Likewise. Undefine before end of file.
(STANDARD_TO_LOOP_ERR_HANDLER): Use UPDATE_PARAMS before calling
transliteration hooks and REINIT_PARAMS afterwards.
* iconvdata/iso-2022-jp.c (BODY): Use a separate variable for
status.
(REINIT_PARAMS): Define.
* iconvdata/ibm1364.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm930.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm933.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm935.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm937.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm939.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-cn.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-cn-ext.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-jp-3.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-kr.c (REINIT_PARAMS): Likewise.
* iconvdata/Makefile: Add rules to build and run tst-iconv7.c.
* iconvdata/tst-iconv7.c: New test.

2008-01-07 Ulrich Drepper <drepper@redhat.com>

* libio/stdio.h (vscanf): Fix definition for loser compilers.
Expand Down
21 changes: 18 additions & 3 deletions iconv/loop.c
@@ -1,5 +1,5 @@
/* Conversion loop frame work.
Copyright (C) 1998-2002, 2003, 2005 Free Software Foundation, Inc.
Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -174,6 +174,15 @@
# define EXTRA_LOOP_DECLS
#endif

/* Allow using UPDATE_PARAMS in macros where #ifdef UPDATE_PARAMS test
isn't possible. */
#ifndef UPDATE_PARAMS
# define UPDATE_PARAMS do { } while (0)
#endif
#ifndef REINIT_PARAMS
# define REINIT_PARAMS do { } while (0)
#endif


/* To make it easier for the writers of the modules, we define a macro
to test whether we have to ignore errors. */
Expand Down Expand Up @@ -214,6 +223,10 @@
case we are not doing any error recovery outself. */ \
break; \
\
/* If needed, flush any conversion state, so that __gconv_transliterate \
starts with current shift state. */ \
UPDATE_PARAMS; \
\
/* First try the transliteration methods. */ \
for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \
{ \
Expand All @@ -223,6 +236,9 @@
if (result != __GCONV_ILLEGAL_INPUT) \
break; \
} \
\
REINIT_PARAMS; \
\
/* If any of them recognized the input continue with the loop. */ \
if (result != __GCONV_ILLEGAL_INPUT) \
{ \
Expand Down Expand Up @@ -319,9 +335,7 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
/* Update the pointers pointed to by the parameters. */
*inptrp = inptr;
*outptrp = outptr;
#ifdef UPDATE_PARAMS
UPDATE_PARAMS;
#endif

return result;
}
Expand Down Expand Up @@ -492,6 +506,7 @@ gconv_btowc (struct __gconv_step *step, unsigned char c)
#undef EXTRA_LOOP_DECLS
#undef INIT_PARAMS
#undef UPDATE_PARAMS
#undef REINIT_PARAMS
#undef ONEBYTE_BODY
#undef UNPACK_BYTES
#undef CLEAR_STATE
Expand Down
6 changes: 4 additions & 2 deletions iconvdata/Makefile
@@ -1,4 +1,4 @@
# Copyright (C) 1997-2004,2005,2006,2007 Free Software Foundation, Inc.
# Copyright (C) 1997-2004,2005,2006,2007,2008 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -67,7 +67,7 @@ include ../Makeconfig

ifeq (yes,$(build-shared))
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
tst-iconv6 bug-iconv5 bug-iconv6
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7
ifeq ($(have-thread-library),yes)
tests += bug-iconv3
endif
Expand Down Expand Up @@ -365,6 +365,8 @@ $(objpfx)tst-loading.out: $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so))
$(objpfx)tst-iconv4.out: $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so))
$(objpfx)tst-iconv7.out: $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so))

$(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm1364.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM1364.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2005.
Expand Down Expand Up @@ -387,6 +387,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm930.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM930.
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
Expand Down Expand Up @@ -277,6 +277,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm933.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM933.
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
Expand Down Expand Up @@ -272,6 +272,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm935.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM935
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
Expand Down Expand Up @@ -272,6 +272,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm937.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM937.
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
Expand Down Expand Up @@ -272,6 +272,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/ibm939.c
@@ -1,5 +1,5 @@
/* Conversion to and from IBM939.
Copyright (C) 2000-2002, 2005 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
Expand Down Expand Up @@ -277,6 +277,7 @@ enum
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *curcsp
#define INIT_PARAMS int curcs = *curcsp & ~7
#define REINIT_PARAMS curcs = *curcsp & ~7
#define UPDATE_PARAMS *curcsp = curcs
#include <iconv/loop.c>

Expand Down
8 changes: 7 additions & 1 deletion iconvdata/iso-2022-cn-ext.c
@@ -1,5 +1,5 @@
/* Conversion module for ISO-2022-CN-EXT.
Copyright (C) 2000-2002, 2004, 2007 Free Software Foundation, Inc.
Copyright (C) 2000-2002, 2004, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
Expand Down Expand Up @@ -648,6 +648,12 @@ enum
#define EXTRA_LOOP_DECLS , int *setp
#define INIT_PARAMS int set = (*setp >> 3) & CURRENT_MASK; \
int ann = (*setp >> 3) & ~CURRENT_MASK
#define REINIT_PARAMS do \
{ \
set = (*setp >> 3) & CURRENT_MASK; \
ann = (*setp >> 3) & ~CURRENT_MASK; \
} \
while (0)
#define UPDATE_PARAMS *setp = (set | ann) << 3
#define LOOP_NEED_FLAGS
#include <iconv/loop.c>
Expand Down
8 changes: 7 additions & 1 deletion iconvdata/iso-2022-cn.c
@@ -1,5 +1,5 @@
/* Conversion module for ISO-2022-CN.
Copyright (C) 1999, 2000-2002, 2007 Free Software Foundation, Inc.
Copyright (C) 1999, 2000-2002, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
Expand Down Expand Up @@ -393,6 +393,12 @@ enum
#define EXTRA_LOOP_DECLS , int *setp
#define INIT_PARAMS int set = *setp & CURRENT_SEL_MASK; \
int ann = *setp & CURRENT_ANN_MASK
#define REINIT_PARAMS do \
{ \
set = *setp & CURRENT_SEL_MASK; \
ann = *setp & CURRENT_ANN_MASK; \
} \
while (0)
#define UPDATE_PARAMS *setp = set | ann
#include <iconv/loop.c>

Expand Down
9 changes: 8 additions & 1 deletion iconvdata/iso-2022-jp-3.c
@@ -1,5 +1,6 @@
/* Conversion module for ISO-2022-JP-3.
Copyright (C) 1998-1999, 2000-2002, 2004 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2000-2002, 2004, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998,
and Bruno Haible <bruno@clisp.org>, 2002.
Expand Down Expand Up @@ -759,6 +760,12 @@ static const struct
#define EXTRA_LOOP_DECLS , int *statep
#define INIT_PARAMS int set = *statep & CURRENT_SEL_MASK; \
uint32_t lasttwo = *statep >> 6
#define REINIT_PARAMS do \
{ \
set = *statep & CURRENT_SEL_MASK; \
lasttwo = *statep >> 6; \
} \
while (0)
#define UPDATE_PARAMS *statep = set | (lasttwo << 6)
#include <iconv/loop.c>

Expand Down

0 comments on commit 4b1b449

Please sign in to comment.