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

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990, 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. #include "recode.h"
  21.  
  22. /* Data for Apple Macintosh to ISO Latin-1 code conversions.  */
  23.  
  24. static KNOWN_PAIR known_pairs[] =
  25.   {
  26.     { 13,  10},            /* (recoding end of lines for Unix) */
  27.  
  28.     {128, 196},            /* capital letter A diaeresis */
  29.     {129, 197},            /* capital letter A with ring above */
  30.     {130, 199},            /* capital letter C with cedilla */
  31.     {131, 201},            /* capital letter E with acute accent */
  32.     {132, 209},            /* capital letter N with tilde */
  33.     {133, 214},            /* capital letter O with diaeresis */
  34.     {134, 220},            /* capital letter U with diaeresis */
  35.     {135, 225},            /* small letter a with acute accent */
  36.     {136, 224},            /* small letter a with grave accent */
  37.     {137, 226},            /* small letter a with circumflex accent */
  38.     {138, 228},            /* small letter a with diaeresis */
  39.     {139, 227},            /* small letter a with tilde */
  40.     {140, 229},            /* small letter a with ring above */
  41.     {141, 231},            /* small letter c with cedilla */
  42.     {142, 233},            /* small letter e with acute accent */
  43.     {143, 232},            /* small letter e with grave accent */
  44.     {144, 234},            /* small letter e with circumflex accent */
  45.     {145, 235},            /* small letter e with diaeresis */
  46.     {146, 237},            /* small letter i with acute accent */
  47.     {147, 236},            /* small letter i with grave accent */
  48.     {148, 238},            /* small letter i with circumflex accent */
  49.     {149, 239},            /* small letter i with diaeresis */
  50.     {150, 241},            /* small letter n with tilde */
  51.     {151, 243},            /* small letter o with acute accent */
  52.     {152, 242},            /* small letter o with grave accent */
  53.     {153, 244},            /* small letter o with circumflex accent */
  54.     {154, 246},            /* small letter o with diaeresis */
  55.     {155, 245},            /* small letter o with tilde */
  56.     {156, 250},            /* small letter u with acute accent */
  57.     {157, 249},            /* small letter u with grave accent */
  58.     {158, 251},            /* small letter u with circumflex accent */
  59.     {159, 252},            /* small letter u with diaeresis */
  60.  
  61.     {161, 176},            /* degree sign */
  62.     {162, 162},            /* cent sign */
  63.     {163, 163},            /* pound sign */
  64.     {164, 167},            /* paragraph sign, section sign */
  65.  
  66.     {166, 182},            /* pilcrow sign */
  67.     {167, 223},            /* small german letter sharp s */
  68.     {168, 174},            /* registered trade mark sign */
  69.     {169, 169},            /* copyright sign */
  70.  
  71.     {174, 198},            /* capital diphthong A with E */
  72.     {175, 216},            /* capital letter O with oblique stroke */
  73.  
  74.     {177, 177},            /* plus-minus sign */
  75.  
  76.     {180, 165},            /* yen sign */
  77.     {181, 181},            /* small greek letter mu, micro sign */
  78.  
  79.     {187, 170},            /* feminine ordinal indicator */
  80.     {188, 186},            /* masculine ordinal indicator */
  81.  
  82.     {190, 230},            /* small diphthong a with e */
  83.     {191, 248},            /* small letter o with oblique stroke */
  84.     {192, 191},            /* inverted question mark */
  85.     {193, 161},            /* inverted exclamation mark */
  86.     {194, 172},            /* not sign */
  87.  
  88.     {199, 171},            /* left angle quotation mark */
  89.     {200, 187},            /* right angle quotation mark */
  90.  
  91.     {203, 192},            /* capital letter A with grave accent */
  92.     {204, 195},            /* capital letter A with tilde */
  93.     {205, 213},            /* capital letter O with tilde */
  94.  
  95.     {214, 247},            /* division sign */
  96.  
  97.     {216, 255},            /* small letter y with diaeresis */
  98.     {217, 221},            /* capital letter Y with acute accent */
  99.  
  100.     {229, 194},            /* capital letter A with circumflex accent */
  101.     {230, 202},            /* capital letter E with circumflex accent */
  102.     {231, 193},            /* capital letter A with acute accent */
  103.     {232, 203},            /* capital letter E with diaeresis */
  104.     {233, 200},            /* capital letter E with grave accent */
  105.     {234, 205},            /* capital letter I with acute accent */
  106.     {235, 206},            /* capital letter I with circumflex accent */
  107.     {236, 207},            /* capital letter I with diaeresis */
  108.     {237, 204},            /* capital letter I with grave accent */
  109.     {238, 211},            /* capital letter O with acute accent */
  110.     {239, 212},            /* capital letter O with circumflex accent */
  111.  
  112.     {241, 210},            /* capital letter O with grave accent */
  113.     {242, 218},            /* capital letter U with acute accent */
  114.     {243, 219},            /* capital letter U with circumflex accent */
  115.     {244, 217},            /* capital letter U with grave accent */
  116.   };
  117. #define NUMBER_OF_PAIRS (sizeof (known_pairs) / sizeof (KNOWN_PAIR))
  118.  
  119. static void
  120. init_latin1_applemac (STEP *step)
  121. {
  122.   complete_pairs (step, 1, known_pairs, NUMBER_OF_PAIRS, 1);
  123. }
  124.  
  125. static void
  126. init_applemac_latin1 (STEP *step)
  127. {
  128.   complete_pairs (step, 1, known_pairs, NUMBER_OF_PAIRS, 0);
  129. }
  130.  
  131. void
  132. module_applemac (void)
  133. {
  134. #if 0
  135.   declare_alias ("applemac", "macintosh");
  136. #endif
  137.  
  138.   declare_step ("latin1", "applemac",
  139.         strict_mapping ? ONE_TO_MANY : REVERSIBLE,
  140.         init_latin1_applemac, NULL);
  141.   declare_step ("applemac", "latin1",
  142.         strict_mapping ? ONE_TO_MANY : REVERSIBLE,
  143.         init_applemac_latin1, NULL);
  144. }
  145.