--- org/geniconvtbl.4	Mon Apr 26 14:54:27 2010
+++ geniconvtbl.4	Thu Apr 29 13:07:32 2010
@@ -13,7 +13,7 @@
      The geniconvtbl utility accepts the code conversion  defini-
      tion file(s) and writes code conversion binary table file(s)
      that can be used in iconv(1) and iconv(3C) to support  user-
-     defined code conversions. See iconv(1) and iconv(3C)for more
+     defined code conversions. See iconv(1) and iconv(3C) for more            |
      detail on the iconv code conversion and  geniconvtbl(1)  for
      more detail on the utility.
 
@@ -52,17 +52,27 @@
 
      The following keywords are reserved:
 
-     automatic                 between                        binary
-     break                     condition                      default
-     dense                     direction                      discard
-     else                      error                          escapeseq
-     false                     if                             index
-     init                      input                          inputsize
-     map                       maptype                        no_change_copy
-     non_identical_conversion  non_identical_count_increment  operation       |
-     output                    output_byte_length             outputsize      |
-     printchr                  printhd                        printint        |
-     reset                     return                         true            |
+     automatic                     between                                    |
+     binary                        break                                      |
+     condition                     default                                    |
+     dense                         direction                                  |
+     disable                       discard                                    |
+     else                          enable                                     |
+     error                         escapeseq                                  |
+     false                         if                                         |
+     illegal_discard               illegal_replace_hex                        |
+     illegal_restore_hex           index                                      |
+     init                          input                                      |
+     inputsize                     map                                        |
+     maptype                       no_change_copy                             |
+     non_identical_conversion      non_identical_count_increment              |
+     non_identical_discard         non_identical_replace_hex                  |
+     non_identical_restore_hex     non_identical_transliterate                |
+     operation                     output                                     |
+     output_byte_length            outputsize                                 |
+     printchr                      printhd                                    |
+     printint                      reset                                      |
+     return                        true                                       |
 
      Additionally, the following symbols  are  also  reserved  as
      tokens:
@@ -485,6 +495,83 @@
      The control operation expression can be any one of the  fol-
      lowing expressions:
 
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_DISCARD" is disabled and               |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable illegal_discard;                                               |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_REPLACE_HEX" is disabled and           |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable illegal_replace_hex;                                           |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_RESTORE_HEX" is disabled and           |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable illegal_restore_hex;                                           |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_DISCARD" is disabled and         |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable non_identical_discard;                                         |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_REPLACE_HEX" is disabled and     |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable non_identical_replace_hex;                                     |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_RESTORE_HEX" is disabled and     |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable non_identical_restore_hex;                                     |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_TRANSLITERATE" is disabled and   |
+       // not supported by the current conversion. By default,                |
+       // it is enabled:                                                      |
+       disable non_identical_transliterate;                                   |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_DISCARD" is enabled and                |
+       // supported by the current conversion:                                |
+       enable illegal_discard;                                                |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_REPLACE_HEX" is enabled and            |
+       // supported by the current conversion:                                |
+       enable illegal_replace_hex;                                            |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//ILLEGAL_RESTORE_HEX" is enabled and            |
+       // supported by the current conversion:                                |
+       enable illegal_restore_hex;                                            |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_DISCARD" is enabled and          |
+       // supported by the current conversion:                                |
+       enable non_identical_discard;                                          |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_REPLACE_HEX" is enabled and      |
+       // supported by the current conversion:                                |
+       enable non_identical_replace_hex;                                      |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_RESTORE_HEX" is enabled and      |
+       // supported by the current conversion:                                |
+       enable non_identical_restore_hex;                                      |
+                                                                              |
+       // When specified, the support for code conversion behavior            |
+       // modification with "//NON_IDENTICAL_TRANSLITERATE" is enabled and    |
+       // supported by the current conversion:                                |
+       enable non_identical_transliterate;                                    |
+                                                                              |
        // Return (size_t)-1 as the return value with an EINVAL errno:
        error;
 
@@ -538,6 +625,21 @@
        // 10 input buffer bytes:
        map Map_ISO8859_1_to_US_ASCII 10;
 
+     When illegal_discard, illegal_replace_hex, illegal_restore_hex,          |
+     non_identical_discard, non_identical_replace_hex,                        |
+     non_identical_restore_hex, non_identical_transliterate, or any           |
+     combination of them are enabled and one or more of corresponding         |
+     valid conversion behavior modifications are requested, the current       |
+     code conversion transparently and automatically does necessary           |
+     conversions on non-identical characters, illegal characters, or both     |
+     as specified in iconv_open(3C). In so doing, if requested and to         |
+     properly transliterate non-identical characters, at least a mapping      |
+     table for non_identical_transliterate is needed which is described at    |
+     the map element description at below. Alternatively, instead of          |
+     the non_identical_transliterate mapping table, an algorithmic mapping    |
+     can also be supplied. For more detail on the code conversion             |
+     behavior modification requests, refer to iconv_open(3C).                 |
+                                                                              |
      In case of init and reset operations, if there  is  no  pre-
      defined  init  and/or  reset  operations  in  the iconv code
      conversions, only system-defined  internal  init  and  reset
@@ -577,6 +679,21 @@
 
        }
 
+     If the name of the map element is non_identical_transliterate,           |
+     it defines the mapping table that is solely used for non-identical       |
+     character conversion mappings if and only if non_identical_transliterate |
+     conversion behavior modification is enabled and supported, requested     |
+     with iconv_open() or iconvctl() call, and there are one or more map      |
+     pairs with non_identical_conversion defined in other map elements:       |
+                                                                              |
+       map non_identical_transliterate {                                      |
+                                                                              |
+            // one or more map pairs of transliterations for                  |
+            // non-identical characters here                                  |
+            :                                                                 |
+            :                                                                 |
+       }                                                                      |
+                                                                              |
      Each map element also can have one  or  two  comma-separated
      map attribute elements like the following examples:
 
@@ -661,6 +778,12 @@
        // the code value 0x20 to an output character value 0x21:
        0x20        0x21
 
+       // Single mapping with non-identical character conversion indication.  |
+       // This maps an input character denoted by the code value 0x20 to      |
+       // an output character value 0x3f. Each of such mappings also          |
+       // increases the non-identical character conversion count by one:      |
+       0x20        0x3f    non_identical_conversion                           |
+                                                                              |
        // Multiple mapping. This maps 128 input characters to 128
        // output characters. In this mapping, 0x0 maps to 0x10, 0x1 maps
        // to 0x11, 0x2 maps to 0x12, ..., and, 0x7f maps to 0x8f:
@@ -669,8 +792,9 @@
        // Multiple mapping with non-identical character conversion            |
        // indication. This maps 128 input characters to 128 output            |
        // characters. In this mapping, 0x0 maps to 0x10, 0x1 maps to 0x11,    |
-       // 0x2 maps to 0x12, ..., and, 0x7f maps to 0x8f. Each mapping also    |
-       // increases the non-identical character conversion count by one:      |
+       // 0x2 maps to 0x12, ..., and, 0x7f maps to 0x8f. Each of such         |
+       // mappings also increases the non-identical character conversion      |
+       // count by one:                                                       |
        0x0...0x7f  0x10    non_identical_conversion                           |
                                                                               |
        // Default mapping. If specified, every undefined input character
@@ -682,8 +806,8 @@
        // indication. If specified, every undefined input character in        |
        // this mapping will be converted to a specified character (in         |
        // the following case, a character with the code value of 0x3f).       |
-       // Each mapping also increases the non-identical character conversion  |
-       // count by one:                                                       |
+       // Each of such mappings also increases the non-identical character    |
+       // conversion count by one:                                            |
        default     0x3f    non_identical_conversion                           |
                                                                               |
        // Default mapping. If specified, every undefined input character
@@ -693,9 +817,9 @@
 
        // Default mapping with direct copying and with non-identical          |
        // character conversion indication. If specified, every undefined      |
-       // input character in this mapping will not be converted but           |
-       // directly copied to the output buffer.                               |
-       // Each mapping will also increase the non-identical character         |
+       // input character in this mapping will be directly copied to          |
+       // the output buffer without any change in byte values. Each of such   |
+       // mappings will also increase the non-identical character             |
        // conversion count by one:                                            |
        default     no_change_copy    non_identical_conversion                 |
                                                                               |
@@ -787,12 +911,16 @@
         escseq  : HEXADECIMAL
                 ;
 
-        map     : 'map' NAME '{' map_list '}'
+        map     : 'map' map_name '{' map_list '}'                             |
                 | 'map' '{' map_list '}'
-                | 'map' NAME map_attribute '{' map_list '}'
+                | 'map' map_name map_attribute '{' map_list '}'               |
                 | 'map' map_attribute '{' map_list '}'
                 ;
 
+        map_name: NAME                                                        |
+                | 'non_identical_transliterate'                               |
+                ;                                                             |
+                                                                              |
         map_attribute
                 : map_type ',' 'output_byte_length' '=' DECIMAL
                 | map_type
@@ -842,9 +970,11 @@
 
         op_unit : ';'
                 | expr ';'
+                | 'enable' enable_disable_options ';'                         |
                 | 'error' ';'
                 | 'error' expr ';'
                 | 'discard' ';'
+                | 'disable' enable_disable_options ';'                        |
                 | 'discard' expr ';'
                 | 'non_identical_count_increment' ';'                         |
                 | 'output' '=' expr ';'
@@ -861,6 +991,16 @@
                 | 'printint' expr ';'
                 ;
 
+        enable_disable_options                                                |
+                : 'illegal_discard'                                           |
+                | 'illegal_replace_hex'                                       |
+                | 'illegal_restore_hex'                                       |
+                | 'non_identical_discard'                                     |
+                | 'non_identical_replace_hex'                                 |
+                | 'non_identical_restore_hex'                                 |
+                | 'non_identical_transliterate'                               |
+                ;                                                             |
+                                                                              |
         op_if_else
                 : 'if' '(' expr ')' '{' op_list '}'
                 | 'if' '(' expr ')' '{' op_list '}' 'else' op_if_else
@@ -1026,6 +1166,47 @@
                         };
                     };
                }
+                                                                              |
+     Example 3 Code conversion from ISO8859-1 to ISO646 with transliterations |
+                                                                              |
+       ISO8859-1%ISO646 {                                                     |
+                 // A possible set of loose and minimal transliterations.     |
+                 map non_identical_transliterate {                            |
+                         0xaa            0x61        // a                     |
+                         0xb2            0x32        // 2                     |
+                         0xb3            0x33        // 3                     |
+                         0xb9            0x31        // 1                     |
+                         0xba            0x6f        // o                     |
+                         0xbc            0x312f34    // 1/4                   |
+                         0xbd            0x312f32    // 1/2                   |
+                         0xbe            0x332f34    // 3/4                   |
+                         0xc6            0x4145      // AE                    |
+                         0xe6            0x6165      // ae                    |
+                 };                                                           |
+                                                                              |
+                 // The default mapping table to be used.                     |
+                 map maptype = automatic {                                    |
+                         default         0x3f    non_identical_conversion     |
+                         0x0...0x7f      0x0                                  |
+                 };                                                           |
+         }                                                                    |
+                                                                              |
+     Example 4 Code conversion from ISO8859-1 to ISO646 with the support for  |
+               discarding of non-identical characters disabled                |
+                                                                              |
+       ISO8859-1%ISO646 {                                                     |
+                 // This conversion does not support the conversion behavior  |
+                 // modification request with "//NON_IDENTICAL_DISCARD".      |
+                 operation init {                                             |
+                         disable non_identical_discard;                       |
+                 };                                                           |
+                                                                              |
+                 // The default mapping table to be used.                     |
+                 map {                                                        |
+                         default         0x3f    non_identical_conversion     |
+                         0x0...0x7f      0x0                                  |
+                 };                                                           |
+         }                                                                    |
 
 
 FILES
@@ -1043,7 +1224,8 @@
 
 SEE ALSO
      cpp(1),      geniconvtbl(1),      iconv(1),       iconv(3C),
-     iconv_close(3C), iconv_open(3C), attributes(5), environ(5)
+     iconv_close(3C), iconvctl(3C), iconv_open(3C), iconvstr(3C),             |
+     attributes(5), environ(5)                                                |
 
 
 NOTES
