This is MacToNeXTRTFText.m in view mode; [Download] [Up]
/***********************************************************************\ character conversion class for Convert RTF which converts between Mac and NeXT rtf formats. Copyright (C) 1993 David John Burrowes This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author, David John Burrowes, can be reached at: davidjohn@kira.net.netcom.com David John Burrowes 1926 Ivy #10 San Mateo, CA 94403-1367 \***********************************************************************/ /*==================================================================== NOTE: You may find that text doesn't line up properly unless you use the New Century Schoolbook Roman typeface, since this was created with it. INFORMATION: This is $Revision: 1.9 $ of this file It was last modified by $Author: death $ on $Date: 93/04/04 23:28:02 $ $Log: MacToNeXTRTFText.m,v $ Revision 1.9 93/04/04 23:28:02 death Sun Apr 4 23:28:02 PDT 1993 Revision 1.8 93/02/21 11:59:51 death Sun Feb 21 11:59:50 PST 1993 Revision 1.7 93/01/10 08:27:17 death Sun Jan 10 08:27:17 PST 1993 Revision 1.6 93/01/02 23:41:27 death Sat Jan 2 23:41:27 PST 1993 Revision 1.5 93/01/02 13:38:55 death Sat Jan 2 13:38:55 PST 1993 Revision 1.4 92/12/25 16:26:14 death Fri Dec 25 16:26:13 PST 1992 Revision 1.3 92/12/21 07:00:44 death Mon Dec 21 07:00:43 PST 1992 Revision 1.2 92/12/19 08:18:16 death Sat Dec 19 08:18:15 PST 1992 Revision 1.1 92/12/13 10:01:01 death Sun Dec 13 10:01:00 PST 1992 ====================================================================*/ #import "MacToNeXTRTFText.h" #import <memory.h> // for memcpy #include <strings.h> @implementation MacToNeXTRTFText ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Routine: ConvertCharacter: // Parameters: a character to be converted // Returns: the converted character // Stores: the character that we are returning. // Description: // This uses the ConvertArray set up in the initialization to convert // a character from a Mac character set to a NeXT. It allows for strict // adherance to the table in Inside Mac vol 1. p. 221. It returns the converted // character and a result code based on its succes. // Bugs: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (Character) ConvertCharacter: (Character) theCharacter { Character result; Boolean couldconvert = YES; Boolean usedSymbol = NO; [self ResetResults]; // // Determine if we are doing 'strict inside mac vol 1 p. 221' conversions. // if so, and the character is undefind in IM, return character literally. // if ((theCharacter > 0xD8) && (StrictIM == YES)) result = theCharacter; else { // // In general, look up our result in the conversion array. if we get a // null back (and we don't didn't pass a null), indicate we could not // convet properly. // result = ConvertArray[theCharacter]; if ((result == NullCharacter) && (theCharacter != NullCharacter)) { usedSymbol = YES; switch (theCharacter) { case 0xA1: // (degree) result = 0xB0; break; case 0xAA: // (trademarkserif) result = 0xD4; break; case 0xAD: // (notequal) result = 0xB9; break; case 0xB0: // (infinity) result = 0xA5; break; case 0xB2: // (lessequal) result = 0xA3; break; case 0xB3: // (greaterequal) result = 0xB3; break; case 0xB6: // (partialdiff) result = 0xB6; break; case 0xB7: // (summation) result = 0xE5; break; case 0xB8: // (product) result = 0xD5; break; case 0xB9: // (pi) result = 0x70; break; case 0xBA: // (integral) result = 0xF2; break; case 0xBD: // (Omega) result = 0x57; break; case 0xC3: // (radical) result = 0xd6; break; case 0xC5: // (approxequal) result =0xBB; break; case 0xC6: // (delta) result = 0x44; break; case 0xD7: // (lozenge) result = 0xE0; break; case 0xD9: // (Ydieresis) (usually a picture in IM fonts) case 0x11: // (commandsymbol) case 0x12: // (check) case 0x13: // (diamond) case 0x14: // (apple) case 0xF0: // (apple) default: result = theCharacter; couldconvert = NO; usedSymbol = NO; break; } } } // // Store the result, and return. // [self PutCharacter: result Into: FIRST_RESULT]; if (usedSymbol == YES) [self PutBoolean: YES Into: SECOND_RESULT]; else [self PutBoolean: NO Into: SECOND_RESULT]; if (couldconvert == YES) [self StoreErrorCode: errOK AndText: "Character converted!"]; else [self StoreErrorCode: errCANTMAPTOONE AndText: "No equivalent standard NeXTSTEP character"]; return result; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.