1998-04-26 18:44  Ulrich Drepper  <drepper@cygnus.com>

	* iconvdata/Makefile: Correct rules to generate gap table.
	* iconvdata/gap.pl: Simplify.
This commit is contained in:
Ulrich Drepper 1998-04-26 18:47:24 +00:00
parent 8babd571bf
commit 2fb2e75ae0
5 changed files with 56 additions and 40 deletions

View File

@ -1,3 +1,8 @@
1998-04-26 18:44 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/Makefile: Correct rules to generate gap table.
* iconvdata/gap.pl: Simplify.
1998-04-26 Ulrich Drepper <drepper@cygnus.com> 1998-04-26 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/Makefile: Add rules for ISO-2022-KR. * iconvdata/Makefile: Add rules for ISO-2022-KR.

View File

@ -250,12 +250,12 @@ $(make-target-directory)
( echo "static const uint32_t to_ucs4[256] = {"; \ ( echo "static const uint32_t to_ucs4[256] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/ [0x\1] = 0x\2,/p' -e d $^ | sort -u; \ sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/ [0x\1] = 0x\2,/p' -e d $^ | sort -u; \
echo "};"; \ echo "};"; \
echo "static struct gap from_idx[] = {"; \ echo "static const struct gap from_idx[] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gap.pl; \ sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gap.pl; \
echo " { start: 0xffff, end: 0xffff, idx: 0 }"; \ echo " { start: 0xffff, end: 0xffff, idx: 0 }"; \
echo "};"; \ echo "};"; \
echo "static const char from_ucs4[] = {"; \ echo "static const char from_ucs4[] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gaptab.pl; \ sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gaptab.pl; \
echo "};" ) > $@.new && rm -f $@ && mv $@.new $@ echo "};" ) > $@.new && rm -f $@ && mv $@.new $@
endef endef
@ -358,12 +358,12 @@ $(objpfx)iso8859-7jp.h: ../localedata/charmaps/ISO-8859-7 Makefile
( echo "static const uint32_t iso88597_to_ucs4[96] = {"; \ ( echo "static const uint32_t iso88597_to_ucs4[96] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/ [0x\1 - 0xA0] = 0x\2,/p' -e d $^ | sort -u; \ sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/ [0x\1 - 0xA0] = 0x\2,/p' -e d $^ | sort -u; \
echo "};"; \ echo "};"; \
echo "static struct gap from_idx[] = {"; \ echo "static const struct gap from_idx[] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gap.pl; \ sed -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gap.pl; \
echo " { start: 0xffff, end: 0xffff, idx: 0 }"; \ echo " { start: 0xffff, end: 0xffff, idx: 0 }"; \
echo "};"; \ echo "};"; \
echo "static const char iso88597_from_ucs4[] = {"; \ echo "static const char iso88597_from_ucs4[] = {"; \
sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gaptab.pl; \ sed -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gaptab.pl; \
echo "};" ) > $@.new && rm -f $@ && mv $@.new $@ echo "};" ) > $@.new && rm -f $@ && mv $@.new $@

View File

@ -5,12 +5,12 @@ while (<>) {
if ($u - $last > 6) { if ($u - $last > 6) {
if ($last != 0) { if ($last != 0) {
printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n",
$first, $last, $idx - $first); $first, $last, $idx);
$idx += $last - $first + 1; $idx -= $u - $last - 1;
} }
$first=$u; $first=$u;
} }
$last=$u; $last=$u;
} }
printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n",
$first, $last, $idx - $first); $first, $last, $idx);

View File

@ -54,7 +54,7 @@ struct gap
#define PREPARE_LOOP \ #define PREPARE_LOOP \
enum direction dir = ((struct iso2022jp_data *) step->data)->dir; \ enum direction dir = ((struct iso2022jp_data *) step->data)->dir; \
enum variant var = ((struct iso2022jp_data *) step->data)->var; \ enum variant var = ((struct iso2022jp_data *) step->data)->var; \
int save_state; \ int save_set; \
int set = data->statep->count; int set = data->statep->count;
#define END_LOOP \ #define END_LOOP \
data->statep->count = set; data->statep->count = set;

View File

@ -23,11 +23,17 @@
#include <string.h> #include <string.h>
#include "ksc5601.h" #include "ksc5601.h"
#include <assert.h>
/* This makes obvious what everybody knows: 0x1b is the Esc character. */ /* This makes obvious what everybody knows: 0x1b is the Esc character. */
#define ESC 0x1b
/* The shift sequences for this charset (we it does not use ESC). */
#define SI 0x0f #define SI 0x0f
#define SO 0x0e #define SO 0x0e
/* Definitions used in the body of the `gconv' function. */ /* Definitions used in the body of the `gconv' function. */
#define CHARSET_NAME "ISO-2022-KR//"
#define DEFINE_INIT 1 #define DEFINE_INIT 1
#define DEFINE_FINI 1 #define DEFINE_FINI 1
#define FROM_LOOP from_iso2022kr_loop #define FROM_LOOP from_iso2022kr_loop
@ -37,8 +43,10 @@
#define MIN_NEEDED_TO 4 #define MIN_NEEDED_TO 4
#define MAX_NEEDED_TO 4 #define MAX_NEEDED_TO 4
#define PREPARE_LOOP \ #define PREPARE_LOOP \
int save_set; int save_set; \
int set = data->statep->count; int set = data->statep->count;
#define EXTRA_LOOP_ARGS , set
/* The COUNT element of the state keeps track of the currently selected /* The COUNT element of the state keeps track of the currently selected
character set. The possible values are: */ character set. The possible values are: */
@ -58,7 +66,7 @@ enum
if (step->data == &from_object) \ if (step->data == &from_object) \
/* It's easy, we don't have to emit anything, we just reset the \ /* It's easy, we don't have to emit anything, we just reset the \
state for the input. */ \ state for the input. */ \
set = 0; \ data->statep->count = 0; \
else \ else \
{ \ { \
char *outbuf = data->outbuf; \ char *outbuf = data->outbuf; \
@ -73,7 +81,7 @@ enum
/* Write out the shift sequence. */ \ /* Write out the shift sequence. */ \
*outbuf++ = SO; \ *outbuf++ = SO; \
data->outbuf = outbuf; \ data->outbuf = outbuf; \
set = 0; \ data->statep->count = 0; \
} \ } \
} \ } \
} }
@ -238,6 +246,8 @@ enum
} \ } \
else \ else \
{ \ { \
char buf[2]; \
\
written = ucs4_to_ksc5601 (ch, buf, 2); \ written = ucs4_to_ksc5601 (ch, buf, 2); \
if (written != UNKNOWN_10646_CHAR) \ if (written != UNKNOWN_10646_CHAR) \
{ \ { \
@ -260,6 +270,7 @@ enum
break; \ break; \
} \ } \
} \ } \
} \
} \ } \
\ \
/* Now that we wrote the output increment the input pointer. */ \ /* Now that we wrote the output increment the input pointer. */ \