home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / GRECODE / NEXTSTEP.C < prev    next >
C/C++ Source or Header  |  1993-12-22  |  7KB  |  208 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1993 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1993.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful, but
  11.    WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /* Define for using new double step code.  */
  21. #define USE_DOUBLE_STEP 1
  22.  
  23. #include "recode.h"
  24.  
  25. #ifdef USE_DOUBLE_STEP
  26.  
  27. /* RFC 1345 style description for NeXTSTEP (non official).  */
  28.  
  29. /* In the following table, these codes are not represented:
  30.  
  31.     Dec Oct     Character
  32.  
  33.     166 246     florin
  34.     169 251     single quote
  35.     172 254     gouillemot single left
  36.     173 255     gouillemot single right
  37.     184 270     single quote base
  38.     185 271     double qoute base
  39.     205 315     hungarian umlaut
  40. */
  41.  
  42. static DOUBLE_TABLE table =
  43.   {
  44.     "NUSHSXEXETEQAKBLBSHTLFVTFFCRSOSIDLD1D2D3D4NKSYEBCNEMSBECFSGSRSUS",
  45.     "SP! \" NbDO% & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? ",
  46.     "AtA B C D E F G H I J K L M N O P Q R S T U V W X Y Z <(//)>'>_ ",
  47.     "'!a b c d e f g h i j k l m n o p q r s t u v w x y z (!!!!)'?DT",
  48.     "NSA!A'A>A?A:AAC,E!E'E>E:I!I'I>I:D-N?O!O'O>O?O:U!U'U>U:Y'THMy*X-:",
  49.     "Co!ICtPd/fYe  SECu  \"6<<    fiflRg-N/-/=.MBBPISb    \"9>>.3%0NO?I",
  50.     "1S'!'''>'?'m'('.':2S'0',3S  ';'<-M+-141234a!a'a>a?a:aac,e!e'e>e:",
  51.     "i!AEi'-ai>i:d-n?L/O/OE-oo!o'o>o?o:aeu!u'u>i.u:y'l/o/oessthy:    ",
  52.   };
  53.  
  54. #else /* not USE_DOUBLE_STEP */
  55.  
  56. /* Data for NeXTSTEP to ISO Latin-1 code conversions.  */
  57.  
  58. static KNOWN_PAIR known_pairs[] =
  59.   {
  60.     {128, 160},            /* non-breakable space */
  61.     {129, 192},            /* A with accent grave */
  62.     {130, 193},            /* A with accent acute */
  63.     {131, 194},            /* A with circumflex  */
  64.     {132, 195},            /* A with tilde */
  65.     {133, 196},            /* A with dieresis  */
  66.     {134, 197},            /* A with ring  */
  67.     {135, 199},            /* C with cedilla */
  68.     {136, 200},            /* E with accent grave */
  69.     {137, 201},            /* E with accent acute */
  70.     {138, 202},            /* E with circumflex */
  71.     {139, 203},            /* E with dieresis */
  72.     {140, 204},            /* I with accent grave */
  73.     {141, 205},            /* I with accent acute */
  74.     {142, 206},            /* I with circumflex */
  75.     {143, 207},            /* I with dieresis */
  76.     {144, 208},            /* capital icelandic Eth */
  77.     {145, 209},            /* N with tilde */
  78.     {146, 210},            /* O with accent grave */
  79.     {147, 211},            /* O with accent acute */
  80.     {148, 212},            /* O with circumflex */
  81.     {149, 213},            /* O with tilde */
  82.     {150, 214},            /* O with dieresis */
  83.     {151, 217},            /* U with accent grave */
  84.     {152, 218},            /* U with accent acute */
  85.     {153, 219},            /* U with circumflex */
  86.     {154, 220},            /* U with dieresis */
  87.     {155, 221},            /* Y with accent acute */
  88.     {156, 222},            /* capital icelandig thorn */
  89.     {157, 181},            /* greek letter mu (micro sign) */
  90.     {158, 215},            /* multiply */
  91.     {159, 247},            /* divide */
  92.     {160, 169},            /* copyright */
  93.     {161, 161},            /* inverted exclamation mark */
  94.     {162, 162},            /* cent sign */
  95.     {163, 163},            /* pound sterling sign */
  96.  
  97.     {165, 165},            /* yen sign  */
  98.  
  99.     {167, 167},            /* section (german paragraph) */
  100.     {168, 164},            /* currency sign */
  101.  
  102.     {171, 171},            /* gouillemot left */
  103.  
  104.     {176, 174},            /* registered trademark */
  105.  
  106.     {180, 183},            /* centered period */
  107.     {181, 166},            /* broken bar */
  108.     {182, 182},            /* paragraph sign */
  109.  
  110.     {187, 187},            /* gouillemot right */
  111.  
  112.     {190, 172},            /* logical not */
  113.     {191, 191},            /* inverted question mark */
  114.     {192, 185},            /* superscript one */
  115.  
  116.     {194, 180},            /* accent acute */
  117.  
  118.     {197, 175},            /* macron */
  119.  
  120.     {200, 168},            /* dieresis */
  121.     {201, 178},            /* superscript two */
  122.     {202, 176},            /* ring */
  123.     {203, 184},            /* cedilla */
  124.     {204, 179},            /* superscript 3 */
  125.  
  126.     {209, 177},            /* plusminus */
  127.     {210, 188},            /* 1/4 */
  128.     {211, 189},            /* 1/2 */
  129.     {212, 190},            /* 3/4 */
  130.     {213, 224},            /* a with accent grave */
  131.     {214, 225},            /* a with accent acute */
  132.     {215, 226},            /* a with circumflex */
  133.     {216, 227},            /* a with tilde */
  134.     {217, 228},            /* a with dieresis */
  135.     {218, 229},            /* a with ring */
  136.     {219, 231},            /* c with cedilla */
  137.     {220, 232},            /* e with accent grave */
  138.     {221, 233},            /* e with accent acute */
  139.     {222, 234},            /* e with circumflex */
  140.     {223, 235},            /* e with dieresis */
  141.     {224, 236},            /* i with accent grave */
  142.     {225, 198},            /* AE */
  143.     {226, 237},            /* i with accent acute */
  144.     {227, 170},            /* feminine ordinal indicator */
  145.     {228, 238},            /* i with circumflex */
  146.     {229, 239},            /* i with dieresis */
  147.     {230, 240},            /* small icelandic eth */
  148.     {231, 241},            /* n with tilde */
  149.  
  150.     {233, 216},            /* O with slash */
  151.  
  152.     {235, 186},            /* masculine ordinal indicator */
  153.     {236, 242},            /* o with accent grave */
  154.     {237, 243},            /* o with accent acute */
  155.     {238, 244},            /* o with circumflex */
  156.     {239, 245},            /* o with tilde */
  157.     {240, 246},            /* o with dieresis */
  158.     {241, 230},            /* ae */
  159.     {242, 249},            /* u with accent grave */
  160.     {243, 250},            /* u with accent acute */
  161.     {244, 251},            /* u with circumflex */
  162.  
  163.     {246, 252},            /* u with dieresis */
  164.     {247, 253},            /* y with accent acute */
  165.  
  166.     {249, 248},            /* o with slash */
  167.  
  168.     {251, 223},            /* german sz */
  169.     {252, 254},            /* small icelandic thorn */
  170.     {253, 255},            /* y with dieresis */
  171.   };
  172. #define NUMBER_OF_PAIRS (sizeof (known_pairs) / sizeof (KNOWN_PAIR))
  173.  
  174. static void
  175. init_latin1_nextstep (STEP *step)
  176. {
  177.   complete_pairs (step, 1, known_pairs, NUMBER_OF_PAIRS, 1);
  178. }
  179.  
  180. static void
  181. init_nextstep_latin1 (STEP *step)
  182. {
  183.   complete_pairs (step, 1, known_pairs, NUMBER_OF_PAIRS, 0);
  184. }
  185.  
  186. #endif /* not USE_DOUBLE_STEP */
  187.  
  188. void
  189. module_nextstep (void)
  190. {
  191.  
  192. #ifdef USE_DOUBLE_STEP
  193.  
  194.   declare_double_step (&table, "NeXTSTEP", 2);
  195.  
  196. #else /* not USE_DOUBLE_STEP */
  197.  
  198.   declare_step ("latin1", "nextstep",
  199.         strict_mapping ? ONE_TO_MANY : REVERSIBLE,
  200.         init_latin1_nextstep, NULL);
  201.   declare_step ("nextstep", "latin1",
  202.         strict_mapping ? ONE_TO_MANY : REVERSIBLE,
  203.         init_nextstep_latin1, NULL);
  204.  
  205. #endif /* not USE_DOUBLE_STEP */
  206.  
  207. }
  208.