|
From: creedon <icr...@us...> - 2006-02-27 01:23:58
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24603 Modified Files: strings.c stringverbs.c Log Message: added string.macRomanToUtf8 and string.utf8ToMacRoman Index: strings.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/strings.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** strings.c 8 Feb 2006 21:35:17 -0000 1.9 --- strings.c 27 Feb 2006 01:23:52 -0000 1.10 *************** *** 2690,2695 **** --- 2690,2736 ---- } /*for*/ } /*initstrings*/ + + + boolean macromantoutf8 (Handle h, Handle hresult) { + + /* + 2006-02-24 creedon: convert from Mac Roman character set to UTF-8, cribbed from ansitoutf8 + */ + #ifdef WIN95VERSION + + langerrormessage ("\x92" "Direct Mac Roman to UTF-8 string conversion currently only works on Mac OS. On Windows string.macToLatin and string.ansiToUtf8 verbs can be used."); + + #endif + #ifdef MACVERSION + converttextencoding (h, hresult, kTextEncodingMacRoman, 0x08000100); + #endif + + return (true); + } /* macromantoutf8 */ + + + boolean utf8tomacroman (Handle h, Handle hresult) { + + /* + 2006-02-26 creedon: convert from UTF-8 character set to Mac Roman, cribbed from utf8toansi + */ + + #ifdef WIN95VERSION + + langerrormessage ("\x92" "Direct UTF-8 to Mac Roman string conversion currently only works on Mac OS. On Windows string.utf8ToAnsi and string.latinToMac verbs can be used."); + + #endif + + #ifdef MACVERSION + + converttextencoding (h, hresult, 0x08000100, kTextEncodingMacRoman); + + #endif + + return (true); + } /* utf8tomacroman */ + Index: stringverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/stringverbs.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stringverbs.c 15 Aug 2005 20:49:53 -0000 1.11 --- stringverbs.c 27 Feb 2006 01:23:52 -0000 1.12 *************** *** 308,311 **** --- 308,315 ---- multiplereplaceallfunc, /*7.1b17 PBS*/ + macromantoutf8func, // 2006-02-25 creedon + + utf8tomacromanfunc, // 2006-02-25 creedon + ctstringverbs } tystringtoken; *************** *** 1369,1372 **** --- 1373,1378 ---- string, creates a new handle sized precisely for the output string, and copies two parts from the input to the output (substrings before and after the deleted chars) + + 2006-02-25 creedon: added macRomanToUtf8 and utf8ToMacRoman */ *************** *** 2257,2260 **** --- 2263,2302 ---- } + case macromantoutf8func: { /* 2006-02-25 creedon: convert mac roman character set to utf-8 */ + + Handle h, hresult; + + flnextparamislast = true; + + if (!getexempttextvalue (hp1, 1, &h)) + return (false); + + newemptyhandle (&hresult); + + macromantoutf8 (h, hresult); + + disposehandle (h); + + return (setheapvalue (hresult, stringvaluetype, v)); + } + + case utf8tomacromanfunc: { /* 2006-02-25 creedon: convert utf-8 character set to mac roman */ + + Handle h, hresult; + + flnextparamislast = true; + + if (!getexempttextvalue (hp1, 1, &h)) + return (false); + + newemptyhandle (&hresult); + + utf8tomacroman (h, hresult); + + disposehandle(h); + + return (setheapvalue (hresult, stringvaluetype, v)); + } + default: errornum = notimplementederror; *************** *** 2287,2292 **** return (loadfunctionprocessor (idstringverbs, &stringfunctionvalue)); } /*stringinitverbs*/ - - - --- 2329,2331 ---- |