You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(447) |
Nov
(163) |
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(172) |
Feb
|
Mar
(123) |
Apr
(64) |
May
(1) |
Jun
(278) |
Jul
(89) |
Aug
(97) |
Sep
(62) |
Oct
(53) |
Nov
(119) |
Dec
(60) |
| 2006 |
Jan
(76) |
Feb
(1094) |
Mar
(363) |
Apr
(163) |
May
(57) |
Jun
(43) |
Jul
(39) |
Aug
(15) |
Sep
(33) |
Oct
(62) |
Nov
(8) |
Dec
|
| 2007 |
Jan
(9) |
Feb
(34) |
Mar
(2) |
Apr
(14) |
May
(8) |
Jun
(40) |
Jul
(21) |
Aug
(1) |
Sep
(20) |
Oct
(15) |
Nov
(26) |
Dec
|
| 2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <set...@us...> - 2006-05-02 20:17:20
|
Revision: 1339 Author: sethdill Date: 2006-05-02 13:17:16 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1339&view=rev Log Message: ----------- Fixed up the error messages to be more consistent with other errors. Tell the user what couldn't be done and why, not just what went wrong. Modified Paths: -------------- Frontier/trunk/Common/resources/Mac/lang.r Frontier/trunk/Common/resources/Win32/WinLand.rc Modified: Frontier/trunk/Common/resources/Mac/lang.r =================================================================== --- Frontier/trunk/Common/resources/Mac/lang.r 2006-05-02 20:04:56 UTC (rev 1338) +++ Frontier/trunk/Common/resources/Mac/lang.r 2006-05-02 20:17:16 UTC (rev 1339) @@ -1033,17 +1033,17 @@ /* [1] */ "Internal error running \xD2string.^0\xD3.", /* [2] */ - "Unknown error converting character set.", + "Can't convert character set because of an unknown error.", /* [3] - Mac OSStatus: kTextUnsupportedEncodingErr */ - "The character set (^0) is not supported.", + "Can't convert character set because \xD2^0\xD3 is not supported.", /* [4] - Mac OSStatus: kTextMalformedInputErr */ - "The text input contains a sequence that is not legal in the specified encoding (^0).", + "Can't convert character set because the text contains a sequence that is not legal in the specified character set (^0).", /* [5] - Mac OSStatus: kTextUndefinedElementErr */ - "The text input contains a code point that is undefined in the specified character set (^0). The conversion could not be completed.", + "Can't convert character set because the text contains a code point that is undefined in the specified character set (^0).", /* [6] - Mac OSStatus: kTECNoConversionPathErr */ - "There is no way to convert from the character set \xD2^0\xD3 to \xD2^1\xD3.", + "Can't convert character set because there is no way to convert from \xD2^0\xD3 to \xD2^1\xD3.", /* [7] - Mac OSStatus: kTECPartialCharErr */ - "The text input ends in the middle of a multibyte character. Conversion canceled." + "Can't convert character set because the text ends in the middle of a multibyte character." } }; Modified: Frontier/trunk/Common/resources/Win32/WinLand.rc =================================================================== --- Frontier/trunk/Common/resources/Win32/WinLand.rc 2006-05-02 20:04:56 UTC (rev 1338) +++ Frontier/trunk/Common/resources/Win32/WinLand.rc 2006-05-02 20:17:16 UTC (rev 1339) @@ -1638,12 +1638,12 @@ 1 File_Errors DISCARDABLE BEGIN "Internal error running \042file.^0\042.\0" END 1 String_Errors DISCARDABLE BEGIN "Internal error running \042string.^0\042.\0" END - 2 String_Errors DISCARDABLE BEGIN "Unknown error converting character set.\0" END - 3 String_Errors DISCARDABLE BEGIN "The character set (^0) is not supported.\0" END - 4 String_Errors DISCARDABLE BEGIN "The text input contains a byte sequence that is not legal in the specified character set (^0).\0" END - 5 String_Errors DISCARDABLE BEGIN "The text input contains a code point that is undefined in the specified character set (^0). The conversion could not be completed.\0" END - 6 String_Errors DISCARDABLE BEGIN "There is no way to convert from the character set \042^0\042 to \042^1\042.\0" END - 7 String_Errors DISCARDABLE BEGIN "The text input ends in the middle of a multibyte character. Conversion canceled.\0" END + 2 String_Errors DISCARDABLE BEGIN "Can't convert character set because of an unknown error.\0" END + 3 String_Errors DISCARDABLE BEGIN "Can't convert character set because \042^0\042 is not supported.\0" END + 4 String_Errors DISCARDABLE BEGIN "Can't convert character set because the text contains a sequence that is not legal in the specified character set (^0).\0" END + 5 String_Errors DISCARDABLE BEGIN "Can't convert character set because the text contains a code point that is undefined in the specified character set (^0).\0" END + 6 String_Errors DISCARDABLE BEGIN "Can't convert character set because there is no way to convert from \042^0\042 to \042^1\042.\0" END + 7 String_Errors DISCARDABLE BEGIN "Can't convert character set because the text ends in the middle of a multibyte character.\0" END 1 WP_Verb_Errors DISCARDABLE BEGIN "Can't do \042wp.^0\042 because the target window is not in edit mode, or does not contain editable text.\0" END 2 WP_Verb_Errors DISCARDABLE BEGIN "The address of a wptext object was expected here.\0" END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-05-02 20:05:06
|
Revision: 1338 Author: sethdill Date: 2006-05-02 13:04:56 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1338&view=rev Log Message: ----------- Slightly better error reporting on Windows when converting character sets. If the requested set doesn't exist, throw the same error as is seen on the mac. Also, getTextEncodingId sets an error if the id doesn't exist, so isTextEncodingAvailable now clears that error if it is returning false. (The point of the boolean function is to avoid the error.) Modified Paths: -------------- Frontier/trunk/Common/source/strings.c Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-05-02 16:49:55 UTC (rev 1337) +++ Frontier/trunk/Common/source/strings.c 2006-05-02 20:04:56 UTC (rev 1338) @@ -51,11 +51,21 @@ #define stringerrorlist 263 +/* + constants related to text-conversion functions +*/ #define cs_utf8 BIGSTRING( "\xA5" "utf-8" ) #define cs_utf16 BIGSTRING( "\x06" "utf-16" ) #define cs_iso88591 BIGSTRING( "\xA0" "iso-8859-1" ) #define cs_macintosh BIGSTRING( "\x09" "macintosh" ) +#ifdef WIN95VERSION + #define kTextUnsupportedEncodingErr -8738 + #define kTextMalformedInputErr -8739 + #define kTextUndefinedElementErr -8740 + #define kTECNoConversionPathErr -8749 + #define kTECPartialCharErr -8753 +#endif byte zerostring [] = "\0"; /*use this to conserve constant space*/ @@ -74,8 +84,8 @@ static boolean getTextEncodingID( bigstring, long * ); #ifdef WIN95VERSION - static HRESULT UnicodeToAnsi(Handle, Handle, unsigned long); - static HRESULT AnsiToUnicode(Handle, Handle, unsigned long); + static boolean UnicodeToAnsi(Handle, Handle, unsigned long, long *); + static boolean AnsiToUnicode(Handle, Handle, unsigned long, long *); #endif @@ -1724,14 +1734,17 @@ boolean copyPStringToWide( bigstring bs, long * lenResult, wchar_t * outString ) { HRESULT err; - size_t lenOut, lenIn; + size_t lenIn; + bigstring bsCString; lenIn = (size_t) bs[ 0 ]; - convertpstring( bs ); + + copystring( bs, bsCString ); + convertpstring( bsCString ); - lenOut = MultiByteToWideChar( 1252, 0, bs, lenIn, (LPWSTR) outString, 255 ); + *lenResult = (long) MultiByteToWideChar( 1252, 0, bsCString, lenIn, (LPWSTR) outString, 255 ); - if ( lenOut == 0 ) + if ( *lenResult == 0 ) { err = GetLastError(); @@ -1747,6 +1760,8 @@ } } + outString[ *lenResult ] = L'\0'; /* the API doesn't seem to do this consistently */ + return ( true ); } #endif @@ -2343,11 +2358,6 @@ static short getTextEncodingErrorNumFromOSCode( long osStatusCode ) { -#ifdef WIN95VERSION - return 2; -#endif - -#ifdef MACVERSION switch ( osStatusCode ) { case kTextUnsupportedEncodingErr: @@ -2364,7 +2374,6 @@ default: return 2; } -#endif } static void setTextEncodingConversionError( const bigstring encIn, const bigstring encOut, long osStatusCode ) @@ -2399,7 +2408,7 @@ sethandlesize (hresult, cbAnsi); // Convert to ANSI. - lentext = WideCharToMultiByte( encoding, WC_COMPOSITECHECK, (wchar_t *) *h, -1, *hresult, cbAnsi, NULL, NULL); + lentext = WideCharToMultiByte( encoding, 0, (wchar_t *) *h, -1, *hresult, cbAnsi, NULL, NULL); if ( lentext == 0 ) // report error { @@ -2424,7 +2433,6 @@ ULONG cbUni, cCharacters; long lentext; - // unsigned long ix; cCharacters = gethandlesize (h); @@ -2490,7 +2498,7 @@ if ( equalstrings( bsEncodingName, BIGSTRING ("\x06" "utf-16") ) ) { - *encodingId = 0; + *encodingId = 1200; return (true); } @@ -2513,12 +2521,10 @@ copyPStringToWide( bsEncodingName, &lenIanaName, ianaName ); - // pSetInfo = (PMIMECSETINFO)CoTaskMemAlloc( sizeof(MIMECSETINFO) ); - err = pMultiLanguage->lpVtbl->GetCharsetInfo( pMultiLanguage, ianaName, &setInfo ); if ( FAILED( err ) ) { - setTextEncodingConversionError( bsEncodingName, BIGSTRING( "" ), err ); + setTextEncodingConversionError( bsEncodingName, BIGSTRING( "" ), kTextUnsupportedEncodingErr ); pMultiLanguage->lpVtbl->Release( pMultiLanguage ); @@ -2543,7 +2549,15 @@ long encodingId; if ( ! getTextEncodingID( bsEncodingName, &encodingId ) ) + { + /* + if the encoding isn't recognized then getTextEncodingId set an error + we need to clear that error + */ + langerrorclear(); + return (false); + } #ifdef MACVERSION @@ -2554,7 +2568,7 @@ #ifdef WIN95VERSION - // we use 0 to refer to UTF-16 on Windows, as it's the default character set and has no code page + // we use 0 to refer to UTF-16 on Windows, as it's the default character set and seems to have no code page return (true); #endif @@ -2640,7 +2654,8 @@ switch ( inputcharset ) { - case 0: /* unicode with BOM, not handled as a code page. I Hatesk Windows. */ + case 1200: + case 0: /* utf-16le, a.k.a. "unicode" on windows, not handled as a code page. */ sethandlesize (h,lentext + 2); @@ -2649,15 +2664,20 @@ flResult = UnicodeToAnsi( h, hresult, outputcharset, OSStatusCode ); - if ( flStatus && ( (*h) [0] == '\xFF') ) + if ( flResult && ( (*h) [0] == '\xFF') ) pullfromhandle (hresult,0, 1, NULL); /* Pop off the BOM */ + break; + default: { switch ( outputcharset ) { - case 0: /* unicode with BOM, not handled as a code page */ + case 1200: + case 0: /* utf-16le, a.k.a. "unicode" on windows, not handled as a code page */ flResult = AnsiToUnicode( h, hresult, inputcharset, OSStatusCode ); + + break; default: { Handle htemp; @@ -2688,11 +2708,6 @@ } /* switch inputcharset */ - /* - if ( ! flResult ) - *OSStatusCode = (long) GetLastError(); - */ - return ( flResult ); #endif @@ -2805,14 +2820,14 @@ if ( ! AnsiToUnicode (h, htemp, CP_UTF8, &err ) ) /*Convert to UTF-16*/ { - setTextEncodingConversionError( utf8, utf16, err ); + setTextEncodingConversionError( cs_utf8, cs_utf16, err ); return ( false ); } if ( ! UnicodeToAnsi( htemp, hresult, CP_ACP, &err ) ) /*Convert from UTF-16 to ANSI*/ { - setTextEncodingConversionError( utf16, iso88591, err); + setTextEncodingConversionError( cs_utf16, cs_iso88591, err); return ( false ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-05-02 18:24:51
|
Revision: 1337 Author: sethdill Date: 2006-05-02 09:49:55 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1337&view=rev Log Message: ----------- All of the character set conversion verbs should now return error messages. (However, the error message on windows is always the same generic error. Will fix shortly.) Modified Paths: -------------- Frontier/trunk/Common/resources/Mac/lang.r Frontier/trunk/Common/resources/Win32/WinLand.rc Frontier/trunk/Common/source/strings.c Modified: Frontier/trunk/Common/resources/Mac/lang.r =================================================================== --- Frontier/trunk/Common/resources/Mac/lang.r 2006-04-25 22:42:16 UTC (rev 1336) +++ Frontier/trunk/Common/resources/Mac/lang.r 2006-05-02 16:49:55 UTC (rev 1337) @@ -1029,9 +1029,21 @@ }; resource 'STR#' (263, "String Errors", purgeable) { - { /* array StringArray: 1 elements */ + { /* array StringArray: 7 elements */ /* [1] */ - "Internal error running \xD2string.^0\xD3." + "Internal error running \xD2string.^0\xD3.", + /* [2] */ + "Unknown error converting character set.", + /* [3] - Mac OSStatus: kTextUnsupportedEncodingErr */ + "The character set (^0) is not supported.", + /* [4] - Mac OSStatus: kTextMalformedInputErr */ + "The text input contains a sequence that is not legal in the specified encoding (^0).", + /* [5] - Mac OSStatus: kTextUndefinedElementErr */ + "The text input contains a code point that is undefined in the specified character set (^0). The conversion could not be completed.", + /* [6] - Mac OSStatus: kTECNoConversionPathErr */ + "There is no way to convert from the character set \xD2^0\xD3 to \xD2^1\xD3.", + /* [7] - Mac OSStatus: kTECPartialCharErr */ + "The text input ends in the middle of a multibyte character. Conversion canceled." } }; Modified: Frontier/trunk/Common/resources/Win32/WinLand.rc =================================================================== --- Frontier/trunk/Common/resources/Win32/WinLand.rc 2006-04-25 22:42:16 UTC (rev 1336) +++ Frontier/trunk/Common/resources/Win32/WinLand.rc 2006-05-02 16:49:55 UTC (rev 1337) @@ -1638,6 +1638,12 @@ 1 File_Errors DISCARDABLE BEGIN "Internal error running \042file.^0\042.\0" END 1 String_Errors DISCARDABLE BEGIN "Internal error running \042string.^0\042.\0" END + 2 String_Errors DISCARDABLE BEGIN "Unknown error converting character set.\0" END + 3 String_Errors DISCARDABLE BEGIN "The character set (^0) is not supported.\0" END + 4 String_Errors DISCARDABLE BEGIN "The text input contains a byte sequence that is not legal in the specified character set (^0).\0" END + 5 String_Errors DISCARDABLE BEGIN "The text input contains a code point that is undefined in the specified character set (^0). The conversion could not be completed.\0" END + 6 String_Errors DISCARDABLE BEGIN "There is no way to convert from the character set \042^0\042 to \042^1\042.\0" END + 7 String_Errors DISCARDABLE BEGIN "The text input ends in the middle of a multibyte character. Conversion canceled.\0" END 1 WP_Verb_Errors DISCARDABLE BEGIN "Can't do \042wp.^0\042 because the target window is not in edit mode, or does not contain editable text.\0" END 2 WP_Verb_Errors DISCARDABLE BEGIN "The address of a wptext object was expected here.\0" END Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-25 22:42:16 UTC (rev 1336) +++ Frontier/trunk/Common/source/strings.c 2006-05-02 16:49:55 UTC (rev 1337) @@ -48,7 +48,15 @@ #define ctparseparams 4 #define hextoint(ch) (isdigit(ch)? (ch - '0') : (getlower (ch) - 'a' + 10)) + +#define stringerrorlist 263 +#define cs_utf8 BIGSTRING( "\xA5" "utf-8" ) +#define cs_utf16 BIGSTRING( "\x06" "utf-16" ) +#define cs_iso88591 BIGSTRING( "\xA0" "iso-8859-1" ) +#define cs_macintosh BIGSTRING( "\x09" "macintosh" ) + + byte zerostring [] = "\0"; /*use this to conserve constant space*/ unsigned char lowercasetable[256]; @@ -62,7 +70,7 @@ /* declarations */ -static boolean converttextencoding( Handle, Handle, const long, const long ); +static boolean converttextencoding( Handle, Handle, const long, const long, long * ); static boolean getTextEncodingID( bigstring, long * ); #ifdef WIN95VERSION @@ -1686,14 +1694,28 @@ #ifdef WIN95VERSION boolean copyWideToPString( const wchar_t * inString, bigstring bs ) { - HRESULT err; + DWORD err; size_t lenOut; - err = wcstombs_s( &lenOut, bs, 255, inString, _TRUNCATE ); - - if ( FAILED( err ) ) - return (false); + lenOut = WideCharToMultiByte( 1252, 0,(wchar_t *) inString, -1, bs, + 255, NULL, NULL); + if ( lenOut == 0 ) + { + err = GetLastError(); + + switch ( err ) + { + case ERROR_INSUFFICIENT_BUFFER: /* these are the err codes it can return */ + case ERROR_INVALID_FLAGS: /* I'm just not yet sure how to handle them */ + case ERROR_INVALID_PARAMETER: + return ( false ); + + case S_OK: + break; + } + } + convertcstring( bs ); return (true); @@ -1702,19 +1724,30 @@ boolean copyPStringToWide( bigstring bs, long * lenResult, wchar_t * outString ) { HRESULT err; - size_t lenOut; + size_t lenOut, lenIn; + lenIn = (size_t) bs[ 0 ]; convertpstring( bs ); - err = mbstowcs_s( &lenOut, outString, 255, (const char *) bs, _TRUNCATE ); + lenOut = MultiByteToWideChar( 1252, 0, bs, lenIn, (LPWSTR) outString, 255 ); - if ( SUCCEEDED( err ) ) + if ( lenOut == 0 ) { - *lenResult = (long) lenOut; - return (true); + err = GetLastError(); + + switch ( err ) + { + case ERROR_INSUFFICIENT_BUFFER: /* these are the err codes it can return */ + case ERROR_INVALID_FLAGS: /* I'm just not yet sure how to handle them */ + case ERROR_INVALID_PARAMETER: + return ( false ); + + case S_OK: + break; + } } - else - return (false); + + return ( true ); } #endif @@ -2305,11 +2338,52 @@ return (pushchar (':', bs)); } /*assurelastchariscolon*/ + + + +static short getTextEncodingErrorNumFromOSCode( long osStatusCode ) +{ +#ifdef WIN95VERSION + return 2; +#endif + +#ifdef MACVERSION + switch ( osStatusCode ) + { + case kTextUnsupportedEncodingErr: + return 3; + case kTextMalformedInputErr: + return 4; + case kTextUndefinedElementErr: + return 5; + case kTECNoConversionPathErr: + return 6; + case kTECPartialCharErr: + return 7; + + default: + return 2; + } +#endif +} + +static void setTextEncodingConversionError( const bigstring encIn, const bigstring encOut, long osStatusCode ) +{ + short errStringNum = getTextEncodingErrorNumFromOSCode( osStatusCode ); + bigstring rezErrorMessage, bsErrorMessage; + if ( ! getstringlist( stringerrorlist, errStringNum, rezErrorMessage ) ) + getstringlist( stringerrorlist, 1, rezErrorMessage ); + + parsedialogstring( rezErrorMessage, (ptrstring) encIn, (ptrstring) encOut, nil, nil, bsErrorMessage ); + + langerrormessage( bsErrorMessage ); +} + #ifdef WIN95VERSION -static HRESULT UnicodeToAnsi(Handle h, Handle hresult, unsigned long encoding) +static boolean UnicodeToAnsi( Handle h, Handle hresult, unsigned long encoding, long * errCode ) { /* 7.0b42 PBS: convert from Unicode to Ansi. Borrowed from Microsoft sample code. @@ -2325,18 +2399,25 @@ sethandlesize (hresult, cbAnsi); // Convert to ANSI. - lentext = WideCharToMultiByte( encoding, 0,(wchar_t *) *h, -1, *hresult, - cbAnsi, NULL, NULL); - + lentext = WideCharToMultiByte( encoding, WC_COMPOSITECHECK, (wchar_t *) *h, -1, *hresult, cbAnsi, NULL, NULL); + + if ( lentext == 0 ) // report error + { + * errCode = GetLastError(); + + return ( false ); + } + + *errCode = S_OK; + sethandlesize (hresult, lentext - 1); - return NOERROR; + return ( true ); } -static HRESULT AnsiToUnicode (Handle h, Handle hresult, unsigned long encoding) +static boolean AnsiToUnicode( Handle h, Handle hresult, unsigned long encoding, long * errCode ) { - /* 7.0b42 PBS: convert from ANSI to Unicode. Borrowed from Microsoft sample code. */ @@ -2350,20 +2431,26 @@ // Determine number of bytes to be allocated for ANSI string. An // ANSI string can have at most 2 bytes per character (for Double // Byte Character Strings.) - cbUni = cCharacters*4; + cbUni = cCharacters * 4; sethandlesize (hresult, cbUni); // Convert to ANSI. lentext = MultiByteToWideChar (encoding, 0, *h, cCharacters, (wchar_t *) *hresult, cbUni); - - if ( lentext > 0 ) /* FIXME: what should we do if lentext is 0, which is an error condition? */ + + if ( lentext == 0 ) { - sethandlesize( hresult, ( lentext + 1 ) * 2 ); - ((wchar_t *)(*hresult))[lentext] = L'\0'; + * errCode = GetLastError(); + + return ( false ); } + + * errCode = S_OK; + + sethandlesize( hresult, ( lentext + 1 ) * 2 ); + ((wchar_t *)(*hresult))[lentext] = L'\0'; - return NOERROR; + return ( true ); } #endif /*end Windows character conversion routines*/ @@ -2371,63 +2458,78 @@ /* convert an "internet name" for an encoding into a platform-specific id for the character set */ -static boolean getTextEncodingID( bigstring bsEncodingName, long * encodingId ) { +static boolean getTextEncodingID( bigstring bsEncodingName, long * encodingId ) +{ + #ifdef MACVERSION -#ifdef MACVERSION + OSStatus err; + TextEncoding oneEncoding; + + err = TECGetTextEncodingFromInternetName( &oneEncoding, bsEncodingName ); + + if ( err != noErr ) + { + setTextEncodingConversionError( bsEncodingName, BIGSTRING( "" ), (long) err ); + + return ( false ); + } + + *encodingId = (long) oneEncoding; + + #endif - OSStatus err; - TextEncoding oneEncoding; - - err = TECGetTextEncodingFromInternetName( &oneEncoding, bsEncodingName ); - - if ( err != noErr ) - return (false); - - *encodingId = (long) oneEncoding; - -#endif + #ifdef WIN95VERSION -#ifdef WIN95VERSION + HRESULT err; + IMultiLanguage2 * pMultiLanguage; + MIMECSETINFO setInfo; + wchar_t ianaName[ 512 ]; + long lenIanaName; - HRESULT err; - IMultiLanguage2 * pMultiLanguage; - MIMECSETINFO setInfo; - wchar_t ianaName[ 512 ]; - long lenIanaName; + lowertext( (ptrbyte) (bsEncodingName + 1), (long) bsEncodingName[ 0 ] ); - lowertext( (ptrbyte) (bsEncodingName + 1), (long) bsEncodingName[ 0 ] ); + if ( equalstrings( bsEncodingName, BIGSTRING ("\x06" "utf-16") ) ) + { + *encodingId = 0; + + return (true); + } - if ( equalstrings( bsEncodingName, BIGSTRING ("\x06" "utf-16") ) ) - { - *encodingId = 0; - return (true); - } + initCOM(); - initCOM(); + err = CoCreateInstance( + &CLSID_CMultiLanguage, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IMultiLanguage2, + (void **) &pMultiLanguage ); - err = CoCreateInstance( - &CLSID_CMultiLanguage, - NULL, - CLSCTX_INPROC_SERVER, - &IID_IMultiLanguage2, - (void **) &pMultiLanguage ); + if ( FAILED( err ) ) + { + setTextEncodingConversionError( bsEncodingName, BIGSTRING( "" ), err ); + + return ( false ); + } - if ( FAILED( err ) ) - return (false); + copyPStringToWide( bsEncodingName, &lenIanaName, ianaName ); - copyPStringToWide( bsEncodingName, &lenIanaName, ianaName ); + // pSetInfo = (PMIMECSETINFO)CoTaskMemAlloc( sizeof(MIMECSETINFO) ); - // pSetInfo = (PMIMECSETINFO)CoTaskMemAlloc( sizeof(MIMECSETINFO) ); + err = pMultiLanguage->lpVtbl->GetCharsetInfo( pMultiLanguage, ianaName, &setInfo ); + if ( FAILED( err ) ) + { + setTextEncodingConversionError( bsEncodingName, BIGSTRING( "" ), err ); + + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); + + return ( false ); + } - err = pMultiLanguage->lpVtbl->GetCharsetInfo( pMultiLanguage, ianaName, &setInfo ); - if ( FAILED( err ) ) - return (false); + *encodingId = (long)(setInfo.uiInternetEncoding); - *encodingId = (long)(setInfo.uiInternetEncoding); + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); - pMultiLanguage->lpVtbl->Release( pMultiLanguage ); - -#endif + #endif return (true); } @@ -2458,8 +2560,8 @@ #endif } -static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset) { - +static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset, long * OSStatusCode ) +{ #ifdef MACVERSION /*Mac character conversion common routine*/ TECObjectRef converter; @@ -2472,7 +2574,8 @@ status = TECCreateConverter (&converter, inputcharset, outputcharset); if ( status != noErr ) { TECDisposeConverter (converter); - return (false); + *OSStatusCode = (long) status; + return ( false ); } sizeoutputbuffer = lentext * 4; @@ -2508,11 +2611,14 @@ lentext = gethandlesize (h) - pullBytes; - status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); + status = TECConvertText( converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes ); - if (status != noErr) { + if ( status != noErr ) + { TECDisposeConverter (converter); - return (false); + + *OSStatusCode = (long) status; + return ( false ); } TECFlushText (converter, (TextPtr)(*hresult), sizeoutputbuffer, &ctflushedbytes); @@ -2528,47 +2634,43 @@ #ifdef WIN95VERSION long lentext; + boolean flResult; + lentext = gethandlesize (h); + switch ( inputcharset ) { case 0: /* unicode with BOM, not handled as a code page. I Hatesk Windows. */ - lentext = gethandlesize (h); sethandlesize (h,lentext + 2); (*h) [lentext] = '\0'; (*h) [lentext + 1] = '\0'; - if (UnicodeToAnsi (h, hresult, outputcharset)) - return (false); + flResult = UnicodeToAnsi( h, hresult, outputcharset, OSStatusCode ); - if ((*h) [0] == '\xFF') + if ( flStatus && ( (*h) [0] == '\xFF') ) pullfromhandle (hresult,0, 1, NULL); /* Pop off the BOM */ - return (true); - default: { - lentext = gethandlesize (h); switch ( outputcharset ) { - case 0: /* unicode with BOM, not handled as a code page. I Sitll Hatesk Windows (and rrrabbits) */ + case 0: /* unicode with BOM, not handled as a code page */ - return (!AnsiToUnicode (h, hresult, inputcharset)); + flResult = AnsiToUnicode( h, hresult, inputcharset, OSStatusCode ); default: { Handle htemp; - boolean flResult = true; newemptyhandle (&htemp); sethandlesize (h, lentext + 1); (*h) [lentext] = '\0'; - if (AnsiToUnicode (h, htemp, inputcharset)) - flResult = false; + flResult = AnsiToUnicode (h, htemp, inputcharset, OSStatusCode ); - if (flResult && ! UnicodeToAnsi (htemp, hresult, outputcharset)) { - + if ( flResult && UnicodeToAnsi( htemp, hresult, outputcharset, OSStatusCode ) ) { + if ((*hresult) [0] == '\xFF') pullfromhandle (hresult, 0, 1, NULL); /* pop BOM ? */ @@ -2578,8 +2680,6 @@ disposehandle (htemp); - return (flResult); - } /* case default */ } /* switch outputcharset */ @@ -2587,6 +2687,13 @@ } /* case default */ } /* switch inputcharset */ + + /* + if ( ! flResult ) + *OSStatusCode = (long) GetLastError(); + */ + + return ( flResult ); #endif } /*converttextencoding*/ @@ -2594,37 +2701,40 @@ boolean convertCharset( Handle hString, Handle hresult, bigstring charsetIn, bigstring charsetOut ) { -#ifdef MACVERSION + long err; - TextEncoding teInputSet, teOutputSet; + #ifdef MACVERSION + + TextEncoding teInputSet, teOutputSet; -#endif + #endif -#ifdef WIN95VERSION + #ifdef WIN95VERSION - long teInputSet, teOutputSet; + long teInputSet, teOutputSet; - initCOM(); + initCOM(); -#endif - + #endif + if ( ! getTextEncodingID( charsetIn, (long *) &teInputSet ) ) - { - // FIXME: generate error, encoding not available return (false); - } if ( ! getTextEncodingID( charsetOut, (long *) &teOutputSet ) ) + return (false); + + if ( ! converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet, &err ) ) { - // FIXME: generate error, encoding not available - return (false); + setTextEncodingConversionError( charsetIn, charsetOut, err ); + + return ( false ); } - return ( converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet ) ); + return ( true ); } -boolean utf16toansi (Handle h, Handle hresult) { +boolean utf16toansi( Handle h, Handle hresult ) { /* 7.0b42 PBS: convert from UTF-16 to iso-8859-1 character sets. @@ -2632,6 +2742,7 @@ #ifdef WIN95VERSION + long err; long lentext = gethandlesize (h); sethandlesize (h, lentext + 2); @@ -2640,7 +2751,9 @@ (*h) [lentext + 1] = '\0'; - UnicodeToAnsi (h, hresult, CP_ACP); + if ( ! UnicodeToAnsi (h, hresult, CP_ACP, &err) ) + + goto error; if ((*h) [0] == '\xFF') @@ -2649,13 +2762,24 @@ #endif #ifdef MACVERSION - - if (!converttextencoding (h, hresult, kTextEncodingUnicodeDefault, kTextEncodingWindowsLatin1)) - return (false); + + long err; + + if ( !converttextencoding( h, hresult, kTextEncodingUnicodeDefault, kTextEncodingWindowsLatin1, &err ) ) + + goto error; #endif return (true); + + + error: + + setTextEncodingConversionError( cs_utf16, cs_iso88591, (long) err ); + + return ( false ); + } /*utf16toansi*/ @@ -2664,7 +2788,9 @@ /* 70b42 PBS: convert from UTF-8 to ANSI. */ - + + long err; + #ifdef WIN95VERSION long lentext = gethandlesize (h); @@ -2677,9 +2803,19 @@ (*h) [lentext] = '\0'; - AnsiToUnicode (h, htemp, CP_UTF8); /*Convert to UTF-16*/ + if ( ! AnsiToUnicode (h, htemp, CP_UTF8, &err ) ) /*Convert to UTF-16*/ + { + setTextEncodingConversionError( utf8, utf16, err ); + + return ( false ); + } - UnicodeToAnsi (htemp, hresult, CP_ACP); /*Convert from UTF-16 to ANSI*/ + if ( ! UnicodeToAnsi( htemp, hresult, CP_ACP, &err ) ) /*Convert from UTF-16 to ANSI*/ + { + setTextEncodingConversionError( utf16, iso88591, err); + + return ( false ); + } if ((*htemp) [0] == '\xFF') @@ -2691,12 +2827,17 @@ #ifdef MACVERSION - if (!converttextencoding (h, hresult, kCFStringEncodingUTF8, kTextEncodingWindowsLatin1)) + if ( !converttextencoding( h, hresult, kCFStringEncodingUTF8, kTextEncodingWindowsLatin1, &err ) ) + { + setTextEncodingConversionError( cs_utf8, cs_iso88591, err ); + return (false); + } #endif return (true); + } /*utf8toansi*/ @@ -2706,6 +2847,8 @@ 7.0b42 PBS: convert from ANSI to UTF-8. */ + long err; + #ifdef WIN95VERSION Handle htemp; @@ -2717,10 +2860,20 @@ newemptyhandle (&htemp); - AnsiToUnicode (h, htemp, CP_ACP); /*convert to UTF-16*/ + if ( ! AnsiToUnicode( h, htemp, CP_ACP, &err ) ) /*convert to UTF-16*/ + { + setTextEncodingConversionError( cs_iso88591, cs_utf16, err ); + + return ( false ); + } + + if ( ! UnicodeToAnsi( htemp, hresult, CP_UTF8, &err ) ) /*convert from UTF-16 to UTF-8*/ + { + setTextEncodingConversionError( cs_utf16, cs_utf8, err ); + + return ( false ); + } - UnicodeToAnsi (htemp, hresult, CP_UTF8); /*convert from UTF-16 to UTF-8*/ - disposehandle (htemp); lentext = gethandlesize (hresult); @@ -2729,8 +2882,12 @@ #ifdef MACVERSION - if (!converttextencoding (h, hresult, kTextEncodingWindowsLatin1, kCFStringEncodingUTF8)) - return (false); + if ( !converttextencoding( h, hresult, kTextEncodingWindowsLatin1, kCFStringEncodingUTF8, &err ) ) + { + setTextEncodingConversionError( cs_iso88591, cs_utf8, err ); + + return ( false ); + } #endif @@ -2743,7 +2900,9 @@ /* 7.0b42 PBS: convert from ANSI to UTF-16. */ - + + long err; + #ifdef WIN95VERSION long lentext = gethandlesize (h); @@ -2752,14 +2911,23 @@ (*h) [lentext] = '\0'; - AnsiToUnicode (h, hresult, CP_ACP); + if ( ! AnsiToUnicode( h, hresult, CP_ACP, &err ) ) + { + setTextEncodingConversionError( cs_iso88591, cs_utf16, err ); + + return ( false ); + } #endif #ifdef MACVERSION - if (!converttextencoding (h, hresult, kTextEncodingWindowsLatin1, kTextEncodingUnicodeDefault)) - return (false); + if ( !converttextencoding( h, hresult, kTextEncodingWindowsLatin1, kTextEncodingUnicodeDefault, &err ) ) + { + setTextEncodingConversionError( cs_iso88591, cs_utf16, err ); + + return ( false ); + } #endif @@ -2814,45 +2982,35 @@ } /*pullsuffix*/ -void initstrings (void) { - - register short i; - - for (i = 0; i < 256; i++) - lowercasetable[i] = tolower (i); - - clearbytes (&parseparams, longsizeof (parseparams)); - - for (i = 1; i <= ctdirections; i++) { - - bigstring bs; - - getstringlist (directionlistnumber, i, bs); - - newheapstring (bs, &dirstrings [i - 1]); - } /*for*/ - } /*initstrings*/ - - boolean macromantoutf8 (Handle h, Handle hresult) { /* 2006-02-24 creedon: convert from Mac Roman character set to UTF-8, cribbed from ansitoutf8 */ + long err; + long encIn, encOut; + #ifdef WIN95VERSION - - if (!converttextencoding (h, hresult, 10000, CP_UTF8)) - return (false); - + + encIn = CP_UTF8; + encOut = 10000; + #endif #ifdef MACVERSION + + encIn = kCFStringEncodingUTF8; + encOut = kTextEncodingMacRoman; - if (!converttextencoding (h, hresult, kTextEncodingMacRoman, kCFStringEncodingUTF8)) - return (false); + #endif - #endif + if ( !converttextencoding( h, hresult, encIn, encOut, &err ) ) + { + setTextEncodingConversionError( cs_utf8, cs_macintosh, err ); + + return ( false ); + } return (true); } /* macromantoutf8 */ @@ -2863,21 +3021,51 @@ /* 2006-02-26 creedon: convert from UTF-8 character set to Mac Roman, cribbed from utf8toansi */ - + + long err; + long encIn, encOut; + #ifdef WIN95VERSION - - if (!converttextencoding (h, hresult, CP_UTF8, 10000)) - return (false); - + + encIn = CP_UTF8; + encOut = 10000; + #endif #ifdef MACVERSION - if (!converttextencoding (h, hresult, kCFStringEncodingUTF8, kTextEncodingMacRoman)) - return (false); + encIn = kCFStringEncodingUTF8; + encOut = kTextEncodingMacRoman; #endif - + + if ( !converttextencoding( h, hresult, encIn, encOut, &err ) ) + { + setTextEncodingConversionError( cs_utf8, cs_macintosh, err ); + + return ( false ); + } + return (true); } /* utf8tomacroman */ + + +void initstrings (void) { + + register short i; + + for (i = 0; i < 256; i++) + lowercasetable[i] = tolower (i); + + clearbytes (&parseparams, longsizeof (parseparams)); + + for (i = 1; i <= ctdirections; i++) { + + bigstring bs; + + getstringlist (directionlistnumber, i, bs); + + newheapstring (bs, &dirstrings [i - 1]); + } /*for*/ + } /*initstrings*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <cre...@us...> - 2006-04-25 22:42:20
|
Revision: 1336 Author: creecode Date: 2006-04-25 15:42:16 -0700 (Tue, 25 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1336&view=rev Log Message: ----------- minor formatting tweaks add handler can dereference through a mixture of addresses and addresses as strings moved type handling into add () so that hardcoded menus such as user.menus.menubar can be any datatype allow string representation of an adr, which can point to Guest ODB without a (fragile) hardcoded path deleted old commented-out code to improve clarity Modified Paths: -------------- ODBs/trunk/frontierRoot/system/menus/buildMenuBar.fvc Modified: ODBs/trunk/frontierRoot/system/menus/buildMenuBar.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/menus/buildMenuBar.fvc 2006-04-25 03:00:10 UTC (rev 1335) +++ ODBs/trunk/frontierRoot/system/menus/buildMenuBar.fvc 2006-04-25 22:42:16 UTC (rev 1336) @@ -1,61 +1,55 @@ -FrontierVcsFile:1:scpt:system.menus.buildMenuBar +FrontierVcsFile:2:scpt:system.menus.buildMenuBar -\xC7Changes - \xC72/14/06; 4:01:07 PM by TAC - \xC7use script to build help menu which are different between Mac and Windows - \xC79/5/05; 8:46:08 AM by TAC - \xC7can now run a script to install a menu - \xC712/4/04; 11:59:40 PM by TAC - \xC7commented out bookmarkmenu in case statement - \xC7disabled modal menu install, let agent handle it +«Changes + «4/25/06; 1:36:18 PM by SSL & TAC + «minor formatting tweaks + «add handler can dereference through a mixture of addresses and addresses as strings + «moved type handling into add () so that hardcoded menus such as user.menus.menubar can be any datatype + «allow string representation of an adr, which can point to Guest ODB without a (fragile) hardcoded path + «deleted old commented-out code to improve clarity + «2/14/06; 4:01:07 PM by TAC + «use script to build help menu which are different between Mac and Windows + «9/5/05; 8:46:08 AM by TAC + «can now run a script to install a menu + «12/4/04; 11:59:40 PM by TAC + «commented out bookmarkmenu in case statement + «disabled modal menu install, let agent handle it + «8/13/98 by PBS + «add additional user menus -on add (adrmenu) { +on add (adrMenu) { try { - menu.install (adrmenu)}}; + case typeOf (adrMenu^) { + addressType; + stringType { + add (address (adrMenu^))}; + + menuBarType { + menu.install (adrMenu)}; + + scriptType { + adrMenu^ ()}}}}; menu.clearMenuBar (); -bundle { //install menus +bundle { // install menus if defined (user.menus.menubar) { add (@user.menus.menubar)} else { add (@system.menus.menubar)}; - \xC7html.menu.install () // 11/27/04; 12:07:59 PM by TAC - \xC7add (@user.menus.bookmarkMenu) // 11/27/04; 12:08:05 PM by TAC + add (@user.menus.customMenu); local (i); - for i = 1 to sizeOf (user.menus) { //PBS 8/13/98: add additional user menus - local (adrMenu = @user.menus [i]); - - if typeOf (adrMenu^) == addressType { //menus can be address - if not defined (adrMenu^^) { - continue}; - - adrMenu = adrMenu^}; - - if typeOf (adrMenu^) == menuBarType { - case string.lower (nameOf (user.menus [i])) { - \xC7"bookmarkmenu" - "custommenu"; - "menubar" { - continue}}; - - add (adrMenu)}; - - if typeOf (adrMenu^) == scriptType { // 9/5/05; 8:46:08 AM by TAC - adrMenu^ ()}}; + for i = 1 to sizeOf (user.menus) { + case string.lower (nameOf (user.menus [i])) { // skip if added above + "custommenu"; + "menubar" { + continue}} + else { + add (@user.menus [i])}}; system.menus.buildHelpMenu ()}; - \xC7add (@system.menus.helpMenu) -\xC7bundle //add the modal menu, based on the type of the frontmost window - \xC7local (winType = window.getType (window.frontmost ())) - \xC7try - \xC7menu.install (@system.menus.modals.[winType]) - \xC7else - \xC7winType = 0 - \xC7system.menus.data.currentMenuType = winType //see system.menus.agent - -menu.buildMenuBar () //force update \ No newline at end of file +menu.buildMenuBar () // force update \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-25 03:00:25
|
Revision: 1335 Author: sethdill Date: 2006-04-24 20:00:10 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1335&view=rev Log Message: ----------- Merged trunk changes r1324:1332 into the Conversant branch. Modified Paths: -------------- Frontier/branches/Conversant/Common/SystemHeaders/standard.h Frontier/branches/Conversant/Common/headers/file.h Frontier/branches/Conversant/Common/headers/frontierdefs.h Frontier/branches/Conversant/Common/headers/osincludes.h Frontier/branches/Conversant/Common/headers/processinternal.h Frontier/branches/Conversant/Common/headers/strings.h Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc Frontier/branches/Conversant/Common/source/FrontierWinMain.c Frontier/branches/Conversant/Common/source/fileops.c Frontier/branches/Conversant/Common/source/fileverbs.c Frontier/branches/Conversant/Common/source/lang.c Frontier/branches/Conversant/Common/source/langstartup.c Frontier/branches/Conversant/Common/source/process.c Frontier/branches/Conversant/Common/source/shell.c Frontier/branches/Conversant/Common/source/strings.c Frontier/branches/Conversant/Common/source/stringverbs.c Modified: Frontier/branches/Conversant/Common/SystemHeaders/standard.h =================================================================== --- Frontier/branches/Conversant/Common/SystemHeaders/standard.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/SystemHeaders/standard.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -437,6 +437,10 @@ #define quickdrawglobal(x) qd.x +extern boolean flcominitialized; /* set up in lang.c */ +extern boolean initCOM( void ); /* see FrontierWinMain.c */ +extern void shutdownCOM( void ); + #endif #endif Modified: Frontier/branches/Conversant/Common/headers/file.h =================================================================== --- Frontier/branches/Conversant/Common/headers/file.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/headers/file.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -424,7 +424,7 @@ extern boolean fifgetendoffile (const tyfilespec *fs, long *eof); - /* filepath.c */ +#pragma mark === filepath.c === extern boolean directorytopath (long, short, bigstring); @@ -449,7 +449,7 @@ extern void initfsdefault (void); /* 2005-07-18 creedon */ - /*fileverbs.c*/ +#pragma mark === fileverbs.c === //extern filecheckdefaultpath (bigstring); @@ -458,7 +458,7 @@ extern boolean filestart (void); /*6.1b15 AR*/ -// filedialog.c +#pragma mark === filedialog.c === extern boolean sfdialog (tysfverb, bigstring, ptrsftypelist, tyfilespec *, OSType); /* 2005-10-06 creedon - added OSType */ @@ -482,9 +482,14 @@ #endif -// filemp3.c +#pragma mark === filemp3.c === boolean getmp3info (const tyfilespec *, long *, long *, long *, long *, boolean *); +#pragma mark === fileops.c === +extern short getfilelabelindex (const tyfilespec *, short *); /* 2006-04-23 creedon */ + +extern boolean setfilelabelindex (const tyfilespec *, short, boolean); /* 2006-04-23 creedon */ + Modified: Frontier/branches/Conversant/Common/headers/frontierdefs.h =================================================================== --- Frontier/branches/Conversant/Common/headers/frontierdefs.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/headers/frontierdefs.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -35,11 +35,13 @@ #ifdef WIN95VERSION #define FRONTIERCOM 1 -#ifndef OPMLEDITOR - #define FRONTIERWEB 0 -#else //OPMLEDITOR - #define FRONTIERWEB 1 /* 2006-02-05 aradke: enable HTML display in main window background */ -#endif // OPMLEDITOR + + #ifndef OPMLEDITOR + #define FRONTIERWEB 0 + #else //OPMLEDITOR + #define FRONTIERWEB 1 /* 2006-02-05 aradke: enable HTML display in main window background */ + #endif // OPMLEDITOR + #undef winhybrid #define fljustpacking 0 #undef flcomponent Modified: Frontier/branches/Conversant/Common/headers/osincludes.h =================================================================== --- Frontier/branches/Conversant/Common/headers/osincludes.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/headers/osincludes.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -37,6 +37,8 @@ #ifdef WIN95VERSION #define WIN32_LEAN_AND_MEAN 1 + #define _WIN32_DCOM 1 + #define CINTERFACE 1 #include <windows.h> @@ -55,6 +57,10 @@ #include <winsock2.h> #include <mswsock.h> + #undef __cplusplus + #include <objbase.h> + #include <mlang.h> + #endif /* WIN95VERSION */ Modified: Frontier/branches/Conversant/Common/headers/processinternal.h =================================================================== --- Frontier/branches/Conversant/Common/headers/processinternal.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/headers/processinternal.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -195,6 +195,9 @@ ThreadEntryUPP threadEntryCallbackUPP; #endif + + boolean flcominitialized; + } tythreadglobals, *ptrthreadglobals, **hdlthreadglobals; Modified: Frontier/branches/Conversant/Common/headers/strings.h =================================================================== --- Frontier/branches/Conversant/Common/headers/strings.h 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/headers/strings.h 2006-04-25 03:00:10 UTC (rev 1335) @@ -161,6 +161,7 @@ extern void copyctopstring (const char *, bigstring); #ifdef WIN95VERSION +extern boolean copyWideToPString (const wchar_t *, bigstring); extern void copyrezstring (const bigstring, bigstring); #endif @@ -266,9 +267,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean gettextencodingid (const Handle, long *); /* 2006-04-20 smd */ +extern boolean convertCharset( Handle, Handle, bigstring, bigstring ); -extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ +extern boolean isTextEncodingAvailable( bigstring ); /* 2006-04-23 smd */ #endif Modified: Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-25 03:00:10 UTC (rev 1335) @@ -601,7 +601,8 @@ "multipleReplaceAll", "macromantoutf8", // 2006-02-25 creedon "utf8tomacroman", // 2006-02-25 creedon - "convertcharset" /* 2006-04-13 smd */ + "convertcharset", /* 2006-04-13 smd */ + "ischarsetavailable" /* 2006-04-23 smd */ } } }; @@ -693,7 +694,10 @@ "freespaceonvolumedouble", "volumesizedouble", "getmp3info", - "readwholefile" /* 2006-04-11 aradke */ + "readwholefile", /* 2006-04-11 aradke */ + "getLabelIndex", /* 2006-04-23 creedon */ + "setLabelIndex", /* 2006-04-23 creedon */ + "getLabelNames" /* 2006-04-23 creedon */ } } }; @@ -719,7 +723,6 @@ "deletenamedresource", "getresourceattributes", "setresourceattributes" - } } }; @@ -760,7 +763,7 @@ "about", "quicktime", /*7.0b4 PBS: QuickTime Player window*/ "getfile", - "isreadonly" /*7.0b6 PBS: is a window read-only*/ + "isreadonly", /*7.0b6 PBS: is a window read-only*/ } } }; @@ -1132,7 +1135,7 @@ "hmacMD5", "MD5", "SHA1", - "hmacSHA1" + "hmacSHA1", } } }; Modified: Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc =================================================================== --- Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/resources/Win32/kernelverbs.rc 2006-04-25 03:00:10 UTC (rev 1335) @@ -514,7 +514,7 @@ 1, //Number of "blocks" in this resource "string\0", //Function Processor Name false, //Window required - 59, //Count of verbs + 60, //Count of verbs "delete\0", "insert\0", "popleading\0", @@ -573,7 +573,8 @@ "multiplereplaceall\0", "macromantoutf8\0", // 2006-02-25 creedon "utf8tomacroman\0", // 2006-02-25 creedon - "convertcharset\0" /* 2006-04-16 smd */ + "convertcharset\0", /* 2006-04-16 smd */ + "ischarsetavailable\0" /* 2006-04-24 smd */ END @@ -582,7 +583,7 @@ 1, //Number of "blocks" in this resource "file\0", //Function Processor Name false, //Window required - 82, //Count of verbs + 86, //Count of verbs "created\0", "modified\0", "type\0", @@ -663,8 +664,11 @@ "getpathchar\0", "freespaceonvolumedouble\0", "volumesizedouble\0", - "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ - "readwholefile\0" /* 2006-04-11 aradke */ + "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ + "readwholefile\0", /* 2006-04-11 aradke */ + "getLabelIndex\0", /* 2006-04-23 creedon */ + "setLabelIndex\0", /* 2006-04-23 creedon */ + "getLabelNames" /* 2006-04-23 creedon */ END 1008 /*idrezverbs*/ EFP DISCARDABLE @@ -691,12 +695,12 @@ END -1009 /*idwindowverbs*/ EFP DISCARDABLE +1009 /* idwindowverbs */ EFP DISCARDABLE BEGIN - 1, //Number of "blocks" in this resource - "window\0", //Function Processor Name - true, //Window required - 30, //Count of verbs + 1, // Number of "blocks" in this resource + "window\0", // Function Processor Name + true, // Window required + 30, // Count of verbs "isopen\0", "open\0", "isfront\0", @@ -726,7 +730,7 @@ "settitle\0", "about\0", "getfile\0", - "isreadonly\0" + "isreadonly\0", END @@ -1070,7 +1074,7 @@ "hmacMD5\0", "MD5\0", "SHA1\0", - "hmacSHA1\0" + "hmacSHA1\0", END #include "conversantverbs.rc" Modified: Frontier/branches/Conversant/Common/source/FrontierWinMain.c =================================================================== --- Frontier/branches/Conversant/Common/source/FrontierWinMain.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/FrontierWinMain.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -2974,8 +2974,38 @@ } /*COMSYSModule*/ +boolean initCOM () +{ + if ( !flcominitialized ) + { + LPVOID reserved = NULL; + HRESULT err; + + err = CoInitialize( reserved ); + + if ( SUCCEEDED( err ) ) + { + flcominitialized = true; + return (true); + } + else + return (false); + } + + return (true); +} + +void shutdownCOM () +{ + CoUninitialize(); + flcominitialized = false; +} + + Handle COMStartup () { + initCOM(); + gcomServerInfo.hCOMModule = LoadLibrary ("COMDLL.DLL"); if (gcomServerInfo.hCOMModule == NULL) @@ -2991,7 +3021,7 @@ if ((gcomServerInfo.cominit != NULL) && (gcomServerInfo.comclear != NULL)) { fillcalltable(&gcomServerInfo.calltable); - + (*(gcomServerInfo.cominit)) (gcomServerInfo.hInstance, gcomServerInfo.hPrevInstance, gcomServerInfo.lpCmdLine, gcomServerInfo.nCmdShow, &gcomServerInfo.calltable); } } @@ -3000,6 +3030,8 @@ } /*COMStartup*/ boolean COMShutdown () { + shutdownCOM(); + if ((gcomServerInfo.cominit != NULL) && (gcomServerInfo.comclear != NULL)) (*(gcomServerInfo.comclear)) (); @@ -3009,6 +3041,7 @@ gcomServerInfo.cominit = NULL; gcomServerInfo.comclear = NULL; gcomServerInfo.hCOMModule = NULL; + return (true); } /*COMShutdown*/ Modified: Frontier/branches/Conversant/Common/source/fileops.c =================================================================== --- Frontier/branches/Conversant/Common/source/fileops.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/fileops.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -2313,7 +2313,9 @@ #endif } /*lockvolume*/ + #ifdef MACVERSION + boolean unmountvolume (const tyfilespec *fs) { /* @@ -2461,42 +2463,41 @@ static boolean index2label (short ixlabel, bigstring bslabel) { /* - new: pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString) - = {0x303c, 0x050B, 0xABC9}; + 2006-04-24 creedon: use GetLabel instead of looking for resources that don't exists on Mac OS X + deleted old code see revision 1268 */ - Handle hlabel; - - setemptystring (bslabel); - if ((ixlabel < 0) || (ixlabel > 7)) return (false); - hlabel = GetResource ('lstr', -16392 + ixlabel); + RGBColor labelcolor; // we don't use the value we put into here - if (hlabel == nil) - return (false); - - copyheapstring ((hdlstring) hlabel, bslabel); - + if (GetLabel (ixlabel, &labelcolor, bslabel) != noErr) + return (false); + return (true); - } /*index2label*/ + } /* index2label */ static boolean label2index (bigstring bslabel, short *ixlabel) { + /* + 2006-04-24 creedon: use GetLabel instead of looking for resources that don't exists on Mac OS X + deleted old code see revision 1268 + */ + register short ix; - Handle hlabel; + RGBColor labelcolor; // we don't use the value we put into here + bigstring bs; for (ix = 0; ix < 8; ++ix) { - hlabel = GetResource ('lstr', -16392 + ix); + if (GetLabel (ix, &labelcolor, bs) != noErr) - if (hlabel == nil) - continue; - - if (RelString ((ptrstring) *hlabel, bslabel, false, false) == 0) { + return (false); + if (RelString (bslabel, bs, false, false) == 0) { + *ixlabel = ix; return (true); @@ -2504,7 +2505,7 @@ } return (false); - } /*label2index*/ + } /* label2index */ boolean getfilelabel (const tyfilespec *fs, bigstring bslabel) { @@ -2520,26 +2521,18 @@ boolean setfilelabel (const tyfilespec *fs, bigstring bslabel) { - CInfoPBRec pb; - register short flags; + /* + 2006-04-24 creedon: factored most of the code into setfilelabelindex function + code deleted see revision 1268 + */ + short ixlabel; if (!label2index (bslabel, &ixlabel)) return (false); - if (!getmacfileinfo (fs, &pb)) - return (false); - - flags = pb.hFileInfo.ioFlFndrInfo.fdFlags; - - flags &= 0xFFF1; /*clear out old index*/ - - flags |= ixlabel << 1; /*slam in new index*/ - - pb.hFileInfo.ioFlFndrInfo.fdFlags = flags; - - return (setmacfileinfo (fs, &pb)); - } /*setfilelabel*/ + return (setfilelabelindex (fs, ixlabel, false)); + } /* setfilelabel */ boolean mountvolume (bigstring volumepath, bigstring username, bigstring password) { @@ -2627,6 +2620,58 @@ return (!oserror (errcode)); } /*mountvolume*/ + + +short getfilelabelindex (const tyfilespec *fs, short *ixlabel) { + + /* + 2006-04-23 creedon: created, cribbed from getfilelabel function + */ + + tyfileinfo info; + short maptouserinterfaceindex [8] = {0, 7, 4, 6, 5, 3, 1, 2}; + + if (!filegetinfo (fs, &info)) + return (false); + + *ixlabel = maptouserinterfaceindex [info.ixlabel]; + + return (true); + } /* getfilelabelindex */ + + +boolean setfilelabelindex (const tyfilespec *fs, short ixlabel, boolean flmapfromuserinterfaceindex) { + + /* + 2006-04-24 creedon: created, cribbed from setfilelabel function + */ + + CInfoPBRec pb; + register short flags; + + if ((ixlabel < 0) || (ixlabel > 7)) + return (false); + + if (!getmacfileinfo (fs, &pb)) + return (false); + + flags = pb.hFileInfo.ioFlFndrInfo.fdFlags; + + flags &= 0xFFF1; // clear out old index + + if (flmapfromuserinterfaceindex) { + short mapfromuserinterfaceindex [8] = {0, 6, 7, 5, 2, 4, 3, 1}; + + ixlabel = mapfromuserinterfaceindex [ixlabel]; + } + + flags |= ixlabel << 1; // slam in new index + + pb.hFileInfo.ioFlFndrInfo.fdFlags = flags; + + return (setmacfileinfo (fs, &pb)); + } /* setfilelabelindex */ + #endif Modified: Frontier/branches/Conversant/Common/source/fileverbs.c =================================================================== --- Frontier/branches/Conversant/Common/source/fileverbs.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/fileverbs.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -46,6 +46,7 @@ #include "kernelverbdefs.h" #include "shell.rsrc.h" #include "byteorder.h" /* 2006-04-16 aradke: for SWAP_REZ_BYTE_ORDER */ +#include "oplist.h" /* 2006-04-23 creedon */ #ifdef MACVERSION @@ -250,8 +251,14 @@ getmp3infofunc, - readwholefilefunc, /* 2006-04-11 aradke */ + readwholefilefunc, /* 2006-04-11 aradke */ + getlabelindexfunc, /* 2006-04-23 creedon */ + + setlabelindexfunc, /* 2006-04-23 creedon */ + + getlabelnamesfunc, /* 2006-04-23 creedon */ + ctfileverbs } tyfiletoken; @@ -1914,6 +1921,87 @@ return (setbooleanvalue (setfilelabel (&fs, bslabel), v)); } /*setlabelverb*/ + +static boolean getlabelindexverb (hdltreenode hparam1, tyvaluerecord *v) { + + /* + 2006-04-24 creedon: created, cribbed from getlabelverb function + */ + + tyfilespec fs; + short ixlabel; + + flnextparamislast = true; + + if (!getpathvalue (hparam1, 1, &fs)) + return (false); + + if (!getfilelabelindex (&fs, &ixlabel)) + return (false); + + return (setintvalue (ixlabel, v)); + } /* getlabelindexverb */ + + +static boolean setlabelindexverb (hdltreenode hparam1, tyvaluerecord *v) { + + /* + 2006-04-24 creedon: created, cribbed from setlabelverb function + */ + + tyfilespec fs; + short index; + + if (!getpathvalue (hparam1, 1, &fs)) + return (false); + + flnextparamislast = true; + + if (!getintvalue (hparam1, 2, &index)) + return (false); + + return (setbooleanvalue (setfilelabelindex (&fs, index, true), v)); + } /* setlabelindexverb */ + + +static boolean getlabelnamesverb (hdltreenode hparam1, tyvaluerecord *v) { + #pragma unused (hparam1) + + /* + 2006-04-24 creedon: created, cribbed from statusbargetsectionsfunc case of langfunctionvalue function + */ + + bigstring bsarray [8]; + hdllistrecord hlist; + int ix; + RGBColor labelcolor; + short mapfromuserinterfaceindex [8] = {0, 6, 7, 5, 2, 4, 3, 1}; + + for (ix = 0; ix < 8; ++ix) + + if (GetLabel (ix, &labelcolor, bsarray [ix]) != noErr) + + return (false); + + if (!opnewlist (&hlist, false)) + return (false); + + for (ix = 0; ix < 8; ++ix) + + if (!langpushliststring (hlist, bsarray [mapfromuserinterfaceindex [ix]])) + + goto getlabelnamesverberror; + + return (setheapvalue ((Handle) hlist, listvaluetype, v)); + + getlabelnamesverberror: + + opdisposelist (hlist); + + return (false); + + } /* getlabelnamesverb */ + #endif @@ -3529,7 +3617,15 @@ return (true); } + + case getlabelindexfunc: /* 2006-04-24 creedon */ + return (getlabelindexverb (hp1, v)); + case setlabelindexfunc: /* 2006-04-24 creedon */ + return (setlabelindexverb (hp1, v)); + + case getlabelnamesfunc: /* 2006-04-24 creedon */ + return (getlabelnamesverb (hp1, v)); #endif case folderfrompathfunc: Modified: Frontier/branches/Conversant/Common/source/lang.c =================================================================== --- Frontier/branches/Conversant/Common/source/lang.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/lang.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -81,7 +81,10 @@ tylangcallbacks langcallbacks; /*routines that wire the language into environment*/ +boolean flcominitialized = false; + + static short ctrootchains = 0; /*number of hashtable chains that include the root*/ static boolean flevaluateglobalwith = false; /*dmb 4.1b12 - new flag for langcard support*/ Modified: Frontier/branches/Conversant/Common/source/langstartup.c =================================================================== --- Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -432,14 +432,14 @@ err = TECCountAvailableTextEncodings( &ct ); if ( err != noErr ) { - pophashtable(); - return (true); // don't kill the whole startup } - TextEncoding enc; + TextEncoding enc, encOut; TextEncoding availEncodings[ ct ]; - bigstring ianaName; + bigstring ianaName, displayName; + unsigned long lenDisplayName; + RegionCode reg; err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); if ( err != noErr ) @@ -464,55 +464,77 @@ if ( err != noErr ) continue; - langassignlongvalue( cSetsTable, ianaName, (long) enc ); + /* + get the encoding's display name, which is the value of the table cell + */ + err = GetTextEncodingName( enc, kTextEncodingFullName, verUS, kTextEncodingMacRoman, 255, &lenDisplayName, ®, &encOut, (TextPtr) displayName + 1 ); + if ( err != noErr ) + continue; + + displayName[ 0 ] = (unsigned char) lenDisplayName; + + langassignstringvalue( cSetsTable, ianaName, displayName ); } + + return (true); + #endif #if WIN95VERSION - langassignlongvalue( cSetsTable, "\x05" "ASCII", 20127 ); - langassignlongvalue( cSetsTable, "\x08" "US-ASCII", 20127 ); /* alias for ASCII */ + HRESULT err; + IMultiLanguage2 * pMultiLanguage; + IEnumCodePage * pEnumCodePage; + UINT i, cnum = 0; + MIMECPINFO cpInfo; + long ccpInfo; + bigstring ianaName, displayName; + + initCOM(); + + err = CoCreateInstance( + &CLSID_CMultiLanguage, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IMultiLanguage2, + (void **) &pMultiLanguage ); + + if ( FAILED( err ) ) + goto done; + + err = pMultiLanguage->lpVtbl->EnumCodePages( + pMultiLanguage, + 0, // MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_VALID | MIMECONTF_MIME_LATEST + 9, /* LANGID. I'm totally guessing that 0 means "all", here. -- smd */ + (IEnumCodePage **) &pEnumCodePage ); - langassignlongvalue( cSetsTable, "\x09" "MACINTOSH", 10000 ); - langassignlongvalue( cSetsTable, "\x08" "MacRoman", 10000 ); /* alias for MACINTOSH */ + if ( FAILED( err ) ) + goto done; + + pMultiLanguage->lpVtbl->GetNumberOfCodePageInfo( pMultiLanguage, &cnum ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-1", 28591 ); - langassignlongvalue( cSetsTable, "\x0b" "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-2", 28592 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-3", 28593 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-4", 28594 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-5", 28595 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-6", 28596 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-7", 28597 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-8", 28598 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-9", 28599 ); - langassignlongvalue( cSetsTable, "\x0b" "iso-8859-10", 28592 ); + // pcpInfo = (PMIMECPINFO)CoTaskMemAlloc( sizeof(MIMECPINFO) ); + + for ( i = 0; i < cnum; i++ ) + { + err = pEnumCodePage->lpVtbl->Next( pEnumCodePage, 1, &cpInfo, &ccpInfo ); + + if ( SUCCEEDED( err ) && ( ccpInfo != 0 ) ) + { + if ( copyWideToPString( cpInfo.wszWebCharset, ianaName ) + && copyWideToPString( cpInfo.wszDescription, displayName ) ) + langassignstringvalue( cSetsTable, ianaName, displayName ); + //langassignlongvalue( cSetsTable, ianaName, cpInfo.uiCodePage ); + } + } + + pEnumCodePage->lpVtbl->Release( pEnumCodePage ); + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); + // CoTaskMemFree( (LPVOID) pcpInfo ); + +done: + return (true); - langassignlongvalue( cSetsTable, "\x0c" "windows-1250", 1250 ); - langassignlongvalue( cSetsTable, "\x0f" "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - langassignlongvalue( cSetsTable, "\x0c" "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - langassignlongvalue( cSetsTable, "\x0c" "windows-1252", 1252 ); - langassignlongvalue( cSetsTable, "\x0f" "windows-latin-1", 1252 ); - - langassignlongvalue( cSetsTable, "\x0c" "windows-1253", 1253 ); /* code page 1253 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1254", 1254 ); /* code page 1254, Turkish */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1255", 1255 ); /* code page 1255 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1256", 1256 ); /* code page 1256 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1257", 1257 ); /* code page 1257 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1258", 1258 ); /* code page 1258 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - langassignlongvalue( cSetsTable, "\x05" "UTF-7", 65000 ); - langassignlongvalue( cSetsTable, "\x05" "UTF-8", 65001 ); - - langassignlongvalue( cSetsTable, "\x06" "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ - - langassignlongvalue( cSetsTable, "\x08" "UTF-16le", 1200 ); - langassignlongvalue( cSetsTable, "\x08" "UTF-16be", 1201 ); -#endif - - return (true); +#endif } /* initCharsetsTable */ Modified: Frontier/branches/Conversant/Common/source/process.c =================================================================== --- Frontier/branches/Conversant/Common/source/process.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/process.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -1387,6 +1387,11 @@ listunlink ((hdllinkedlist) processthreadlist, (hdllinkedlist) hg); if (hg == hthreadglobals) { + + #ifdef WIN95VERSION + if ( flcominitialized ) + shutdownCOM(); + #endif disposehandle ((Handle) hashtablestack); @@ -1451,6 +1456,12 @@ (**hg).timesliceticks = processonehottimeslice; + /* + 2006-04-24 smd + has COM been initialized in this thread? + */ + (**hg).flcominitialized = false; + #ifdef landinclude id = getprocesscreator (); @@ -1580,6 +1591,12 @@ (**hg).tryerror = tryerror; (**hg).tryerrorstack = tryerrorstack; + + /* + 2006-04-24 smd + has COM been initialized in this thread? + */ + (**hg).flcominitialized = flcominitialized; } (**hg).langcallbacks = langcallbacks; Modified: Frontier/branches/Conversant/Common/source/shell.c =================================================================== --- Frontier/branches/Conversant/Common/source/shell.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/shell.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -256,7 +256,7 @@ fileshutdown(); UnregisterAppearanceClient(); #endif - + exittooperatingsystem (); /*doesn't return*/ return (true); /*satisfy the compiler -- not a void function*/ Modified: Frontier/branches/Conversant/Common/source/strings.c =================================================================== --- Frontier/branches/Conversant/Common/source/strings.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/strings.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -28,6 +28,10 @@ #include "frontier.h" #include "standard.h" +#ifdef WIN95VERSION + #include "FrontierWinMain.h" +#endif + #include "font.h" #include "memory.h" #include "quickdraw.h" @@ -56,8 +60,19 @@ static byte bshexprefix [] = STR_hexprefix; +/* declarations */ +static boolean converttextencoding( Handle, Handle, const long, const long ); +static boolean getTextEncodingID( bigstring, long * ); +#ifdef WIN95VERSION + static HRESULT UnicodeToAnsi(Handle, Handle, unsigned long); + static HRESULT AnsiToUnicode(Handle, Handle, unsigned long); +#endif + + +/* definitions */ + boolean equalstrings (const bigstring bs1, const bigstring bs2) { /* @@ -1667,6 +1682,42 @@ } /*parsenumberstring*/ + +#ifdef WIN95VERSION +boolean copyWideToPString( const wchar_t * inString, bigstring bs ) +{ + HRESULT err; + size_t lenOut; + + err = wcstombs_s( &lenOut, bs, 255, inString, _TRUNCATE ); + + if ( FAILED( err ) ) + return (false); + + convertcstring( bs ); + + return (true); +} /* copyWideToPString */ + +boolean copyPStringToWide( bigstring bs, long * lenResult, wchar_t * outString ) +{ + HRESULT err; + size_t lenOut; + + convertpstring( bs ); + + err = mbstowcs_s( &lenOut, outString, 255, (const char *) bs, _TRUNCATE ); + + if ( SUCCEEDED( err ) ) + { + *lenResult = (long) lenOut; + return (true); + } + else + return (false); +} +#endif + void convertpstring (bigstring bs) { /* @@ -2267,14 +2318,14 @@ ULONG cbAnsi, cCharacters; long lentext; - cCharacters = wcslen((const unsigned short*) *h)+1; + cCharacters = wcslen((wchar_t *) *h)+1; cbAnsi = cCharacters * 2; sethandlesize (hresult, cbAnsi); // Convert to ANSI. - lentext = WideCharToMultiByte(encoding, 0,(const unsigned short*) *h, -1, *hresult, + lentext = WideCharToMultiByte( encoding, 0,(wchar_t *) *h, -1, *hresult, cbAnsi, NULL, NULL); sethandlesize (hresult, lentext - 1); @@ -2287,13 +2338,12 @@ { /* - 7.0b42 PBS: convert from Unicode to Ansi. Borrowed from Microsoft sample code. + 7.0b42 PBS: convert from ANSI to Unicode. Borrowed from Microsoft sample code. */ ULONG cbUni, cCharacters; long lentext; - unsigned long ix; - char lastch = ' '; + // unsigned long ix; cCharacters = gethandlesize (h); @@ -2305,35 +2355,15 @@ sethandlesize (hresult, cbUni); // Convert to ANSI. - lentext = MultiByteToWideChar (encoding, 0, *h, -1, (unsigned short*) *hresult, cbUni); + lentext = MultiByteToWideChar (encoding, 0, *h, cCharacters, (wchar_t *) *hresult, cbUni); - ix = 0; + if ( lentext > 0 ) /* FIXME: what should we do if lentext is 0, which is an error condition? */ + { + sethandlesize( hresult, ( lentext + 1 ) * 2 ); + ((wchar_t *)(*hresult))[lentext] = L'\0'; + } - while (true) { /*find terminator*/ - - char ch = (*hresult) [ix]; - - if (ch == '\0') { - - if ((*hresult) [ix + 1] == '\0') { - - sethandlesize (hresult, ix + 2); - - break; - } /* if */ - - } /*if*/ - - ix += 2; - - if (ix > cbUni) - break; - - lastch = ch; - } /*while*/ - return NOERROR; - } #endif /*end Windows character conversion routines*/ @@ -2341,33 +2371,94 @@ /* convert an "internet name" for an encoding into a platform-specific id for the character set */ -boolean gettextencodingid (const Handle h, long * encodingId) { +static boolean getTextEncodingID( bigstring bsEncodingName, long * encodingId ) { #ifdef MACVERSION OSStatus err; TextEncoding oneEncoding; - bigstring ianaName; - long ct, ix = 0; - ct = gethandlesize (h); - ianaName [0] = (byte) ct; - loadfromhandle (h, &ix, ct, ianaName + 1); + err = TECGetTextEncodingFromInternetName( &oneEncoding, bsEncodingName ); - err = TECGetTextEncodingFromInternetName( &oneEncoding, ianaName ); - if ( err != noErr ) return (false); *encodingId = (long) oneEncoding; #endif + +#ifdef WIN95VERSION + + HRESULT err; + IMultiLanguage2 * pMultiLanguage; + MIMECSETINFO setInfo; + wchar_t ianaName[ 512 ]; + long lenIanaName; + + lowertext( (ptrbyte) (bsEncodingName + 1), (long) bsEncodingName[ 0 ] ); + + if ( equalstrings( bsEncodingName, BIGSTRING ("\x06" "utf-16") ) ) + { + *encodingId = 0; + return (true); + } + + initCOM(); + + err = CoCreateInstance( + &CLSID_CMultiLanguage, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IMultiLanguage2, + (void **) &pMultiLanguage ); + + if ( FAILED( err ) ) + return (false); + + copyPStringToWide( bsEncodingName, &lenIanaName, ianaName ); + + // pSetInfo = (PMIMECSETINFO)CoTaskMemAlloc( sizeof(MIMECSETINFO) ); + + err = pMultiLanguage->lpVtbl->GetCharsetInfo( pMultiLanguage, ianaName, &setInfo ); + if ( FAILED( err ) ) + return (false); + + *encodingId = (long)(setInfo.uiInternetEncoding); + + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); + +#endif return (true); } +/* + determine if the specified character set is recognized by the OS + bsEncodingName is an IANA-friendly name like "utf-8" , "macintosh", or "iso-8859-1" +*/ +boolean isTextEncodingAvailable( bigstring bsEncodingName ) +{ + long encodingId; + + if ( ! getTextEncodingID( bsEncodingName, &encodingId ) ) + return (false); + + #ifdef MACVERSION + + // the mac version has no encoding id 0, so this means a failure + return ( encodingId >= 0 ); + + #endif + + #ifdef WIN95VERSION + + // we use 0 to refer to UTF-16 on Windows, as it's the default character set and has no code page + return (true); + + #endif +} -boolean converttextencoding (Handle h, Handle hresult, long inputcharset, long outputcharset) { +static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset) { #ifdef MACVERSION /*Mac character conversion common routine*/ @@ -2378,10 +2469,6 @@ long pullBytes = 0; long lentext = gethandlesize (h); - // sethandlesize (h, lentext + 1); - - // (*h) [lentext] = '\0'; - status = TECCreateConverter (&converter, inputcharset, outputcharset); if ( status != noErr ) { TECDisposeConverter (converter); @@ -2419,15 +2506,6 @@ } } - //old code - // if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /*pop byte order mark*/ - // pullfromhandle (h, 0, 3, NULL); - - /* - if (pullBytes > 0) - pullfromhandle (h, 0, pullBytes, NULL); - */ - lentext = gethandlesize (h) - pullBytes; status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); @@ -2445,10 +2523,6 @@ return (true); - // kwchange 2005-05-23 --- commented out to see if this is the missing trailing char bug - // kwchange 2005-05-27 --- ran this the last week and have no complains - //sethandlesize (hresult, gethandlesize (hresult) - 1); /*pop trailing terminator*/ - #endif /*end Mac character conversion routine(s)*/ #ifdef WIN95VERSION @@ -2471,14 +2545,15 @@ if ((*h) [0] == '\xFF') pullfromhandle (hresult,0, 1, NULL); /* Pop off the BOM */ + return (true); + default: { lentext = gethandlesize (h); switch ( outputcharset ) { case 0: /* unicode with BOM, not handled as a code page. I Sitll Hatesk Windows (and rrrabbits) */ - if (AnsiToUnicode (h, hresult, inputcharset)) - return (false); + return (!AnsiToUnicode (h, hresult, inputcharset)); default: { Handle htemp; @@ -2517,10 +2592,42 @@ } /*converttextencoding*/ +boolean convertCharset( Handle hString, Handle hresult, bigstring charsetIn, bigstring charsetOut ) +{ +#ifdef MACVERSION + + TextEncoding teInputSet, teOutputSet; + +#endif + +#ifdef WIN95VERSION + + long teInputSet, teOutputSet; + + initCOM(); + +#endif + + if ( ! getTextEncodingID( charsetIn, (long *) &teInputSet ) ) + { + // FIXME: generate error, encoding not available + return (false); + } + + if ( ! getTextEncodingID( charsetOut, (long *) &teOutputSet ) ) + { + // FIXME: generate error, encoding not available + return (false); + } + + return ( converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet ) ); +} + + boolean utf16toansi (Handle h, Handle hresult) { /* - 7.0b42 PBS: convert from UTF-16 to UTF-8 character sets. + 7.0b42 PBS: convert from UTF-16 to iso-8859-1 character sets. */ #ifdef WIN95VERSION @@ -2542,60 +2649,10 @@ #endif #ifdef MACVERSION -/* - if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /#pop byte order mark#/ - - pullfromhandle (h, 0, 2, NULL); - - // why do we need a string starting with a 0??? - if ((*h) [0] != '\0') - - insertinhandle (h, 0, NULL, 1); -*/ + if (!converttextencoding (h, hresult, kTextEncodingUnicodeDefault, kTextEncodingWindowsLatin1)) return (false); -/* OSErr err = noErr; - - UnicodeToTextInfo utinfo; - - UnicodeMapping utmapping; - - ByteCount ctunibytes, ctansibytes; - - long lentext = gethandlesize (h); - - sethandlesize (h, lentext + 1); - - (*h) [lentext] = '\0'; - - utmapping.unicodeEncoding = kTextEncodingUnicodeDefault; - - utmapping.otherEncoding = kTextEncodingISOLatin1; - - utmapping.mappingVersion = kUnicodeUseLatestMapping; - - err = CreateUnicodeToTextInfo (&utmapping, &utinfo); - - sethandlesize (hresult, lentext * 2); - - pullfromhandle (h, 0, 2, NULL); - - insertinhandle (h, 0, NULL, 1); - - lentext = gethandlesize (h); - - err = ConvertFromUnicodeToText (utinfo, lentext, (ConstUniCharArrayPtr) *h, - kUnicodeUseFallbacksMask, - 0, NULL, NULL, NULL, - lentext * 2, &ctunibytes, &ctansibytes, *hresult); - - DisposeUnicodeToTextInfo (&utinfo); - - sethandlesize (hresult, ctansibytes); - - sethandlesize (hresult, gethandlesize (hresult) - 1); #*pop trailing terminator*/ - #endif return (true); @@ -2637,38 +2694,6 @@ if (!converttextencoding (h, hresult, kCFStringEncodingUTF8, kTextEncodingWindowsLatin1)) return (false); -/* OSErr err = noErr; - - long lentext = gethandlesize (h); - - TECObjectRef converter; - - ByteCount ctunibytes, ctansibytes, ctflushedbytes; - - sethandlesize (h, lentext + 1); - - (*h) [lentext] = '\0'; - - err = TECCreateConverter (&converter, 0x08000100, kTextEncodingWindowsLatin1); #*0x08000100 is UTF-8*/ - -/* sethandlesize (hresult, lentext * 2); - - if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) #*pop byte order mark*/ - -/* pullfromhandle (h, 0, 3, NULL); - - lentext = gethandlesize (h); - - err = TECConvertText (converter, *h, lentext, &ctunibytes, *hresult, lentext * 2, &ctansibytes); - - TECFlushText (converter, *hresult, lentext * 2, &ctflushedbytes); - - TECDisposeConverter (converter); - - sethandlesize (hresult, ctansibytes); - - sethandlesize (hresult, gethandlesize (hresult) - 1); #*pop trailing terminator*/ - #endif return (true); Modified: Frontier/branches/Conversant/Common/source/stringverbs.c =================================================================== --- Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-25 01:00:13 UTC (rev 1334) +++ Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-25 03:00:10 UTC (rev 1335) @@ -312,6 +312,8 @@ utf8tomacromanfunc, // 2006-02-25 creedon convertcharsetfunc, /* 2006-04-14 smd */ + + ischarsetavailablefunc, /* 2006-04-23 smd */ ctstringverbs } tystringtoken; @@ -1319,6 +1321,21 @@ } /*latintomac*/ +static boolean isCharsetAvailableVerb( hdltreenode hp1, tyvaluerecord *v ) +{ + bigstring bscharset; + + flnextparamislast = true; + + if ( !getstringvalue( hp1, 1, bscharset ) ) /* IANA names can't be longer than 40 ASCII characters, so this is safe */ + return (false); + + (*v).data.flvalue = isTextEncodingAvailable( bscharset ); + + return (true); +} + + static boolean stringfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) { /* @@ -2302,32 +2319,39 @@ return (setheapvalue (hresult, stringvaluetype, v)); } - case convertcharsetfunc: { /* 2006-04-13 smd: convert any character set to any other character set, if the os supports it */ - + case convertcharsetfunc: /* 2006-04-13 smd: convert any character set to any other character set, if the os supports it */ + { Handle h, hresult; - long charsetIn, charsetOut; + bigstring charsetIn, charsetOut; - if (!getlongvalue (hp1, 1, &charsetIn)) + /* + the "internet names" of character sets are 40 ASCII chars or less, + so this is a safe way to get the params + */ + if ( !getstringvalue( hp1, 1, charsetIn ) ) goto error; - if (!getlongvalue (hp1, 2, &charsetOut)) + if ( !getstringvalue( hp1, 2, charsetOut ) ) goto error; flnextparamislast = true; - if (!getreadonlytextvalue (hp1, 3, &h)) + if ( !getreadonlytextvalue( hp1, 3, &h ) ) goto error; - newemptyhandle (&hresult); + newemptyhandle( &hresult ); - if (! converttextencoding (h, hresult, charsetIn, charsetOut)) + if ( !convertCharset( h, hresult, charsetIn, charsetOut ) ) goto error; - // disposehandle(h); - - return (setheapvalue (hresult, stringvaluetype, v)); - } + return ( setheapvalue( hresult, stringvaluetype, v ) ); + } + case ischarsetavailablefunc: /* 2006-04-23 smd: determine if a character set is available, based on an internet-friendly (IANA) name */ + { + return isCharsetAvailableVerb( hparam1, v ); + } + default: errornum = notimplementederror; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-25 01:00:20
|
Revision: 1334 Author: sethdill Date: 2006-04-24 18:00:13 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1334&view=rev Log Message: ----------- RFC2047 describes how an internet (mail, web, etc) header should be encoded if it contains characters outside of the ASCII 7-bit range. The script-based (for now) verb, string.mimeHeaderDecode(), decodes headers in that format back to unencoded characters. (It also returns the name of the character set in which the string is encoded, so that it can be converted to the platform native set (or normalized to an app's default set) with string.convertcharset() Added Paths: ----------- ODBs/trunk/frontierRoot/system/verbs/builtins/string/mimeHeaderDecode.fvc Added: ODBs/trunk/frontierRoot/system/verbs/builtins/string/mimeHeaderDecode.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/string/mimeHeaderDecode.fvc (rev 0) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/string/mimeHeaderDecode.fvc 2006-04-25 01:00:13 UTC (rev 1334) @@ -0,0 +1,111 @@ +FrontierVcsFile:2:scpt:system.verbs.builtins.string.mimeHeaderDecode + +«2006/04/10 by Seth Dillingham. + «Description: + «See RFC 2047 + «Textual header informtaion in character sets other than US-ASCII must be encoded correctly, including a reference to the character set that was used. + «This verb attempts to decode a RFC2047-encoded string back to text + «Example input: + «=?utf-8?q?this=20is=20a=20test?= + «Output + «this is a test + «(plus, "utf-8" would be placed at adrCharsetName^) + «Parameters: + «s [string]: the mime-encoded header string to be decoded + «adrCharsetName [@string]: if the string contains any encoded "words", the name of the character set (specified in the string) will be placed here. If the string did not appear to contain any encoding, then "" will be placed here. + «Return: + «[string] the decoded string + «Errors: + «Poorly-formed input may produce incorrect output. (GIGO) + «For example, if the input string uses two different character sets, only the last one will be return at adrCharSet^ + «(This is an error condition anyway, mime header strings can only use one character set at a time) + «Revisions: + « +«~~~~~~~~~~~~~~~~~~~~~~~~ +on mimeHeaderDecode( s, adrCharsetName ) { + local ( working, ct ); + local ( ix, output = "" ); + local ( charsetEnd, charsetLength ); + local ( encodingEnd, encoding ); // B or Q + local ( wordEnd, word ); + + adrCharsetName^ = ""; + + working = string.replaceAll( string.replaceAll( s, tab, ' ' ), "\r\n ", ' ' ); + ct = sizeof( working ); + + ix = string.patternMatch( "=?", working ); + if ( ix == 0 ) { + return s}; + + output = string.mid( s, 1, ix - 1 ); + + while ( ( ix != 0 ) and ( ix < ct ) ) { + charsetEnd = string.patternMatch( "?", working, ix + 2 ); + + if ( charsetEnd == 0 ) { // badly formed, just return the input + adrCharsetName^ = ""; + return s}; + + charsetLength = ( charsetEnd - ix ) - 2; + adrCharsetName^ = string.lower( string.mid( working, ix + 2, charsetLength ) ); + ix = charsetEnd + 1; + + encodingEnd = string.patternMatch( "?", working, ix ); + if ( encodingEnd == 0 ) { + adrCharsetName^ = ""; + return s}; + + encoding = string.upper( string.mid( working, ix, encodingEnd - ix ) ); + case encoding { + "Q"; // quoted-printable + "B" { // base64 + ;}} + else { // we don't handle any other type of encoding + adrCharsetName^ = ""; + return s}; + + ix = encodingEnd + 1; + + wordEnd = string.patternMatch( "?=", working, ix ); + if ( wordEnd == 0 ) { + adrCharsetName^ = ""; + return s}; + + word = string.mid( working, ix, wordEnd - ix ); + + case encoding { + "Q" { + output = output + string.quotedPrintableDecode( string.replaceAll( word, '_', ' ' ) );}; + "B" { + output = output + base64.decode( word );}}; + + ix = string.patternMatch( "=?", working, wordEnd + 2 ); + if ( ix == 0 ) { + output = output + string.mid( working, wordEnd + 2, infinity );; + break;}}; + + return output} +«bundle // test + «local ( charset ) + «local ( s = "=?utf-8?q?my_name_=E2=80=93_such_as_it_is_=E2=80=93_is_?=\r\n\tbr=?utf-8?q?not=20andr=C3=A9=20radke=20=E2=80=94=20nor=20arturo=20pe=C3=B1a?=" ) + « + «s = mimeHeaderDecode( s, @charset ) + «msg( charset ) + «dialog.alert( "Decoded string:\r\n" + s ) + « + «case charset + «"iso-8859-1" + «case sys.os() + «"MacOS" + «s = string.utf8ToMacRoman( string.ansiToUtf8( s ) ); + «"WinNT" + «; + «"utf-8" + «case sys.os() + «"MacOS" + «s = string.utf8ToMacRoman( s ); + «"WinNT" + «s = string.utf8ToAnsi( s ); + « + «dialog.alert( "Charset Transformed string:\r\n" + s ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-25 00:29:24
|
Revision: 1333 Author: sethdill Date: 2006-04-24 17:29:17 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1333&view=rev Log Message: ----------- Added glue scripts string.isCharsetAvailable and string.convertCharset to wrap up the new verbs in the kernel. Both verbs contain full documentation in comments at the head of the script. (Using the format Macrobyte has been using for 6 years.) Added Paths: ----------- ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc Added: ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc (rev 0) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc 2006-04-25 00:29:17 UTC (rev 1333) @@ -0,0 +1,21 @@ +FrontierVcsFile:2:scpt:system.verbs.builtins.string.convertCharset + +«2006/04/14 by Seth Dillingham. + «Description: + «Convert a string from one character set to another. + «Note that you can find a list of the character sets available on your system, at system.charSets + «The name of each entry is the IANA-registered name + «The value of each entry is the character set's display name + «Parameters: + «charsetIn [string]: IANA-name (like "utf-8") of the character set of the input string + «charsetOut [string]: IANA-name of the character set of the output. This is the character set you want the string to use. + «s [string]: the string to be converted + «Return: + «[string]: the string, in the new character set + «Errors: + «At present, providing a string which is NOT actually encoded with the charset specified by charsetIn will either generate incorrect output, result in a script error, or may even halt execution of the script IMMEDIATELY without generating an error. (This is a known issue that will be dealt with in an upcoming revision.) + «Revisions: + « +«~~~~~~~~~~~~~~~~~~~~~~~~ +on convertCharset( charsetIn, charsetOut, s ) { + kernel( string.convertCharset )} \ No newline at end of file Added: ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc (rev 0) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc 2006-04-25 00:29:17 UTC (rev 1333) @@ -0,0 +1,20 @@ +FrontierVcsFile:2:scpt:system.verbs.builtins.string.isCharsetAvailable + +«2006/04/24 by Seth Dillingham. + «Description: + «Asks the OS if the specified character set is recognized on this system. + «Useful as an error-prevention measure: before calling string.convertCharset, use isCharsetAvailable to be sure that both character sets are available. + «NOT case sensitive + «Parameters: + «charset [string]: the IANA-registered name of the character set, like "utf-8" or "macintosh" or "iso-8859-1" + «Return: + «[boolean]: true if the character ste is recognized, false if it is not + «Errors: + « + «Revisions: + « +«~~~~~~~~~~~~~~~~~~~~~~~~ +on isCharsetAvailable( charset ) { + kernel( string.isCharsetAvailable )} +«bundle // test + «dialog.alert( isCharsetAvailable( "utf-8" ) ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-24 22:28:44
|
Revision: 1332 Author: sethdill Date: 2006-04-24 15:28:36 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1332&view=rev Log Message: ----------- The mac's system.charsets table is now equivalent to the windows version. That is, the names are the IANA codes for the character sets, and the values are the 'display names'. Also, pulled out a bunch of old, commented-out code from some of the ___toANSI and ANSIto___ functions. Modified Paths: -------------- Frontier/trunk/Common/source/langstartup.c Frontier/trunk/Common/source/strings.c Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-24 22:07:22 UTC (rev 1331) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-24 22:28:36 UTC (rev 1332) @@ -426,21 +426,20 @@ static boolean initCharsetsTable (hdlhashtable cSetsTable) { -#if 1 #if MACVERSION OSStatus err; ItemCount ct, actual_ct, i; err = TECCountAvailableTextEncodings( &ct ); if ( err != noErr ) { - pophashtable(); - return (true); // don't kill the whole startup } - TextEncoding enc; + TextEncoding enc, encOut; TextEncoding availEncodings[ ct ]; - bigstring ianaName; + bigstring ianaName, displayName; + unsigned long lenDisplayName; + RegionCode reg; err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); if ( err != noErr ) @@ -465,8 +464,20 @@ if ( err != noErr ) continue; - langassignlongvalue( cSetsTable, ianaName, (long) enc ); + /* + get the encoding's display name, which is the value of the table cell + */ + err = GetTextEncodingName( enc, kTextEncodingFullName, verUS, kTextEncodingMacRoman, 255, &lenDisplayName, ®, &encOut, (TextPtr) displayName + 1 ); + if ( err != noErr ) + continue; + + displayName[ 0 ] = (unsigned char) lenDisplayName; + + langassignstringvalue( cSetsTable, ianaName, displayName ); } + + return (true); + #endif #if WIN95VERSION @@ -520,10 +531,10 @@ pMultiLanguage->lpVtbl->Release( pMultiLanguage ); // CoTaskMemFree( (LPVOID) pcpInfo ); -#endif -#endif done: return (true); + +#endif } /* initCharsetsTable */ Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-24 22:07:22 UTC (rev 1331) +++ Frontier/trunk/Common/source/strings.c 2006-04-24 22:28:36 UTC (rev 1332) @@ -27,8 +27,11 @@ #include "frontier.h" #include "standard.h" -#include "FrontierWinMain.h" +#ifdef WIN95VERSION + #include "FrontierWinMain.h" +#endif + #include "font.h" #include "memory.h" #include "quickdraw.h" @@ -2336,10 +2339,6 @@ /* 7.0b42 PBS: convert from ANSI to Unicode. Borrowed from Microsoft sample code. - - 2006-04-24 smd: - fixed the description in the previous comment line - rewrote most of the function */ ULONG cbUni, cCharacters; @@ -2444,7 +2443,19 @@ if ( ! getTextEncodingID( bsEncodingName, &encodingId ) ) return (false); - return ( encodingId >= 0 ); + #ifdef MACVERSION + + // the mac version has no encoding id 0, so this means a failure + return ( encodingId >= 0 ); + + #endif + + #ifdef WIN95VERSION + + // we use 0 to refer to UTF-16 on Windows, as it's the default character set and has no code page + return (true); + + #endif } static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset) { @@ -2616,7 +2627,7 @@ boolean utf16toansi (Handle h, Handle hresult) { /* - 7.0b42 PBS: convert from UTF-16 to UTF-8 character sets. + 7.0b42 PBS: convert from UTF-16 to iso-8859-1 character sets. */ #ifdef WIN95VERSION @@ -2638,60 +2649,10 @@ #endif #ifdef MACVERSION -/* - if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /#pop byte order mark#/ - - pullfromhandle (h, 0, 2, NULL); - - // why do we need a string starting with a 0??? - if ((*h) [0] != '\0') - - insertinhandle (h, 0, NULL, 1); -*/ + if (!converttextencoding (h, hresult, kTextEncodingUnicodeDefault, kTextEncodingWindowsLatin1)) return (false); -/* OSErr err = noErr; - - UnicodeToTextInfo utinfo; - - UnicodeMapping utmapping; - - ByteCount ctunibytes, ctansibytes; - - long lentext = gethandlesize (h); - - sethandlesize (h, lentext + 1); - - (*h) [lentext] = '\0'; - - utmapping.unicodeEncoding = kTextEncodingUnicodeDefault; - - utmapping.otherEncoding = kTextEncodingISOLatin1; - - utmapping.mappingVersion = kUnicodeUseLatestMapping; - - err = CreateUnicodeToTextInfo (&utmapping, &utinfo); - - sethandlesize (hresult, lentext * 2); - - pullfromhandle (h, 0, 2, NULL); - - insertinhandle (h, 0, NULL, 1); - - lentext = gethandlesize (h); - - err = ConvertFromUnicodeToText (utinfo, lentext, (ConstUniCharArrayPtr) *h, - kUnicodeUseFallbacksMask, - 0, NULL, NULL, NULL, - lentext * 2, &ctunibytes, &ctansibytes, *hresult); - - DisposeUnicodeToTextInfo (&utinfo); - - sethandlesize (hresult, ctansibytes); - - sethandlesize (hresult, gethandlesize (hresult) - 1); #*pop trailing terminator*/ - #endif return (true); @@ -2733,38 +2694,6 @@ if (!converttextencoding (h, hresult, kCFStringEncodingUTF8, kTextEncodingWindowsLatin1)) return (false); -/* OSErr err = noErr; - - long lentext = gethandlesize (h); - - TECObjectRef converter; - - ByteCount ctunibytes, ctansibytes, ctflushedbytes; - - sethandlesize (h, lentext + 1); - - (*h) [lentext] = '\0'; - - err = TECCreateConverter (&converter, 0x08000100, kTextEncodingWindowsLatin1); #*0x08000100 is UTF-8*/ - -/* sethandlesize (hresult, lentext * 2); - - if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) #*pop byte order mark*/ - -/* pullfromhandle (h, 0, 3, NULL); - - lentext = gethandlesize (h); - - err = TECConvertText (converter, *h, lentext, &ctunibytes, *hresult, lentext * 2, &ctansibytes); - - TECFlushText (converter, *hresult, lentext * 2, &ctflushedbytes); - - TECDisposeConverter (converter); - - sethandlesize (hresult, ctansibytes); - - sethandlesize (hresult, gethandlesize (hresult) - 1); #*pop trailing terminator*/ - #endif return (true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <cre...@us...> - 2006-04-24 22:07:26
|
Revision: 1331 Author: creecode Date: 2006-04-24 15:07:22 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1331&view=rev Log Message: ----------- moved call to system.callbacks.startup after build menu bundle Modified Paths: -------------- ODBs/trunk/frontierRoot/system/startup/startupScript.fvc Modified: ODBs/trunk/frontierRoot/system/startup/startupScript.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/startup/startupScript.fvc 2006-04-24 21:46:17 UTC (rev 1330) +++ ODBs/trunk/frontierRoot/system/startup/startupScript.fvc 2006-04-24 22:07:22 UTC (rev 1331) @@ -1,6 +1,8 @@ FrontierVcsFile:2:scpt:system.startup.startupScript «Changes + «4/24/06; 3:00:21 PM by TAC + «moved call to system.callbacks.startup after build menu bundle «3/13/06; 12:38:30 PM by TAC «install DLLs «added init of user.callbacks.fileSetModified on first root run @@ -481,12 +483,12 @@ wp.setSelect (0, 0); edit (adrWindow)}}; // 12/4/04; 9:26:35 PM by TAC - i rather do this near the beginning of phase 1 firstRootRun but had a problem with this window and setting up the quick script window -system.callbacks.startup (); //call user's startup scripts - bundle { // build menu bar system.menus.buildMenuBar (); system.menus.buildSuitesSubmenu ()}; //5.0 +system.callbacks.startup (); // call user's startup scripts + Frontier.enableAgents (flEnableAgents); if flEnableHttpServer { //6.0, daemons don't start up until all the startup code has run This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <cre...@us...> - 2006-04-24 21:46:23
|
Revision: 1330 Author: creecode Date: 2006-04-24 14:46:17 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1330&view=rev Log Message: ----------- removed some local changes that shouldn't have gone out Modified Paths: -------------- Frontier/trunk/Common/resources/Mac/kernelverbs.r Frontier/trunk/Common/resources/Win32/kernelverbs.rc Modified: Frontier/trunk/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-24 21:40:07 UTC (rev 1329) +++ Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-24 21:46:17 UTC (rev 1330) @@ -764,7 +764,6 @@ "quicktime", /*7.0b4 PBS: QuickTime Player window*/ "getfile", "isreadonly", /*7.0b6 PBS: is a window read-only*/ - "quickscriptsetscript" // 2006-04-04 creedon } } }; @@ -1137,7 +1136,6 @@ "MD5", "SHA1", "hmacSHA1", - "RIPEMD160" } } }; Modified: Frontier/trunk/Common/resources/Win32/kernelverbs.rc =================================================================== --- Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 21:40:07 UTC (rev 1329) +++ Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 21:46:17 UTC (rev 1330) @@ -664,11 +664,11 @@ "getpathchar\0", "freespaceonvolumedouble\0", "volumesizedouble\0", - "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ + "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ "readwholefile\0", /* 2006-04-11 aradke */ "getLabelIndex\0", /* 2006-04-23 creedon */ "setLabelIndex\0", /* 2006-04-23 creedon */ - "getLabelNames" /* 2006-04-23 creedon */ + "getLabelNames" /* 2006-04-23 creedon */ END 1008 /*idrezverbs*/ EFP DISCARDABLE @@ -700,7 +700,7 @@ 1, // Number of "blocks" in this resource "window\0", // Function Processor Name true, // Window required - 31, // Count of verbs + 30, // Count of verbs "isopen\0", "open\0", "isfront\0", @@ -731,7 +731,6 @@ "about\0", "getfile\0", "isreadonly\0", - "quickscriptsetscript\0" // 2006-04-04 creedon END @@ -1070,12 +1069,11 @@ 1, // Number of "blocks" in this resource "crypt\0", // Function Processor name false, // Window required - 6, // Count of verbs + 5, // Count of verbs "whirlpool\0", "hmacMD5\0", "MD5\0", "SHA1\0", "hmacSHA1\0", - "RIPEMD160\0" END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <cre...@us...> - 2006-04-24 21:40:18
|
Revision: 1329 Author: creecode Date: 2006-04-24 14:40:07 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1329&view=rev Log Message: ----------- fixed file.getLabel, setLabel to work with Mac OS X added new verbs: file.getLabelIndex, setLabelIndex, getLabelNames Modified Paths: -------------- Frontier/trunk/Common/headers/file.h Frontier/trunk/Common/resources/Mac/kernelverbs.r Frontier/trunk/Common/resources/Win32/kernelverbs.rc Frontier/trunk/Common/source/fileops.c Frontier/trunk/Common/source/fileverbs.c Modified: Frontier/trunk/Common/headers/file.h =================================================================== --- Frontier/trunk/Common/headers/file.h 2006-04-24 20:02:59 UTC (rev 1328) +++ Frontier/trunk/Common/headers/file.h 2006-04-24 21:40:07 UTC (rev 1329) @@ -424,7 +424,7 @@ extern boolean fifgetendoffile (const tyfilespec *fs, long *eof); - /* filepath.c */ +#pragma mark === filepath.c === extern boolean directorytopath (long, short, bigstring); @@ -449,7 +449,7 @@ extern void initfsdefault (void); /* 2005-07-18 creedon */ - /*fileverbs.c*/ +#pragma mark === fileverbs.c === //extern filecheckdefaultpath (bigstring); @@ -458,7 +458,7 @@ extern boolean filestart (void); /*6.1b15 AR*/ -// filedialog.c +#pragma mark === filedialog.c === extern boolean sfdialog (tysfverb, bigstring, ptrsftypelist, tyfilespec *, OSType); /* 2005-10-06 creedon - added OSType */ @@ -482,9 +482,14 @@ #endif -// filemp3.c +#pragma mark === filemp3.c === boolean getmp3info (const tyfilespec *, long *, long *, long *, long *, boolean *); +#pragma mark === fileops.c === +extern short getfilelabelindex (const tyfilespec *, short *); /* 2006-04-23 creedon */ + +extern boolean setfilelabelindex (const tyfilespec *, short, boolean); /* 2006-04-23 creedon */ + Modified: Frontier/trunk/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-24 20:02:59 UTC (rev 1328) +++ Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-24 21:40:07 UTC (rev 1329) @@ -694,7 +694,10 @@ "freespaceonvolumedouble", "volumesizedouble", "getmp3info", - "readwholefile" /* 2006-04-11 aradke */ + "readwholefile", /* 2006-04-11 aradke */ + "getLabelIndex", /* 2006-04-23 creedon */ + "setLabelIndex", /* 2006-04-23 creedon */ + "getLabelNames" /* 2006-04-23 creedon */ } } }; @@ -720,7 +723,6 @@ "deletenamedresource", "getresourceattributes", "setresourceattributes" - } } }; @@ -761,7 +763,8 @@ "about", "quicktime", /*7.0b4 PBS: QuickTime Player window*/ "getfile", - "isreadonly" /*7.0b6 PBS: is a window read-only*/ + "isreadonly", /*7.0b6 PBS: is a window read-only*/ + "quickscriptsetscript" // 2006-04-04 creedon } } }; @@ -1133,7 +1136,8 @@ "hmacMD5", "MD5", "SHA1", - "hmacSHA1" + "hmacSHA1", + "RIPEMD160" } } }; Modified: Frontier/trunk/Common/resources/Win32/kernelverbs.rc =================================================================== --- Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 20:02:59 UTC (rev 1328) +++ Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 21:40:07 UTC (rev 1329) @@ -583,7 +583,7 @@ 1, //Number of "blocks" in this resource "file\0", //Function Processor Name false, //Window required - 82, //Count of verbs + 86, //Count of verbs "created\0", "modified\0", "type\0", @@ -664,8 +664,11 @@ "getpathchar\0", "freespaceonvolumedouble\0", "volumesizedouble\0", - "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ - "readwholefile\0" /* 2006-04-11 aradke */ + "getmp3info\0", /*7.0b12 PBS: Andr\xE9's file.getMp3Info verb*/ + "readwholefile\0", /* 2006-04-11 aradke */ + "getLabelIndex\0", /* 2006-04-23 creedon */ + "setLabelIndex\0", /* 2006-04-23 creedon */ + "getLabelNames" /* 2006-04-23 creedon */ END 1008 /*idrezverbs*/ EFP DISCARDABLE @@ -692,12 +695,12 @@ END -1009 /*idwindowverbs*/ EFP DISCARDABLE +1009 /* idwindowverbs */ EFP DISCARDABLE BEGIN - 1, //Number of "blocks" in this resource - "window\0", //Function Processor Name - true, //Window required - 30, //Count of verbs + 1, // Number of "blocks" in this resource + "window\0", // Function Processor Name + true, // Window required + 31, // Count of verbs "isopen\0", "open\0", "isfront\0", @@ -727,7 +730,8 @@ "settitle\0", "about\0", "getfile\0", - "isreadonly\0" + "isreadonly\0", + "quickscriptsetscript\0" // 2006-04-04 creedon END @@ -1066,11 +1070,12 @@ 1, // Number of "blocks" in this resource "crypt\0", // Function Processor name false, // Window required - 5, // Count of verbs + 6, // Count of verbs "whirlpool\0", "hmacMD5\0", "MD5\0", "SHA1\0", - "hmacSHA1\0" + "hmacSHA1\0", + "RIPEMD160\0" END Modified: Frontier/trunk/Common/source/fileops.c =================================================================== --- Frontier/trunk/Common/source/fileops.c 2006-04-24 20:02:59 UTC (rev 1328) +++ Frontier/trunk/Common/source/fileops.c 2006-04-24 21:40:07 UTC (rev 1329) @@ -2313,7 +2313,9 @@ #endif } /*lockvolume*/ + #ifdef MACVERSION + boolean unmountvolume (const tyfilespec *fs) { /* @@ -2461,42 +2463,41 @@ static boolean index2label (short ixlabel, bigstring bslabel) { /* - new: pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString) - = {0x303c, 0x050B, 0xABC9}; + 2006-04-24 creedon: use GetLabel instead of looking for resources that don't exists on Mac OS X + deleted old code see revision 1268 */ - Handle hlabel; - - setemptystring (bslabel); - if ((ixlabel < 0) || (ixlabel > 7)) return (false); - hlabel = GetResource ('lstr', -16392 + ixlabel); + RGBColor labelcolor; // we don't use the value we put into here - if (hlabel == nil) - return (false); - - copyheapstring ((hdlstring) hlabel, bslabel); - + if (GetLabel (ixlabel, &labelcolor, bslabel) != noErr) + return (false); + return (true); - } /*index2label*/ + } /* index2label */ static boolean label2index (bigstring bslabel, short *ixlabel) { + /* + 2006-04-24 creedon: use GetLabel instead of looking for resources that don't exists on Mac OS X + deleted old code see revision 1268 + */ + register short ix; - Handle hlabel; + RGBColor labelcolor; // we don't use the value we put into here + bigstring bs; for (ix = 0; ix < 8; ++ix) { - hlabel = GetResource ('lstr', -16392 + ix); + if (GetLabel (ix, &labelcolor, bs) != noErr) - if (hlabel == nil) - continue; - - if (RelString ((ptrstring) *hlabel, bslabel, false, false) == 0) { + return (false); + if (RelString (bslabel, bs, false, false) == 0) { + *ixlabel = ix; return (true); @@ -2504,7 +2505,7 @@ } return (false); - } /*label2index*/ + } /* label2index */ boolean getfilelabel (const tyfilespec *fs, bigstring bslabel) { @@ -2520,26 +2521,18 @@ boolean setfilelabel (const tyfilespec *fs, bigstring bslabel) { - CInfoPBRec pb; - register short flags; + /* + 2006-04-24 creedon: factored most of the code into setfilelabelindex function + code deleted see revision 1268 + */ + short ixlabel; if (!label2index (bslabel, &ixlabel)) return (false); - if (!getmacfileinfo (fs, &pb)) - return (false); - - flags = pb.hFileInfo.ioFlFndrInfo.fdFlags; - - flags &= 0xFFF1; /*clear out old index*/ - - flags |= ixlabel << 1; /*slam in new index*/ - - pb.hFileInfo.ioFlFndrInfo.fdFlags = flags; - - return (setmacfileinfo (fs, &pb)); - } /*setfilelabel*/ + return (setfilelabelindex (fs, ixlabel, false)); + } /* setfilelabel */ boolean mountvolume (bigstring volumepath, bigstring username, bigstring password) { @@ -2627,6 +2620,58 @@ return (!oserror (errcode)); } /*mountvolume*/ + + +short getfilelabelindex (const tyfilespec *fs, short *ixlabel) { + + /* + 2006-04-23 creedon: created, cribbed from getfilelabel function + */ + + tyfileinfo info; + short maptouserinterfaceindex [8] = {0, 7, 4, 6, 5, 3, 1, 2}; + + if (!filegetinfo (fs, &info)) + return (false); + + *ixlabel = maptouserinterfaceindex [info.ixlabel]; + + return (true); + } /* getfilelabelindex */ + + +boolean setfilelabelindex (const tyfilespec *fs, short ixlabel, boolean flmapfromuserinterfaceindex) { + + /* + 2006-04-24 creedon: created, cribbed from setfilelabel function + */ + + CInfoPBRec pb; + register short flags; + + if ((ixlabel < 0) || (ixlabel > 7)) + return (false); + + if (!getmacfileinfo (fs, &pb)) + return (false); + + flags = pb.hFileInfo.ioFlFndrInfo.fdFlags; + + flags &= 0xFFF1; // clear out old index + + if (flmapfromuserinterfaceindex) { + short mapfromuserinterfaceindex [8] = {0, 6, 7, 5, 2, 4, 3, 1}; + + ixlabel = mapfromuserinterfaceindex [ixlabel]; + } + + flags |= ixlabel << 1; // slam in new index + + pb.hFileInfo.ioFlFndrInfo.fdFlags = flags; + + return (setmacfileinfo (fs, &pb)); + } /* setfilelabelindex */ + #endif Modified: Frontier/trunk/Common/source/fileverbs.c =================================================================== --- Frontier/trunk/Common/source/fileverbs.c 2006-04-24 20:02:59 UTC (rev 1328) +++ Frontier/trunk/Common/source/fileverbs.c 2006-04-24 21:40:07 UTC (rev 1329) @@ -46,6 +46,7 @@ #include "kernelverbdefs.h" #include "shell.rsrc.h" #include "byteorder.h" /* 2006-04-16 aradke: for SWAP_REZ_BYTE_ORDER */ +#include "oplist.h" /* 2006-04-23 creedon */ #ifdef MACVERSION @@ -250,8 +251,14 @@ getmp3infofunc, - readwholefilefunc, /* 2006-04-11 aradke */ + readwholefilefunc, /* 2006-04-11 aradke */ + getlabelindexfunc, /* 2006-04-23 creedon */ + + setlabelindexfunc, /* 2006-04-23 creedon */ + + getlabelnamesfunc, /* 2006-04-23 creedon */ + ctfileverbs } tyfiletoken; @@ -1914,6 +1921,87 @@ return (setbooleanvalue (setfilelabel (&fs, bslabel), v)); } /*setlabelverb*/ + +static boolean getlabelindexverb (hdltreenode hparam1, tyvaluerecord *v) { + + /* + 2006-04-24 creedon: created, cribbed from getlabelverb function + */ + + tyfilespec fs; + short ixlabel; + + flnextparamislast = true; + + if (!getpathvalue (hparam1, 1, &fs)) + return (false); + + if (!getfilelabelindex (&fs, &ixlabel)) + return (false); + + return (setintvalue (ixlabel, v)); + } /* getlabelindexverb */ + + +static boolean setlabelindexverb (hdltreenode hparam1, tyvaluerecord *v) { + + /* + 2006-04-24 creedon: created, cribbed from setlabelverb function + */ + + tyfilespec fs; + short index; + + if (!getpathvalue (hparam1, 1, &fs)) + return (false); + + flnextparamislast = true; + + if (!getintvalue (hparam1, 2, &index)) + return (false); + + return (setbooleanvalue (setfilelabelindex (&fs, index, true), v)); + } /* setlabelindexverb */ + + +static boolean getlabelnamesverb (hdltreenode hparam1, tyvaluerecord *v) { + #pragma unused (hparam1) + + /* + 2006-04-24 creedon: created, cribbed from statusbargetsectionsfunc case of langfunctionvalue function + */ + + bigstring bsarray [8]; + hdllistrecord hlist; + int ix; + RGBColor labelcolor; + short mapfromuserinterfaceindex [8] = {0, 6, 7, 5, 2, 4, 3, 1}; + + for (ix = 0; ix < 8; ++ix) + + if (GetLabel (ix, &labelcolor, bsarray [ix]) != noErr) + + return (false); + + if (!opnewlist (&hlist, false)) + return (false); + + for (ix = 0; ix < 8; ++ix) + + if (!langpushliststring (hlist, bsarray [mapfromuserinterfaceindex [ix]])) + + goto getlabelnamesverberror; + + return (setheapvalue ((Handle) hlist, listvaluetype, v)); + + getlabelnamesverberror: + + opdisposelist (hlist); + + return (false); + + } /* getlabelnamesverb */ + #endif @@ -3529,7 +3617,15 @@ return (true); } + + case getlabelindexfunc: /* 2006-04-24 creedon */ + return (getlabelindexverb (hp1, v)); + case setlabelindexfunc: /* 2006-04-24 creedon */ + return (setlabelindexverb (hp1, v)); + + case getlabelnamesfunc: /* 2006-04-24 creedon */ + return (getlabelnamesverb (hp1, v)); #endif case folderfrompathfunc: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-24 20:03:16
|
Revision: 1328 Author: sethdill Date: 2006-04-24 13:02:59 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1328&view=rev Log Message: ----------- Frontier is now a COM client. - call initCOM() before using any COM interfaces - a thread global keeps track of whether or not COM has already been initialized for the current thread (so it won't happen more than once) - disposeglobals closes down the COM connection The table of character sets at string.charsets is now for informational purposes only. The item names are the internet names, and the value is a 'display name' for the character set. The string.convertCharset verb now takes internet names instead of code page ID's. New verb string.isCharsetAvailabe(). Give it an internet name, it returns a boolean. All changes for Windows only. Two platforms are mostly in sync now, but for a couple tweaks still lacking on the mac. Modified Paths: -------------- Frontier/trunk/Common/SystemHeaders/standard.h Frontier/trunk/Common/headers/frontierdefs.h Frontier/trunk/Common/headers/osincludes.h Frontier/trunk/Common/headers/processinternal.h Frontier/trunk/Common/headers/strings.h Frontier/trunk/Common/resources/Win32/kernelverbs.rc Frontier/trunk/Common/source/FrontierWinMain.c Frontier/trunk/Common/source/lang.c Frontier/trunk/Common/source/langstartup.c Frontier/trunk/Common/source/process.c Frontier/trunk/Common/source/shell.c Frontier/trunk/Common/source/strings.c Modified: Frontier/trunk/Common/SystemHeaders/standard.h =================================================================== --- Frontier/trunk/Common/SystemHeaders/standard.h 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/SystemHeaders/standard.h 2006-04-24 20:02:59 UTC (rev 1328) @@ -437,6 +437,10 @@ #define quickdrawglobal(x) qd.x +extern boolean flcominitialized; /* set up in lang.c */ +extern boolean initCOM( void ); /* see FrontierWinMain.c */ +extern void shutdownCOM( void ); + #endif #endif Modified: Frontier/trunk/Common/headers/frontierdefs.h =================================================================== --- Frontier/trunk/Common/headers/frontierdefs.h 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/headers/frontierdefs.h 2006-04-24 20:02:59 UTC (rev 1328) @@ -35,11 +35,13 @@ #ifdef WIN95VERSION #define FRONTIERCOM 1 -#ifndef OPMLEDITOR - #define FRONTIERWEB 0 -#else //OPMLEDITOR - #define FRONTIERWEB 1 /* 2006-02-05 aradke: enable HTML display in main window background */ -#endif // OPMLEDITOR + + #ifndef OPMLEDITOR + #define FRONTIERWEB 0 + #else //OPMLEDITOR + #define FRONTIERWEB 1 /* 2006-02-05 aradke: enable HTML display in main window background */ + #endif // OPMLEDITOR + #undef winhybrid #define fljustpacking 0 #undef flcomponent Modified: Frontier/trunk/Common/headers/osincludes.h =================================================================== --- Frontier/trunk/Common/headers/osincludes.h 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/headers/osincludes.h 2006-04-24 20:02:59 UTC (rev 1328) @@ -37,6 +37,8 @@ #ifdef WIN95VERSION #define WIN32_LEAN_AND_MEAN 1 + #define _WIN32_DCOM 1 + #define CINTERFACE 1 #include <windows.h> @@ -55,6 +57,10 @@ #include <winsock2.h> #include <mswsock.h> + #undef __cplusplus + #include <objbase.h> + #include <mlang.h> + #endif /* WIN95VERSION */ Modified: Frontier/trunk/Common/headers/processinternal.h =================================================================== --- Frontier/trunk/Common/headers/processinternal.h 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/headers/processinternal.h 2006-04-24 20:02:59 UTC (rev 1328) @@ -195,6 +195,9 @@ ThreadEntryUPP threadEntryCallbackUPP; #endif + + boolean flcominitialized; + } tythreadglobals, *ptrthreadglobals, **hdlthreadglobals; Modified: Frontier/trunk/Common/headers/strings.h =================================================================== --- Frontier/trunk/Common/headers/strings.h 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/headers/strings.h 2006-04-24 20:02:59 UTC (rev 1328) @@ -161,6 +161,7 @@ extern void copyctopstring (const char *, bigstring); #ifdef WIN95VERSION +extern boolean copyWideToPString (const wchar_t *, bigstring); extern void copyrezstring (const bigstring, bigstring); #endif @@ -266,9 +267,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean convertCharset( Handle, Handle, const bigstring, const bigstring ); +extern boolean convertCharset( Handle, Handle, bigstring, bigstring ); -extern boolean isTextEncodingAvailable( const bigstring ); /* 2006-04-23 smd */ +extern boolean isTextEncodingAvailable( bigstring ); /* 2006-04-23 smd */ #endif Modified: Frontier/trunk/Common/resources/Win32/kernelverbs.rc =================================================================== --- Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/resources/Win32/kernelverbs.rc 2006-04-24 20:02:59 UTC (rev 1328) @@ -514,7 +514,7 @@ 1, //Number of "blocks" in this resource "string\0", //Function Processor Name false, //Window required - 59, //Count of verbs + 60, //Count of verbs "delete\0", "insert\0", "popleading\0", @@ -573,7 +573,8 @@ "multiplereplaceall\0", "macromantoutf8\0", // 2006-02-25 creedon "utf8tomacroman\0", // 2006-02-25 creedon - "convertcharset\0" /* 2006-04-16 smd */ + "convertcharset\0", /* 2006-04-16 smd */ + "ischarsetavailable\0" /* 2006-04-24 smd */ END Modified: Frontier/trunk/Common/source/FrontierWinMain.c =================================================================== --- Frontier/trunk/Common/source/FrontierWinMain.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/FrontierWinMain.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -2974,8 +2974,38 @@ } /*COMSYSModule*/ +boolean initCOM () +{ + if ( !flcominitialized ) + { + LPVOID reserved = NULL; + HRESULT err; + + err = CoInitialize( reserved ); + + if ( SUCCEEDED( err ) ) + { + flcominitialized = true; + return (true); + } + else + return (false); + } + + return (true); +} + +void shutdownCOM () +{ + CoUninitialize(); + flcominitialized = false; +} + + Handle COMStartup () { + initCOM(); + gcomServerInfo.hCOMModule = LoadLibrary ("COMDLL.DLL"); if (gcomServerInfo.hCOMModule == NULL) @@ -2991,7 +3021,7 @@ if ((gcomServerInfo.cominit != NULL) && (gcomServerInfo.comclear != NULL)) { fillcalltable(&gcomServerInfo.calltable); - + (*(gcomServerInfo.cominit)) (gcomServerInfo.hInstance, gcomServerInfo.hPrevInstance, gcomServerInfo.lpCmdLine, gcomServerInfo.nCmdShow, &gcomServerInfo.calltable); } } @@ -3000,6 +3030,8 @@ } /*COMStartup*/ boolean COMShutdown () { + shutdownCOM(); + if ((gcomServerInfo.cominit != NULL) && (gcomServerInfo.comclear != NULL)) (*(gcomServerInfo.comclear)) (); @@ -3009,6 +3041,7 @@ gcomServerInfo.cominit = NULL; gcomServerInfo.comclear = NULL; gcomServerInfo.hCOMModule = NULL; + return (true); } /*COMShutdown*/ Modified: Frontier/trunk/Common/source/lang.c =================================================================== --- Frontier/trunk/Common/source/lang.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/lang.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -81,7 +81,10 @@ tylangcallbacks langcallbacks; /*routines that wire the language into environment*/ +boolean flcominitialized = false; + + static short ctrootchains = 0; /*number of hashtable chains that include the root*/ static boolean flevaluateglobalwith = false; /*dmb 4.1b12 - new flag for langcard support*/ Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -426,6 +426,7 @@ static boolean initCharsetsTable (hdlhashtable cSetsTable) { +#if 1 #if MACVERSION OSStatus err; ItemCount ct, actual_ct, i; @@ -469,49 +470,59 @@ #endif #if WIN95VERSION - langassignlongvalue( cSetsTable, "\x05" "ASCII", 20127 ); - langassignlongvalue( cSetsTable, "\x08" "US-ASCII", 20127 ); /* alias for ASCII */ + HRESULT err; + IMultiLanguage2 * pMultiLanguage; + IEnumCodePage * pEnumCodePage; + UINT i, cnum = 0; + MIMECPINFO cpInfo; + long ccpInfo; + bigstring ianaName, displayName; + + initCOM(); + + err = CoCreateInstance( + &CLSID_CMultiLanguage, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IMultiLanguage2, + (void **) &pMultiLanguage ); + + if ( FAILED( err ) ) + goto done; + + err = pMultiLanguage->lpVtbl->EnumCodePages( + pMultiLanguage, + 0, // MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_VALID | MIMECONTF_MIME_LATEST + 9, /* LANGID. I'm totally guessing that 0 means "all", here. -- smd */ + (IEnumCodePage **) &pEnumCodePage ); - langassignlongvalue( cSetsTable, "\x09" "MACINTOSH", 10000 ); - langassignlongvalue( cSetsTable, "\x08" "MacRoman", 10000 ); /* alias for MACINTOSH */ + if ( FAILED( err ) ) + goto done; + + pMultiLanguage->lpVtbl->GetNumberOfCodePageInfo( pMultiLanguage, &cnum ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-1", 28591 ); - langassignlongvalue( cSetsTable, "\x0b" "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-2", 28592 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-3", 28593 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-4", 28594 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-5", 28595 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-6", 28596 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-7", 28597 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-8", 28598 ); - langassignlongvalue( cSetsTable, "\x0a" "iso-8859-9", 28599 ); - langassignlongvalue( cSetsTable, "\x0b" "iso-8859-10", 28592 ); - - langassignlongvalue( cSetsTable, "\x0c" "windows-1250", 1250 ); - langassignlongvalue( cSetsTable, "\x0f" "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - langassignlongvalue( cSetsTable, "\x0c" "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - langassignlongvalue( cSetsTable, "\x0c" "windows-1252", 1252 ); - langassignlongvalue( cSetsTable, "\x0f" "windows-latin-1", 1252 ); - - langassignlongvalue( cSetsTable, "\x0c" "windows-1253", 1253 ); /* code page 1253 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1254", 1254 ); /* code page 1254, Turkish */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1255", 1255 ); /* code page 1255 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1256", 1256 ); /* code page 1256 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1257", 1257 ); /* code page 1257 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1258", 1258 ); /* code page 1258 */ - langassignlongvalue( cSetsTable, "\x0c" "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - langassignlongvalue( cSetsTable, "\x05" "UTF-7", 65000 ); - langassignlongvalue( cSetsTable, "\x05" "UTF-8", 65001 ); - - langassignlongvalue( cSetsTable, "\x06" "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ - - langassignlongvalue( cSetsTable, "\x08" "UTF-16le", 1200 ); - langassignlongvalue( cSetsTable, "\x08" "UTF-16be", 1201 ); + // pcpInfo = (PMIMECPINFO)CoTaskMemAlloc( sizeof(MIMECPINFO) ); + + for ( i = 0; i < cnum; i++ ) + { + err = pEnumCodePage->lpVtbl->Next( pEnumCodePage, 1, &cpInfo, &ccpInfo ); + + if ( SUCCEEDED( err ) && ( ccpInfo != 0 ) ) + { + if ( copyWideToPString( cpInfo.wszWebCharset, ianaName ) + && copyWideToPString( cpInfo.wszDescription, displayName ) ) + langassignstringvalue( cSetsTable, ianaName, displayName ); + //langassignlongvalue( cSetsTable, ianaName, cpInfo.uiCodePage ); + } + } + + pEnumCodePage->lpVtbl->Release( pEnumCodePage ); + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); + // CoTaskMemFree( (LPVOID) pcpInfo ); + #endif - +#endif +done: return (true); } /* initCharsetsTable */ Modified: Frontier/trunk/Common/source/process.c =================================================================== --- Frontier/trunk/Common/source/process.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/process.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -1387,6 +1387,11 @@ listunlink ((hdllinkedlist) processthreadlist, (hdllinkedlist) hg); if (hg == hthreadglobals) { + + #ifdef WIN95VERSION + if ( flcominitialized ) + shutdownCOM(); + #endif disposehandle ((Handle) hashtablestack); @@ -1451,6 +1456,12 @@ (**hg).timesliceticks = processonehottimeslice; + /* + 2006-04-24 smd + has COM been initialized in this thread? + */ + (**hg).flcominitialized = false; + #ifdef landinclude id = getprocesscreator (); @@ -1580,6 +1591,12 @@ (**hg).tryerror = tryerror; (**hg).tryerrorstack = tryerrorstack; + + /* + 2006-04-24 smd + has COM been initialized in this thread? + */ + (**hg).flcominitialized = flcominitialized; } (**hg).langcallbacks = langcallbacks; Modified: Frontier/trunk/Common/source/shell.c =================================================================== --- Frontier/trunk/Common/source/shell.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/shell.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -256,7 +256,7 @@ fileshutdown(); UnregisterAppearanceClient(); #endif - + exittooperatingsystem (); /*doesn't return*/ return (true); /*satisfy the compiler -- not a void function*/ Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-24 01:03:36 UTC (rev 1327) +++ Frontier/trunk/Common/source/strings.c 2006-04-24 20:02:59 UTC (rev 1328) @@ -27,6 +27,7 @@ #include "frontier.h" #include "standard.h" +#include "FrontierWinMain.h" #include "font.h" #include "memory.h" @@ -59,7 +60,7 @@ /* declarations */ static boolean converttextencoding( Handle, Handle, const long, const long ); -static boolean getTextEncodingID( const bigstring, long * ); +static boolean getTextEncodingID( bigstring, long * ); #ifdef WIN95VERSION static HRESULT UnicodeToAnsi(Handle, Handle, unsigned long); @@ -1678,6 +1679,42 @@ } /*parsenumberstring*/ + +#ifdef WIN95VERSION +boolean copyWideToPString( const wchar_t * inString, bigstring bs ) +{ + HRESULT err; + size_t lenOut; + + err = wcstombs_s( &lenOut, bs, 255, inString, _TRUNCATE ); + + if ( FAILED( err ) ) + return (false); + + convertcstring( bs ); + + return (true); +} /* copyWideToPString */ + +boolean copyPStringToWide( bigstring bs, long * lenResult, wchar_t * outString ) +{ + HRESULT err; + size_t lenOut; + + convertpstring( bs ); + + err = mbstowcs_s( &lenOut, outString, 255, (const char *) bs, _TRUNCATE ); + + if ( SUCCEEDED( err ) ) + { + *lenResult = (long) lenOut; + return (true); + } + else + return (false); +} +#endif + void convertpstring (bigstring bs) { /* @@ -2278,14 +2315,14 @@ ULONG cbAnsi, cCharacters; long lentext; - cCharacters = wcslen((const unsigned short*) *h)+1; + cCharacters = wcslen((wchar_t *) *h)+1; cbAnsi = cCharacters * 2; sethandlesize (hresult, cbAnsi); // Convert to ANSI. - lentext = WideCharToMultiByte(encoding, 0,(const unsigned short*) *h, -1, *hresult, + lentext = WideCharToMultiByte( encoding, 0,(wchar_t *) *h, -1, *hresult, cbAnsi, NULL, NULL); sethandlesize (hresult, lentext - 1); @@ -2298,13 +2335,16 @@ { /* - 7.0b42 PBS: convert from Unicode to Ansi. Borrowed from Microsoft sample code. + 7.0b42 PBS: convert from ANSI to Unicode. Borrowed from Microsoft sample code. + + 2006-04-24 smd: + fixed the description in the previous comment line + rewrote most of the function */ ULONG cbUni, cCharacters; long lentext; - unsigned long ix; - char lastch = ' '; + // unsigned long ix; cCharacters = gethandlesize (h); @@ -2316,35 +2356,15 @@ sethandlesize (hresult, cbUni); // Convert to ANSI. - lentext = MultiByteToWideChar (encoding, 0, *h, -1, (unsigned short*) *hresult, cbUni); + lentext = MultiByteToWideChar (encoding, 0, *h, cCharacters, (wchar_t *) *hresult, cbUni); - ix = 0; + if ( lentext > 0 ) /* FIXME: what should we do if lentext is 0, which is an error condition? */ + { + sethandlesize( hresult, ( lentext + 1 ) * 2 ); + ((wchar_t *)(*hresult))[lentext] = L'\0'; + } - while (true) { /*find terminator*/ - - char ch = (*hresult) [ix]; - - if (ch == '\0') { - - if ((*hresult) [ix + 1] == '\0') { - - sethandlesize (hresult, ix + 2); - - break; - } /* if */ - - } /*if*/ - - ix += 2; - - if (ix > cbUni) - break; - - lastch = ch; - } /*while*/ - return NOERROR; - } #endif /*end Windows character conversion routines*/ @@ -2352,7 +2372,7 @@ /* convert an "internet name" for an encoding into a platform-specific id for the character set */ -static boolean getTextEncodingID( const bigstring bsEncodingName, long * encodingId ) { +static boolean getTextEncodingID( bigstring bsEncodingName, long * encodingId ) { #ifdef MACVERSION @@ -2367,6 +2387,48 @@ *encodingId = (long) oneEncoding; #endif + +#ifdef WIN95VERSION + + HRESULT err; + IMultiLanguage2 * pMultiLanguage; + MIMECSETINFO setInfo; + wchar_t ianaName[ 512 ]; + long lenIanaName; + + lowertext( (ptrbyte) (bsEncodingName + 1), (long) bsEncodingName[ 0 ] ); + + if ( equalstrings( bsEncodingName, BIGSTRING ("\x06" "utf-16") ) ) + { + *encodingId = 0; + return (true); + } + + initCOM(); + + err = CoCreateInstance( + &CLSID_CMultiLanguage, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IMultiLanguage2, + (void **) &pMultiLanguage ); + + if ( FAILED( err ) ) + return (false); + + copyPStringToWide( bsEncodingName, &lenIanaName, ianaName ); + + // pSetInfo = (PMIMECSETINFO)CoTaskMemAlloc( sizeof(MIMECSETINFO) ); + + err = pMultiLanguage->lpVtbl->GetCharsetInfo( pMultiLanguage, ianaName, &setInfo ); + if ( FAILED( err ) ) + return (false); + + *encodingId = (long)(setInfo.uiInternetEncoding); + + pMultiLanguage->lpVtbl->Release( pMultiLanguage ); + +#endif return (true); } @@ -2375,20 +2437,14 @@ determine if the specified character set is recognized by the OS bsEncodingName is an IANA-friendly name like "utf-8" , "macintosh", or "iso-8859-1" */ -boolean isTextEncodingAvailable( const bigstring bsEncodingName ) +boolean isTextEncodingAvailable( bigstring bsEncodingName ) { long encodingId; - boolean fl; - fl = getTextEncodingID( bsEncodingName, &encodingId ); - - if ( ! fl ) + if ( ! getTextEncodingID( bsEncodingName, &encodingId ) ) return (false); - if ( encodingId < 0 ) - return (false); - - return (true); + return ( encodingId >= 0 ); } static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset) { @@ -2478,14 +2534,15 @@ if ((*h) [0] == '\xFF') pullfromhandle (hresult,0, 1, NULL); /* Pop off the BOM */ + return (true); + default: { lentext = gethandlesize (h); switch ( outputcharset ) { case 0: /* unicode with BOM, not handled as a code page. I Sitll Hatesk Windows (and rrrabbits) */ - if (AnsiToUnicode (h, hresult, inputcharset)) - return (false); + return (!AnsiToUnicode (h, hresult, inputcharset)); default: { Handle htemp; @@ -2524,12 +2581,22 @@ } /*converttextencoding*/ -boolean convertCharset( Handle hString, Handle hresult, const bigstring charsetIn, const bigstring charsetOut ) +boolean convertCharset( Handle hString, Handle hresult, bigstring charsetIn, bigstring charsetOut ) { #ifdef MACVERSION TextEncoding teInputSet, teOutputSet; - + +#endif + +#ifdef WIN95VERSION + + long teInputSet, teOutputSet; + + initCOM(); + +#endif + if ( ! getTextEncodingID( charsetIn, (long *) &teInputSet ) ) { // FIXME: generate error, encoding not available @@ -2542,13 +2609,7 @@ return (false); } - return converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet ); - -#endif - -#ifdef WIN95VERSION - -#endif + return ( converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet ) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-24 01:03:43
|
Revision: 1327 Author: sethdill Date: 2006-04-23 18:03:36 -0700 (Sun, 23 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1327&view=rev Log Message: ----------- First half of changes to re-work string.convertCharset(), so that it now takes internet naems (IANA names) instead of platform-specific codes. - also, added new verb string.ischarsetavailable() to make life a little easier for the scripter. Takes one argument, the internet-friendly name of the character set whose existence is being tested (like 'utf-8'). Modified Paths: -------------- Frontier/trunk/Common/headers/strings.h Frontier/trunk/Common/resources/Mac/kernelverbs.r Frontier/trunk/Common/source/strings.c Frontier/trunk/Common/source/stringverbs.c Modified: Frontier/trunk/Common/headers/strings.h =================================================================== --- Frontier/trunk/Common/headers/strings.h 2006-04-22 21:06:49 UTC (rev 1326) +++ Frontier/trunk/Common/headers/strings.h 2006-04-24 01:03:36 UTC (rev 1327) @@ -266,9 +266,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean gettextencodingid (const Handle, long *); /* 2006-04-20 smd */ +extern boolean convertCharset( Handle, Handle, const bigstring, const bigstring ); -extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ +extern boolean isTextEncodingAvailable( const bigstring ); /* 2006-04-23 smd */ #endif Modified: Frontier/trunk/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-22 21:06:49 UTC (rev 1326) +++ Frontier/trunk/Common/resources/Mac/kernelverbs.r 2006-04-24 01:03:36 UTC (rev 1327) @@ -601,7 +601,8 @@ "multipleReplaceAll", "macromantoutf8", // 2006-02-25 creedon "utf8tomacroman", // 2006-02-25 creedon - "convertcharset" /* 2006-04-13 smd */ + "convertcharset", /* 2006-04-13 smd */ + "ischarsetavailable" /* 2006-04-23 smd */ } } }; Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-22 21:06:49 UTC (rev 1326) +++ Frontier/trunk/Common/source/strings.c 2006-04-24 01:03:36 UTC (rev 1327) @@ -56,8 +56,19 @@ static byte bshexprefix [] = STR_hexprefix; +/* declarations */ +static boolean converttextencoding( Handle, Handle, const long, const long ); +static boolean getTextEncodingID( const bigstring, long * ); +#ifdef WIN95VERSION + static HRESULT UnicodeToAnsi(Handle, Handle, unsigned long); + static HRESULT AnsiToUnicode(Handle, Handle, unsigned long); +#endif + + +/* definitions */ + boolean equalstrings (const bigstring bs1, const bigstring bs2) { /* @@ -2341,21 +2352,15 @@ /* convert an "internet name" for an encoding into a platform-specific id for the character set */ -boolean gettextencodingid (const Handle h, long * encodingId) { +static boolean getTextEncodingID( const bigstring bsEncodingName, long * encodingId ) { #ifdef MACVERSION OSStatus err; TextEncoding oneEncoding; - bigstring ianaName; - long ct, ix = 0; - ct = gethandlesize (h); - ianaName [0] = (byte) ct; - loadfromhandle (h, &ix, ct, ianaName + 1); + err = TECGetTextEncodingFromInternetName( &oneEncoding, bsEncodingName ); - err = TECGetTextEncodingFromInternetName( &oneEncoding, ianaName ); - if ( err != noErr ) return (false); @@ -2366,8 +2371,27 @@ return (true); } +/* + determine if the specified character set is recognized by the OS + bsEncodingName is an IANA-friendly name like "utf-8" , "macintosh", or "iso-8859-1" +*/ +boolean isTextEncodingAvailable( const bigstring bsEncodingName ) +{ + long encodingId; + boolean fl; + + fl = getTextEncodingID( bsEncodingName, &encodingId ); + + if ( ! fl ) + return (false); + + if ( encodingId < 0 ) + return (false); + + return (true); +} -boolean converttextencoding (Handle h, Handle hresult, long inputcharset, long outputcharset) { +static boolean converttextencoding( Handle h, Handle hresult, const long inputcharset, const long outputcharset) { #ifdef MACVERSION /*Mac character conversion common routine*/ @@ -2378,10 +2402,6 @@ long pullBytes = 0; long lentext = gethandlesize (h); - // sethandlesize (h, lentext + 1); - - // (*h) [lentext] = '\0'; - status = TECCreateConverter (&converter, inputcharset, outputcharset); if ( status != noErr ) { TECDisposeConverter (converter); @@ -2419,15 +2439,6 @@ } } - //old code - // if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /*pop byte order mark*/ - // pullfromhandle (h, 0, 3, NULL); - - /* - if (pullBytes > 0) - pullfromhandle (h, 0, pullBytes, NULL); - */ - lentext = gethandlesize (h) - pullBytes; status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); @@ -2445,10 +2456,6 @@ return (true); - // kwchange 2005-05-23 --- commented out to see if this is the missing trailing char bug - // kwchange 2005-05-27 --- ran this the last week and have no complains - //sethandlesize (hresult, gethandlesize (hresult) - 1); /*pop trailing terminator*/ - #endif /*end Mac character conversion routine(s)*/ #ifdef WIN95VERSION @@ -2517,6 +2524,34 @@ } /*converttextencoding*/ +boolean convertCharset( Handle hString, Handle hresult, const bigstring charsetIn, const bigstring charsetOut ) +{ +#ifdef MACVERSION + + TextEncoding teInputSet, teOutputSet; + + if ( ! getTextEncodingID( charsetIn, (long *) &teInputSet ) ) + { + // FIXME: generate error, encoding not available + return (false); + } + + if ( ! getTextEncodingID( charsetOut, (long *) &teOutputSet ) ) + { + // FIXME: generate error, encoding not available + return (false); + } + + return converttextencoding( hString, hresult, (long) teInputSet, (long) teOutputSet ); + +#endif + +#ifdef WIN95VERSION + +#endif +} + + boolean utf16toansi (Handle h, Handle hresult) { /* Modified: Frontier/trunk/Common/source/stringverbs.c =================================================================== --- Frontier/trunk/Common/source/stringverbs.c 2006-04-22 21:06:49 UTC (rev 1326) +++ Frontier/trunk/Common/source/stringverbs.c 2006-04-24 01:03:36 UTC (rev 1327) @@ -312,6 +312,8 @@ utf8tomacromanfunc, // 2006-02-25 creedon convertcharsetfunc, /* 2006-04-14 smd */ + + ischarsetavailablefunc, /* 2006-04-23 smd */ ctstringverbs } tystringtoken; @@ -1319,6 +1321,21 @@ } /*latintomac*/ +static boolean isCharsetAvailableVerb( hdltreenode hp1, tyvaluerecord *v ) +{ + bigstring bscharset; + + flnextparamislast = true; + + if ( !getstringvalue( hp1, 1, bscharset ) ) /* IANA names can't be longer than 40 ASCII characters, so this is safe */ + return (false); + + (*v).data.flvalue = isTextEncodingAvailable( bscharset ); + + return (true); +} + + static boolean stringfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) { /* @@ -2302,32 +2319,39 @@ return (setheapvalue (hresult, stringvaluetype, v)); } - case convertcharsetfunc: { /* 2006-04-13 smd: convert any character set to any other character set, if the os supports it */ - + case convertcharsetfunc: /* 2006-04-13 smd: convert any character set to any other character set, if the os supports it */ + { Handle h, hresult; - long charsetIn, charsetOut; + bigstring charsetIn, charsetOut; - if (!getlongvalue (hp1, 1, &charsetIn)) + /* + the "internet names" of character sets are 40 ASCII chars or less, + so this is a safe way to get the params + */ + if ( !getstringvalue( hp1, 1, charsetIn ) ) goto error; - if (!getlongvalue (hp1, 2, &charsetOut)) + if ( !getstringvalue( hp1, 2, charsetOut ) ) goto error; flnextparamislast = true; - if (!getreadonlytextvalue (hp1, 3, &h)) + if ( !getreadonlytextvalue( hp1, 3, &h ) ) goto error; - newemptyhandle (&hresult); + newemptyhandle( &hresult ); - if (! converttextencoding (h, hresult, charsetIn, charsetOut)) + if ( !convertCharset( h, hresult, charsetIn, charsetOut ) ) goto error; - // disposehandle(h); - - return (setheapvalue (hresult, stringvaluetype, v)); - } + return ( setheapvalue( hresult, stringvaluetype, v ) ); + } + case ischarsetavailablefunc: /* 2006-04-23 smd: determine if a character set is available, based on an internet-friendly (IANA) name */ + { + return isCharsetAvailableVerb( hparam1, v ); + } + default: errornum = notimplementederror; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 21:06:56
|
Revision: 1326 Author: sethdill Date: 2006-04-22 14:06:49 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1326&view=rev Log Message: ----------- Merged r1297:1323 from trunk into Conversant branch. Final batch. Modified Paths: -------------- Frontier/branches/Conversant/FrontierSDK/Toolkits/AppletToolkit/Headers/appleticons.h Frontier/branches/Conversant/README.txt Modified: Frontier/branches/Conversant/FrontierSDK/Toolkits/AppletToolkit/Headers/appleticons.h =================================================================== --- Frontier/branches/Conversant/FrontierSDK/Toolkits/AppletToolkit/Headers/appleticons.h 2006-04-22 21:01:48 UTC (rev 1325) +++ Frontier/branches/Conversant/FrontierSDK/Toolkits/AppletToolkit/Headers/appleticons.h 2006-04-22 21:06:49 UTC (rev 1326) @@ -9,13 +9,13 @@ -#define atNone 0x0 -#define atVerticalCenter 0x1 -#define atTop 0x2 -#define atBottom 0x3 -#define atHorizontalCenter 0x4 -#define atLeft 0x8 -#define atRight 0xC +#define atNone 0x00 +#define atVerticalCenter 0x01 +#define atTop 0x02 +#define atBottom 0x03 +#define atHorizontalCenter 0x04 +#define atLeft 0x08 +#define atRight 0x0C extern unsigned short ttLabel [8]; Modified: Frontier/branches/Conversant/README.txt =================================================================== --- Frontier/branches/Conversant/README.txt 2006-04-22 21:01:48 UTC (rev 1325) +++ Frontier/branches/Conversant/README.txt 2006-04-22 21:06:49 UTC (rev 1326) @@ -1,18 +1,95 @@ -*** UserLand Frontier(tm) -- Version 10.0 Open Source Release +*** UserLand Frontier(tm) -- Version 10.1 Open Source Release *** -Last updated 02 Jan 2005 by Terry Teague +Last updated 22 Apr 2006 by Andre Radke Since the original v10.0a1 Open Source release of Frontier, additional work has been done to allow the building of Frontier using other development environments. The following sections describe these environments. -*** Supported Development Environments +A. Apple Xcode Tools for Mac OS X +================================= + +Build directory : build_XCode -A. Metrowerks CodeWarrior Pro for Mac or Windows +Getting Started with Xcode v1.2 or v1.5 or v2.0 +----------------------------------------------- + +1. Open the Frontier.xcode project in Xcode. + +2. Click the Build button. + +Getting Started with Xcode v2.1 and higher +------------------------------------------ + +1. Open the FrontierFat.xcodeproj project in Xcode. + +2. Click the Build button. + +Notes +----- + +Both the Frontier.xcode and the FrontierFat.xcodeproj projects offer a +development and a deployment build style. + +In the FrontierFat.xcodeproj +project, the development build style will compile for the native +architecture only, but the deployment build style will compile a +Universal Binary of Frontier which will run on both PPC and Intel Macs. + + +B. Microsoft Visual Studio .NET 2005 +==================================== + +Build directory: build_VC2k5 + +Getting Started: +---------------- + +1. Open the Frontier.sln solution file in Visual Studio. + +2. Select the Configuration Manager from the Build menu and switch +the Active Solution Configuration to Debug. Click the Close button. + +3. Select Build Solution from the Build menu. + + +C. Microsoft Visual Studio .NET 2003 +==================================== + +Build directory: build_VC2k3 + +Getting Started: +---------------- + +1. Open the Frontier.sln solution file in Visual Studio. + +2. Select the Configuration Manager from the Build menu and switch +the Active Solution Configuration to Debug. Click the Close button. + +3. Select Build Solution from the Build menu. + + +D. Microsoft Visual Studio C++ 6.0 for Windows +============================================== + +Build directory : build_VC6 + +Getting Started +--------------- + +1. Open the Frontier.dsp project in MS Visual Studio. + +2. Choose a build configuration from the Project menu. It is a good idea +to start with the Debug build configuration. + +3. Build. + + +E. Metrowerks CodeWarrior Pro for Mac or Windows ================================================ -CVS module, build directory : build_CWPro8 +Build directory : build_CWPro8 Building the Frontier kernel currently requires Metrowerks CodeWarrior Pro 8 for Mac or Windows with the 8.3 updates. Other versions might @@ -40,77 +117,26 @@ Notes ----- -When you open the Frontier.mcp project file on Windows or on classic Mac -OS, CodeWarrior will complain that the access path +When you open the Frontier.mcp project file on Windows, CodeWarrior will +complain that the access path {System}Library/CFM Support/StubLibraries cannot be found. This means that you will not be able to build the Mac -OS X version on those platforms, but it does not affect the versions for -Windows and classic Mac OS. +OS X version on that platforms, but it does not affect the versions for +Windows. -When you build the Frontier PPC or Frontier PPC Debug targets, expect -CodeWarrior to report a single link warning about the errno variable -being defined in OTXTILib and MSL_ALL_PPC.Lib (or MSL_ALL_PPC_D.Lib). -You can safely ignore this warning. - When you build the Frontier Win or Frontier Win Debug target, expect CodeWarrior to report about 240 compiler warnings, mostly about redeclared identifiers in Microsoft header files, some missing function prototypes, and some unused variables. You can ignore these warnings. -B. Microsoft Visual Studio C++ for Windows +F. GNU Tools (initially for Mac OS X only) ========================================== -CVS module, build directory : build_VC6 +Build directory : build_GNU -Building the Frontier kernel currently requires Microsoft Visual Studio -C++ v6. Other versions might work, too, but have not been tested. - -Getting Started ---------------- - -1. Open the Frontier.dsp project in MS Visual Studio. - -2. Build. - -Notes ------ - -Needs more accurate build instructions. - - -C. Apple Xcode Tools for Mac OS X -================================= - -CVS module, build directory : build_XCode - -Building the Frontier kernel currently requires Xcode v1.2 or v1.5. -Other versions might work, too, but have not been tested. - -Getting Started ---------------- - -1. Open the Frontier.xcode project in Xcode. - -2. Click the Build button. - -Notes ------ - -The support for Xcode is preliminary, and currently builds a Debug -(Development build style) version by default. - -When you build, expect Xcode to report a couple of compiler warnings. -You can ignore these warnings. - - -D. GNU Tools (initially for Mac OS X only) -========================================== - -CVS module, build directory : build_GNU - Building the Frontier kernel currently requires the Mac OS X Developer Tools to be installed on Mac OS X. Older tools using Project Builder, or newer tools using Xcode should work, using 'gcc' v3.3. Other versions of @@ -143,7 +169,7 @@ Support for building the Windows version using Cygwin/MinGW or other GNU based development environments on Windows systems, and support for building the Windows -version using WINE on non-Windows systems, is being developed. +version using WINE on non-Windows systems, may be added in the future. *** Reporting Problems This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 21:01:53
|
Revision: 1325 Author: sethdill Date: 2006-04-22 14:01:48 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1325&view=rev Log Message: ----------- Merged trunk changes r1297:1323 into the Conversant branch. Missed this one in the last commit. Modified Paths: -------------- Frontier/branches/Conversant/Common/IOAToolkit/ioaicon.c Modified: Frontier/branches/Conversant/Common/IOAToolkit/ioaicon.c =================================================================== --- Frontier/branches/Conversant/Common/IOAToolkit/ioaicon.c 2006-04-22 20:56:10 UTC (rev 1324) +++ Frontier/branches/Conversant/Common/IOAToolkit/ioaicon.c 2006-04-22 21:01:48 UTC (rev 1325) @@ -232,7 +232,7 @@ (**h).haslabel = true; - (**h).align = atVerticalCenter + atHorizontalCenter; + (**h).align = kAlignAbsoluteCenter; *hdata = h; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 20:56:32
|
Revision: 1324 Author: sethdill Date: 2006-04-22 13:56:10 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1324&view=rev Log Message: ----------- Merged trunk changes r1297:1323 into the Conversant branch. Only includes changes in Common/ Modified Paths: -------------- Frontier/branches/Conversant/Common/headers/icon.h Frontier/branches/Conversant/Common/headers/stringdefs.h Frontier/branches/Conversant/Common/headers/strings.h Frontier/branches/Conversant/Common/headers/tablestructure.h Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r Frontier/branches/Conversant/Common/source/about.c Frontier/branches/Conversant/Common/source/claylinelayout.c Frontier/branches/Conversant/Common/source/icon.c Frontier/branches/Conversant/Common/source/langhash.c Frontier/branches/Conversant/Common/source/langpack.c Frontier/branches/Conversant/Common/source/langstartup.c Frontier/branches/Conversant/Common/source/opicons.c Frontier/branches/Conversant/Common/source/strings.c Frontier/branches/Conversant/Common/source/stringverbs.c Frontier/branches/Conversant/Common/source/tabledisplay.c Frontier/branches/Conversant/Common/source/tablestructure.c Modified: Frontier/branches/Conversant/Common/headers/icon.h =================================================================== --- Frontier/branches/Conversant/Common/headers/icon.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/icon.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -32,6 +32,7 @@ #define atVerticalCenter 0x01 #define atHorizontalCenter 0x02 #define kTransformSelected 0x04 + #define kAlignAbsoluteCenter (atVerticalCenter | atHorizontalCenter) #endif #ifdef MACVERSION /*7.0b9 PBS: tycustomicontypeinfo is for Mac custom icons*/ Modified: Frontier/branches/Conversant/Common/headers/stringdefs.h =================================================================== --- Frontier/branches/Conversant/Common/headers/stringdefs.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/stringdefs.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -78,6 +78,7 @@ #define STR_this BIGSTRING ("\x04" "this") #define STR_temp "\x04" "temp" #define STR_environment "\x0b" "environment" + #define STR_charsets "\x08" "charsets" #define STR_Stack_overflow BIGSTRING ("\x0f" "Stack overflow!") Modified: Frontier/branches/Conversant/Common/headers/strings.h =================================================================== --- Frontier/branches/Conversant/Common/headers/strings.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/strings.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -266,7 +266,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean converttextencoding (Handle, Handle, long, long); +extern boolean gettextencodingid (const Handle, long *); /* 2006-04-20 smd */ +extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ + #endif Modified: Frontier/branches/Conversant/Common/headers/tablestructure.h =================================================================== --- Frontier/branches/Conversant/Common/headers/tablestructure.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/tablestructure.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -180,7 +180,9 @@ extern hdlhashtable environmenttable; +extern hdlhashtable charsetstable; + extern byte nameinternaltable []; extern byte namemenubar []; @@ -227,7 +229,9 @@ extern byte nameenvironmenttable []; +extern byte namecharsetstable []; + /*prototypes*/ extern boolean linksystemtablestructure (hdlhashtable); /*tablestructure.c*/ Modified: Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-22 20:56:10 UTC (rev 1324) @@ -601,7 +601,7 @@ "multipleReplaceAll", "macromantoutf8", // 2006-02-25 creedon "utf8tomacroman", // 2006-02-25 creedon - "convertcharset" /* 2006-04-13 */ + "convertcharset" /* 2006-04-13 smd */ } } }; Modified: Frontier/branches/Conversant/Common/source/about.c =================================================================== --- Frontier/branches/Conversant/Common/source/about.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/about.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -279,7 +279,7 @@ if (GetIconRefFromFile (&programfspec, &iconref, &label) == noErr) { - ec = PlotIconRef (&r, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref); + ec = PlotIconRef (&r, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref); ReleaseIconRef (iconref); @@ -288,7 +288,7 @@ } /*if*/ #endif - ploticonresource (&rcicn, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, idfrontiericon); + ploticonresource (&rcicn, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, idfrontiericon); } /*ccdrawfrontiericon*/ Modified: Frontier/branches/Conversant/Common/source/claylinelayout.c =================================================================== --- Frontier/branches/Conversant/Common/source/claylinelayout.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/claylinelayout.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -931,7 +931,7 @@ transform = 0x4000; #ifdef MACVERSION - ploticonresource ((Rect *) iconrect, atVerticalCenter + atHorizontalCenter, transform, iconnum); + ploticonresource ((Rect *) iconrect, kAlignAbsoluteCenter, transform, iconnum); #endif #ifdef WIN95VERSION Modified: Frontier/branches/Conversant/Common/source/icon.c =================================================================== --- Frontier/branches/Conversant/Common/source/icon.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/icon.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -41,6 +41,8 @@ #include "resources.h" /*7.0b9 PBS*/ #include "launch.h" /*7.0b9 PBS*/ +#include "byteorder.h" + /* #define macicon 128 #define bugicon 129 @@ -74,15 +76,26 @@ 1.0b21 dmb: try geting normal b&w icon if all else fails 5.0a8 dmb: use srccopy, not srcand for win blits + + Note that the Windows version does NOT use the transform parameter */ #ifdef MACVERSION OSErr ec; CIconHandle hcicon; Handle hicon; + Rect rlocal = *r; - ec = PlotIconID (r, align, transform, resid); +#ifdef SWAP_BYTE_ORDER + /* For some unknown reason the Intel OS X builds shift the icon displays */ + rlocal.top += 3; + rlocal.bottom += 3; + rlocal.left += 6; + rlocal.right += 6; +#endif + ec = PlotIconID (&rlocal, align, transform, resid); + if (ec == noErr) return (true); @@ -90,7 +103,7 @@ if (hcicon != nil) { - PlotCIcon (r, hcicon); + PlotCIcon (&rlocal, hcicon); DisposeCIcon (hcicon); @@ -101,7 +114,7 @@ if (hicon != nil) { - PlotIcon (r, hicon); + PlotIcon (&rlocal, hicon); /*ReleaseResource (hicon);*/ /*dmb 1.0b21 - don't need to*/ Modified: Frontier/branches/Conversant/Common/source/langhash.c =================================================================== --- Frontier/branches/Conversant/Common/source/langhash.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langhash.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -2924,6 +2924,8 @@ 2002-11-11 AR: Added assert to make sure the C compiler chose the proper byte alignment for the tydisktablerecord struct. If it did not, we would end up corrupting any database files we saved. + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ boolean fl; @@ -3122,6 +3124,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb **rgbdisk; + RGBColor rgb; + + if (!hashunpackbinary (hstrings, (Handle *) &rgbdisk, ixstrings)) + goto L1; + + diskrgbtorgb (*rgbdisk, &rgb); + + disposehandle ((Handle) rgbdisk); + + if (!newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &val)) + goto L1; + + exemptfromtmpstack (&val); + + break; + } + #if noextended case doublevaluetype: { @@ -3159,7 +3180,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: #ifndef oplanglists case listvaluetype: case recordvaluetype: Modified: Frontier/branches/Conversant/Common/source/langpack.c =================================================================== --- Frontier/branches/Conversant/Common/source/langpack.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langpack.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -105,6 +105,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b10 dmb: don't disable langerror when getting an address path. + + 2006-04-20 sethdill & aradke: convert rgb values from native byte order to big-endian */ register boolean fl; @@ -213,6 +215,16 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb rgbdiskk; + + rgbtodiskrgb (*val.data.rgbvalue, &rgbdiskk); + + fl = langpackdata (sizeof (rgbdiskk), &rgbdiskk, hpackedvalue); + + break; + } + #if noextended case doublevaluetype: { @@ -239,7 +251,6 @@ case passwordvaluetype: case patternvaluetype: case objspecvaluetype: - case rgbvaluetype: #ifndef version5orgreater case filespecvaluetype: case aliasvaluetype: @@ -494,6 +505,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b3 dmb: unpacking addresses, if stringtoaddress fails, set valuetype to string + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ tyvaluerecord v; @@ -622,6 +635,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + RGBColor rgb; + diskrgb rgbdisk; + + fl = langunpackdata (sizeof (rgbdisk), &rgbdisk, h, &ixunpack); + + if (fl) { + + diskrgbtorgb (&rgbdisk, &rgb); + + fl = newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &v); + + if (fl) + exemptfromtmpstack (&v); + } + + break; + } + #if noextended case doublevaluetype: { @@ -655,7 +687,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: case binaryvaluetype: #ifndef version5orgreater case objspecvaluetype: Modified: Frontier/branches/Conversant/Common/source/langstartup.c =================================================================== --- Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -424,6 +424,98 @@ } /*initenvironment*/ +static boolean initCharsetsTable (hdlhashtable cSetsTable) +{ +#if MACVERSION + OSStatus err; + ItemCount ct, actual_ct, i; + + err = TECCountAvailableTextEncodings( &ct ); + if ( err != noErr ) { + pophashtable(); + + return (true); // don't kill the whole startup + } + + TextEncoding enc; + TextEncoding availEncodings[ ct ]; + bigstring ianaName; + + err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); + if ( err != noErr ) + return (true); // we don't want to kill the whole startup here + + for ( i = 0; i < actual_ct; i++ ) { + enc = availEncodings[ i ]; + + /* + get the internet "iana" name for the encoding + */ + err = TECGetTextEncodingInternetName( enc, ianaName ); + if ( err != noErr ) + continue; + + /* + now convert the "iana" name back into the canonical encoding value + (more than one encoding will point to the same iana name, + this makes sure that we use the right one) + */ + err = TECGetTextEncodingFromInternetName( &enc, ianaName ); + if ( err != noErr ) + continue; + + langassignlongvalue( cSetsTable, ianaName, (long) enc ); + } +#endif + +#if WIN95VERSION + langassignlongvalue( cSetsTable, "\x05" "ASCII", 20127 ); + langassignlongvalue( cSetsTable, "\x08" "US-ASCII", 20127 ); /* alias for ASCII */ + + langassignlongvalue( cSetsTable, "\x09" "MACINTOSH", 10000 ); + langassignlongvalue( cSetsTable, "\x08" "MacRoman", 10000 ); /* alias for MACINTOSH */ + + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-1", 28591 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-2", 28592 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-3", 28593 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-4", 28594 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-5", 28595 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-6", 28596 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-7", 28597 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-8", 28598 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-9", 28599 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-8859-10", 28592 ); + + langassignlongvalue( cSetsTable, "\x0c" "windows-1250", 1250 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ + + langassignlongvalue( cSetsTable, "\x0c" "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ + + langassignlongvalue( cSetsTable, "\x0c" "windows-1252", 1252 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-1", 1252 ); + + langassignlongvalue( cSetsTable, "\x0c" "windows-1253", 1253 ); /* code page 1253 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1254", 1254 ); /* code page 1254, Turkish */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1255", 1255 ); /* code page 1255 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1256", 1256 ); /* code page 1256 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1257", 1257 ); /* code page 1257 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1258", 1258 ); /* code page 1258 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1361", 1361 ); /* code page 1361, for Windows NT */ + + langassignlongvalue( cSetsTable, "\x05" "UTF-7", 65000 ); + langassignlongvalue( cSetsTable, "\x05" "UTF-8", 65001 ); + + langassignlongvalue( cSetsTable, "\x06" "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ + + langassignlongvalue( cSetsTable, "\x08" "UTF-16le", 1200 ); + langassignlongvalue( cSetsTable, "\x08" "UTF-16be", 1201 ); +#endif + + return (true); + } /* initCharsetsTable */ + + boolean inittablestructure (void) { /* @@ -476,6 +568,13 @@ if (!initenvironment (environmenttable)) goto error; + // and now the charsets table + + if (!tablenewsystemtable (htable, namecharsetstable, &charsetstable)) + goto error; + + initCharsetsTable (charsetstable); /* don't die if the charsets can't be initialized */ + pophashtable (); return (true); @@ -588,123 +687,6 @@ #define addstring(x,y) if (!langaddstringconst ((ptrstring) x, y)) return (false) -static boolean langinit_charset_consttable (void) { - - /* - First pass at a way to populate a table with many of - the known charsets. Key is the MIME charset name (the - IANA-registered name), value is the platform-dependent - value that identifies that character set. (Constants on - Mac, code page id numbers on Windows.) - - There may be a one-hit memory leak here, because nothing is done - to release the table... but maybe it can't be released, because - it needs to stick around? - - A better approach on both platforms would be some routine that - asks the OS for a list of the character sets it supports. - I couldn't find anything like that on the Mac, and on Windows - it requires COM which I couldn't get to work! - */ - - hdlhashtable hcharsetconsttable; - - if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "charsets", &hcharsetconsttable)) - return (false); - - pushhashtable (hcharsetconsttable); - -#if MACVERSION - addlong( "ASCII", kCFStringEncodingASCII ); - addlong( "MacRoman", kCFStringEncodingMacRoman ); - addlong( "MACINTOSH", kCFStringEncodingMacRoman ); - - addlong( "iso-8859-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-latin-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-8859-2", kCFStringEncodingISOLatin2 ); - addlong( "iso-8859-3", kCFStringEncodingISOLatin3 ); - addlong( "iso-8859-4", kCFStringEncodingISOLatin4 ); - addlong( "iso-8859-5", kCFStringEncodingISOLatin5 ); - addlong( "iso-8859-6", kCFStringEncodingISOLatin6 ); - addlong( "iso-8859-7", kCFStringEncodingISOLatin7 ); - addlong( "iso-8859-8", kCFStringEncodingISOLatin8 ); - addlong( "iso-8859-9", kCFStringEncodingISOLatin9 ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "iso-8859-10", kCFStringEncodingISOLatin10 ); - #endif - - addlong( "windows-1250", kCFStringEncodingWindowsLatin2 ); - addlong( "windows-latin-2", kCFStringEncodingWindowsLatin2 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", kCFStringEncodingWindowsCyrillic ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", kCFStringEncodingWindowsLatin1 ); - addlong( "windows-latin-1", kCFStringEncodingWindowsLatin1 ); /* ANSI 1252 */ - - addlong( "windows-1253", kCFStringEncodingWindowsLatin5 ); /* code page 1253 */ - addlong( "windows-1254", kCFStringEncodingWindowsLatin5 ); /* code page 1254, Turkish */ - addlong( "windows-1255", kCFStringEncodingWindowsHebrew ); /* code page 1255 */ - addlong( "windows-1256", kCFStringEncodingWindowsArabic ); /* code page 1256 */ - addlong( "windows-1257", kCFStringEncodingWindowsBalticRim ); /* code page 1257 */ - addlong( "windows-1258", kCFStringEncodingWindowsVietnamese ); /* code page 1258 */ - addlong( "windows-1361", kCFStringEncodingWindowsKoreanJohab ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", kCFStringEncodingNonLossyASCII ); - addlong( "UTF-8", kCFStringEncodingUTF8 ); - addlong( "UTF-16", kCFStringEncodingUnicode ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "UTF-16le", kCFStringEncodingUTF16LE ); - addlong( "UTF-16be", kCFStringEncodingUTF16BE ); - #endif -#endif - -#if WIN95VERSION - addlong( "ASCII", 20127 ); - addlong( "MacRoman", 10000 ); - addlong( "MACINTOSH", 10000 ); - - addlong( "iso-8859-1", 28591 ); - addlong( "iso-latin-1", 28591 ); - addlong( "iso-8859-2", 28592 ); - addlong( "iso-8859-3", 28593 ); - addlong( "iso-8859-4", 28594 ); - addlong( "iso-8859-5", 28595 ); - addlong( "iso-8859-6", 28596 ); - addlong( "iso-8859-7", 28597 ); - addlong( "iso-8859-8", 28598 ); - addlong( "iso-8859-9", 28599 ); - addlong( "iso-8859-10", 28592 ); - - addlong( "windows-1250", 1250 ); - addlong( "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", 1252 ); - addlong( "windows-latin-1", 1252 ); - - addlong( "windows-1253", 1253 ); /* code page 1253 */ - addlong( "windows-1254", 1254 ); /* code page 1254, Turkish */ - addlong( "windows-1255", 1255 ); /* code page 1255 */ - addlong( "windows-1256", 1256 ); /* code page 1256 */ - addlong( "windows-1257", 1257 ); /* code page 1257 */ - addlong( "windows-1258", 1258 ); /* code page 1258 */ - addlong( "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", 65000 ); - addlong( "UTF-8", 65001 ); - addlong( "UTF-16", 0 ); - addlong( "UTF-16le", 1200 ); - addlong( "UTF-16be", 1201 ); -#endif - - pophashtable(); - - return (true); - } /* langinit_charset_consttable */ - static boolean langinitconsttable (void) { /* @@ -803,7 +785,7 @@ static boolean langinitbuiltintable (void) { - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "builtins"), &hbuiltinfunctions)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "builtins", &hbuiltinfunctions)) return (false); pushhashtable (hbuiltinfunctions); /*converted to function ops by the parser*/ @@ -858,7 +840,7 @@ 3/6/92 dmb: added "with" token */ - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "keywords"), &hkeywordtable)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "keywords", &hkeywordtable)) return (false); pushhashtable (hkeywordtable); /*converted to tokens by the scanner*/ @@ -934,9 +916,6 @@ if (!langinitconsttable ()) return (false); - if (!langinit_charset_consttable ()) - return (false); - if (!langinitbuiltintable ()) return (false); Modified: Frontier/branches/Conversant/Common/source/opicons.c =================================================================== --- Frontier/branches/Conversant/Common/source/opicons.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/opicons.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -92,20 +92,24 @@ void opdrawheadicon (short iconnum, const Rect *r, boolean flselected) { + /* + This function draws the triangle icons inside outlines (but not root tables). + Root table triangles are in tabledisplay.c, browserdrawnodeicon() + */ - short transform = 0; + operaserect (*r); +#ifdef MACVERSION + short transform = kTransformNone; + if (flselected) - transform = 0x4000; + transform = kTransformSelected; - operaserect (*r); - -#ifdef MACVERSION - ploticonresource ((Rect *) r, atVerticalCenter + atHorizontalCenter, transform, iconnum); + ploticonresource ((Rect *) r, kAlignAbsoluteCenter, transform, iconnum); #endif #ifdef WIN95VERSION - ploticonresource (r, 0, transform, iconnum); + ploticonresource (r, 0, 0, iconnum); #endif } /*opdrawheadicon*/ @@ -115,7 +119,7 @@ short transform = 0; if (flselected) - transform = 0x4000; + transform = kTransformSelected; operaserect (*r); @@ -189,16 +193,16 @@ boolean opdefaultgeticonrect (hdlheadrecord hnode, const Rect *linerect, Rect *iconrect) { hdloutlinerecord ho = outlinedata; - Rect r = *linerect; - Rect rcontains; + Rect r; + Rect rcontains = *linerect; - r.bottom = r.top + (**ho).iconheight; + rcontains.bottom = rcontains.top + (**ho).iconheight; - r.left += opnodeindent (hnode); + rcontains.left += opnodeindent (hnode); - r.right = r.left + (**ho).iconwidth; + rcontains.right = rcontains.left + (**ho).iconwidth; - rcontains = r; + r = rcontains; if (opisfatheadlines (ho)) rcontains.bottom = rcontains.top + textvertinset + (**ho).defaultlineheight + textvertinset; @@ -208,7 +212,7 @@ centerrect (&r, rcontains); /*center it vertically within the linerect*/ *iconrect = r; - + return (true); } /*opdefaultgeticonrect*/ Modified: Frontier/branches/Conversant/Common/source/strings.c =================================================================== --- Frontier/branches/Conversant/Common/source/strings.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/strings.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -35,6 +35,7 @@ #include "ops.h" #include "resources.h" #include "shell.rsrc.h" +#include "tablestructure.h" #include "timedate.h" #include "langinternal.h" /* 2006-02-26 creedon */ #include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */ @@ -2338,6 +2339,34 @@ #endif /*end Windows character conversion routines*/ +/* convert an "internet name" for an encoding into a platform-specific id for the character set */ + +boolean gettextencodingid (const Handle h, long * encodingId) { + +#ifdef MACVERSION + + OSStatus err; + TextEncoding oneEncoding; + bigstring ianaName; + long ct, ix = 0; + + ct = gethandlesize (h); + ianaName [0] = (byte) ct; + loadfromhandle (h, &ix, ct, ianaName + 1); + + err = TECGetTextEncodingFromInternetName( &oneEncoding, ianaName ); + + if ( err != noErr ) + return (false); + + *encodingId = (long) oneEncoding; + +#endif + + return (true); +} + + boolean converttextencoding (Handle h, Handle hresult, long inputcharset, long outputcharset) { #ifdef MACVERSION /*Mac character conversion common routine*/ @@ -2353,18 +2382,25 @@ // (*h) [lentext] = '\0'; - TECCreateConverter (&converter, inputcharset, outputcharset); + status = TECCreateConverter (&converter, inputcharset, outputcharset); + if ( status != noErr ) { + TECDisposeConverter (converter); + return (false); + } - sizeoutputbuffer = lentext * 2; + sizeoutputbuffer = lentext * 4; if (sizeoutputbuffer < 32) /*docs say use 32 minimum*/ sizeoutputbuffer = 32; - sethandlesize (hresult, sizeoutputbuffer); + if (!sethandlesize (hresult, sizeoutputbuffer)) { // out of memory + TECDisposeConverter (converter); + return (false); + } // 2005-08-26 --- kw better bytemark detecting // see http://en.wikipedia.org/wiki/Byte_Order_Mark - if (inputcharset == 0x08000100) // we handle utf-8 input + if (inputcharset == kCFStringEncodingUTF8) // we handle utf-8 input { if ( (*h) [0] == '\xEF' && (*h) [1] == '\xBB' @@ -2387,15 +2423,19 @@ // if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /*pop byte order mark*/ // pullfromhandle (h, 0, 3, NULL); + /* if (pullBytes > 0) pullfromhandle (h, 0, pullBytes, NULL); + */ + + lentext = gethandlesize (h) - pullBytes; - lentext = gethandlesize (h); - - status = TECConvertText (converter, (ConstTextPtr)(*h), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); + status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); - if (status != noErr) + if (status != noErr) { + TECDisposeConverter (converter); return (false); + } TECFlushText (converter, (TextPtr)(*hresult), sizeoutputbuffer, &ctflushedbytes); Modified: Frontier/branches/Conversant/Common/source/stringverbs.c =================================================================== --- Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -2282,8 +2282,6 @@ if (!macromantoutf8 (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2301,8 +2299,6 @@ if (!utf8tomacroman (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2327,11 +2323,11 @@ if (! converttextencoding (h, hresult, charsetIn, charsetOut)) goto error; - disposehandle(h); + // disposehandle(h); return (setheapvalue (hresult, stringvaluetype, v)); } - + default: errornum = notimplementederror; Modified: Frontier/branches/Conversant/Common/source/tabledisplay.c =================================================================== --- Frontier/branches/Conversant/Common/source/tabledisplay.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/tabledisplay.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -1083,22 +1083,27 @@ void browserdrawnodeicon (const Rect *r, boolean flhighlighted, hdlheadrecord hnode) { + /* + This function draws the triangle icons inside tables (but not outlines). + Outline triangles are in opicons.c, opdrawheadicon() + */ + tybrowserinfo browserinfo; + browsergetrefcon (hnode, &browserinfo); + +#ifdef MACVERSION + short transform = kTransformNone; - tybrowserinfo browserinfo; - short transform = 0; - long align = 0; - if (flhighlighted) - transform = 0x4000; + transform = kTransformSelected; -#ifdef MACVERSION - align = atVerticalCenter + atHorizontalCenter; + ploticonresource (r, kAlignAbsoluteCenter, transform, opgetheadicon (hnode)); #endif + +#ifdef WIN95VERSION + ploticonresource (r, 0, 0, opgetheadicon (hnode)); +#endif - browsergetrefcon (hnode, &browserinfo); - ploticonresource (r, align, transform, opgetheadicon (hnode)); - #if 0 transform += ttLabel [browserinfo.ixlabel]; /*color it according to the file's label*/ Modified: Frontier/branches/Conversant/Common/source/tablestructure.c =================================================================== --- Frontier/branches/Conversant/Common/source/tablestructure.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/tablestructure.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -100,8 +100,10 @@ byte nameenvironmenttable [] = STR_environment; +byte namecharsetstable [] = STR_charsets; + Handle rootvariable = nil; hdlhashtable roottable = nil; @@ -146,8 +148,10 @@ hdlhashtable environmenttable = nil; +hdlhashtable charsetstable = nil; + boolean getsystemtablescript (short idscript, bigstring bsscript) { return (getstringlist (idsystemtablescripts, idscript, bsscript)); @@ -259,6 +263,10 @@ if (!linksystemtable (hsystem, nameenvironmenttable, environmenttable)) return (false); + // link in the charsets table, not part of saved structure + if (!linksystemtable (hsystem, namecharsetstable, charsetstable)) + return (false); + // create the temp table, not part of saved structure if (checktable (hsystem, nametemptable, true, &htemp)) langexternaldontsave (hsystem, nametemptable); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 20:44:31
|
Revision: 1323 Author: sethdill Date: 2006-04-22 13:44:25 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1323&view=rev Log Message: ----------- Minor tweak. Removed some extra parens. Modified Paths: -------------- Frontier/trunk/Common/source/langstartup.c Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-22 19:00:18 UTC (rev 1322) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-22 20:44:25 UTC (rev 1323) @@ -699,7 +699,7 @@ tyvaluetype type; bigstring bs; - if (!tablenewsystemtable (langtable, (ptrstring) ("\x09" "constants"), &hconsttable)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x09" "constants", &hconsttable)) return (false); pushhashtable (hconsttable); /*converted to constants by the scanner*/ @@ -757,7 +757,7 @@ lastword (bs, chspace, bs); - pushstring ((ptrstring) ("\x04Type"), bs); + pushstring ((ptrstring) "\x04Type", bs); addtype (bs, type); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 19:00:25
|
Revision: 1322 Author: sethdill Date: 2006-04-22 12:00:18 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1322&view=rev Log Message: ----------- Fixed some compilation issues on Windows. Removed the unused v local from initCharsetsTable. Modified Paths: -------------- Frontier/trunk/Common/source/langstartup.c Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-22 18:04:43 UTC (rev 1321) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-22 19:00:18 UTC (rev 1322) @@ -426,14 +426,10 @@ static boolean initCharsetsTable (hdlhashtable cSetsTable) { - tyvaluerecord v; - #if MACVERSION OSStatus err; ItemCount ct, actual_ct, i; - v.valuetype = longvaluetype; - err = TECCountAvailableTextEncodings( &ct ); if ( err != noErr ) { pophashtable(); @@ -451,7 +447,6 @@ for ( i = 0; i < actual_ct; i++ ) { enc = availEncodings[ i ]; - // enc = i; /* get the internet "iana" name for the encoding @@ -461,7 +456,7 @@ continue; /* - now conver the "iana" name back into the canonical encoding value + now convert the "iana" name back into the canonical encoding value (more than one encoding will point to the same iana name, this makes sure that we use the right one) */ @@ -474,47 +469,47 @@ #endif #if WIN95VERSION - langassignlongvalue( cSetsTable, "ASCII", 20127 ); - langassignlongvalue( cSetsTable, "US-ASCII" 20127 ); /* alias for ASCII */ + langassignlongvalue( cSetsTable, "\x05" "ASCII", 20127 ); + langassignlongvalue( cSetsTable, "\x08" "US-ASCII", 20127 ); /* alias for ASCII */ - langassignlongvalue( cSetsTable, "MACINTOSH", 10000 ); - langassignlongvalue( cSetsTable, "MacRoman", 10000 ); /* alias for MACINTOSH */ + langassignlongvalue( cSetsTable, "\x09" "MACINTOSH", 10000 ); + langassignlongvalue( cSetsTable, "\x08" "MacRoman", 10000 ); /* alias for MACINTOSH */ - langassignlongvalue( cSetsTable, "iso-8859-1", 28591 ); - langassignlongvalue( cSetsTable, "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ - langassignlongvalue( cSetsTable, "iso-8859-2", 28592 ); - langassignlongvalue( cSetsTable, "iso-8859-3", 28593 ); - langassignlongvalue( cSetsTable, "iso-8859-4", 28594 ); - langassignlongvalue( cSetsTable, "iso-8859-5", 28595 ); - langassignlongvalue( cSetsTable, "iso-8859-6", 28596 ); - langassignlongvalue( cSetsTable, "iso-8859-7", 28597 ); - langassignlongvalue( cSetsTable, "iso-8859-8", 28598 ); - langassignlongvalue( cSetsTable, "iso-8859-9", 28599 ); - langassignlongvalue( cSetsTable, "iso-8859-10", 28592 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-1", 28591 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-2", 28592 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-3", 28593 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-4", 28594 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-5", 28595 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-6", 28596 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-7", 28597 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-8", 28598 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-9", 28599 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-8859-10", 28592 ); - langassignlongvalue( cSetsTable, "windows-1250", 1250 ); - langassignlongvalue( cSetsTable, "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1250", 1250 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - langassignlongvalue( cSetsTable, "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - langassignlongvalue( cSetsTable, "windows-1252", 1252 ); - langassignlongvalue( cSetsTable, "windows-latin-1", 1252 ); + langassignlongvalue( cSetsTable, "\x0c" "windows-1252", 1252 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-1", 1252 ); - langassignlongvalue( cSetsTable, "windows-1253", 1253 ); /* code page 1253 */ - langassignlongvalue( cSetsTable, "windows-1254", 1254 ); /* code page 1254, Turkish */ - langassignlongvalue( cSetsTable, "windows-1255", 1255 ); /* code page 1255 */ - langassignlongvalue( cSetsTable, "windows-1256", 1256 ); /* code page 1256 */ - langassignlongvalue( cSetsTable, "windows-1257", 1257 ); /* code page 1257 */ - langassignlongvalue( cSetsTable, "windows-1258", 1258 ); /* code page 1258 */ - langassignlongvalue( cSetsTable, "windows-1361", 1361 ); /* code page 1361, for Windows NT */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1253", 1253 ); /* code page 1253 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1254", 1254 ); /* code page 1254, Turkish */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1255", 1255 ); /* code page 1255 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1256", 1256 ); /* code page 1256 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1257", 1257 ); /* code page 1257 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1258", 1258 ); /* code page 1258 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - langassignlongvalue( cSetsTable, "UTF-7", 65000 ); - langassignlongvalue( cSetsTable, "UTF-8", 65001 ); + langassignlongvalue( cSetsTable, "\x05" "UTF-7", 65000 ); + langassignlongvalue( cSetsTable, "\x05" "UTF-8", 65001 ); - langassignlongvalue( cSetsTable, "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ + langassignlongvalue( cSetsTable, "\x06" "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ - langassignlongvalue( cSetsTable, "UTF-16le", 1200 ); - langassignlongvalue( cSetsTable, "UTF-16be", 1201 ); + langassignlongvalue( cSetsTable, "\x08" "UTF-16le", 1200 ); + langassignlongvalue( cSetsTable, "\x08" "UTF-16be", 1201 ); #endif return (true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-22 18:05:00
|
Revision: 1321 Author: sethdill Date: 2006-04-22 11:04:43 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1321&view=rev Log Message: ----------- Moved initCharsetsTable from strings.c to langstartup.c Added gettextencodingid function (still in flux) to strings.c Converttextencoding no longer modifies parameter h, so the verbs which call it are all able to use getreadonlytextvalue() (performance reasons). (Instead of popping the byte order mark, we just skip it in the call to TECConvertText) Converttextencoding now checks for more errors, and disposes of the converter object (mac only) when an error occurs. Removed calls to diposehandle in string verbs which are now using getreadonlytextvalue(). Bad bug. Removed call to initcharsetstable() from initstrings(), added it to inittablestructure in langstartup.c Modified Paths: -------------- Frontier/trunk/Common/headers/strings.h Frontier/trunk/Common/source/langstartup.c Frontier/trunk/Common/source/strings.c Frontier/trunk/Common/source/stringverbs.c Modified: Frontier/trunk/Common/headers/strings.h =================================================================== --- Frontier/trunk/Common/headers/strings.h 2006-04-22 13:05:46 UTC (rev 1320) +++ Frontier/trunk/Common/headers/strings.h 2006-04-22 18:04:43 UTC (rev 1321) @@ -266,9 +266,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ +extern boolean gettextencodingid (const Handle, long *); /* 2006-04-20 smd */ + extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ -extern boolean initcharsetstable (void); /* 2006-04-20 smd */ - #endif Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-22 13:05:46 UTC (rev 1320) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-22 18:04:43 UTC (rev 1321) @@ -424,6 +424,103 @@ } /*initenvironment*/ +static boolean initCharsetsTable (hdlhashtable cSetsTable) +{ + tyvaluerecord v; + +#if MACVERSION + OSStatus err; + ItemCount ct, actual_ct, i; + + v.valuetype = longvaluetype; + + err = TECCountAvailableTextEncodings( &ct ); + if ( err != noErr ) { + pophashtable(); + + return (true); // don't kill the whole startup + } + + TextEncoding enc; + TextEncoding availEncodings[ ct ]; + bigstring ianaName; + + err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); + if ( err != noErr ) + return (true); // we don't want to kill the whole startup here + + for ( i = 0; i < actual_ct; i++ ) { + enc = availEncodings[ i ]; + // enc = i; + + /* + get the internet "iana" name for the encoding + */ + err = TECGetTextEncodingInternetName( enc, ianaName ); + if ( err != noErr ) + continue; + + /* + now conver the "iana" name back into the canonical encoding value + (more than one encoding will point to the same iana name, + this makes sure that we use the right one) + */ + err = TECGetTextEncodingFromInternetName( &enc, ianaName ); + if ( err != noErr ) + continue; + + langassignlongvalue( cSetsTable, ianaName, (long) enc ); + } +#endif + +#if WIN95VERSION + langassignlongvalue( cSetsTable, "ASCII", 20127 ); + langassignlongvalue( cSetsTable, "US-ASCII" 20127 ); /* alias for ASCII */ + + langassignlongvalue( cSetsTable, "MACINTOSH", 10000 ); + langassignlongvalue( cSetsTable, "MacRoman", 10000 ); /* alias for MACINTOSH */ + + langassignlongvalue( cSetsTable, "iso-8859-1", 28591 ); + langassignlongvalue( cSetsTable, "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ + langassignlongvalue( cSetsTable, "iso-8859-2", 28592 ); + langassignlongvalue( cSetsTable, "iso-8859-3", 28593 ); + langassignlongvalue( cSetsTable, "iso-8859-4", 28594 ); + langassignlongvalue( cSetsTable, "iso-8859-5", 28595 ); + langassignlongvalue( cSetsTable, "iso-8859-6", 28596 ); + langassignlongvalue( cSetsTable, "iso-8859-7", 28597 ); + langassignlongvalue( cSetsTable, "iso-8859-8", 28598 ); + langassignlongvalue( cSetsTable, "iso-8859-9", 28599 ); + langassignlongvalue( cSetsTable, "iso-8859-10", 28592 ); + + langassignlongvalue( cSetsTable, "windows-1250", 1250 ); + langassignlongvalue( cSetsTable, "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ + + langassignlongvalue( cSetsTable, "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ + + langassignlongvalue( cSetsTable, "windows-1252", 1252 ); + langassignlongvalue( cSetsTable, "windows-latin-1", 1252 ); + + langassignlongvalue( cSetsTable, "windows-1253", 1253 ); /* code page 1253 */ + langassignlongvalue( cSetsTable, "windows-1254", 1254 ); /* code page 1254, Turkish */ + langassignlongvalue( cSetsTable, "windows-1255", 1255 ); /* code page 1255 */ + langassignlongvalue( cSetsTable, "windows-1256", 1256 ); /* code page 1256 */ + langassignlongvalue( cSetsTable, "windows-1257", 1257 ); /* code page 1257 */ + langassignlongvalue( cSetsTable, "windows-1258", 1258 ); /* code page 1258 */ + langassignlongvalue( cSetsTable, "windows-1361", 1361 ); /* code page 1361, for Windows NT */ + + langassignlongvalue( cSetsTable, "UTF-7", 65000 ); + langassignlongvalue( cSetsTable, "UTF-8", 65001 ); + + langassignlongvalue( cSetsTable, "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ + + langassignlongvalue( cSetsTable, "UTF-16le", 1200 ); + langassignlongvalue( cSetsTable, "UTF-16be", 1201 ); +#endif + + return (true); + } /* initCharsetsTable */ + + boolean inittablestructure (void) { /* @@ -481,6 +578,8 @@ if (!tablenewsystemtable (htable, namecharsetstable, &charsetstable)) goto error; + initCharsetsTable (charsetstable); /* don't die if the charsets can't be initialized */ + pophashtable (); return (true); Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-22 13:05:46 UTC (rev 1320) +++ Frontier/trunk/Common/source/strings.c 2006-04-22 18:04:43 UTC (rev 1321) @@ -2339,6 +2339,34 @@ #endif /*end Windows character conversion routines*/ +/* convert an "internet name" for an encoding into a platform-specific id for the character set */ + +boolean gettextencodingid (const Handle h, long * encodingId) { + +#ifdef MACVERSION + + OSStatus err; + TextEncoding oneEncoding; + bigstring ianaName; + long ct, ix = 0; + + ct = gethandlesize (h); + ianaName [0] = (byte) ct; + loadfromhandle (h, &ix, ct, ianaName + 1); + + err = TECGetTextEncodingFromInternetName( &oneEncoding, ianaName ); + + if ( err != noErr ) + return (false); + + *encodingId = (long) oneEncoding; + +#endif + + return (true); +} + + boolean converttextencoding (Handle h, Handle hresult, long inputcharset, long outputcharset) { #ifdef MACVERSION /*Mac character conversion common routine*/ @@ -2354,7 +2382,11 @@ // (*h) [lentext] = '\0'; - TECCreateConverter (&converter, inputcharset, outputcharset); + status = TECCreateConverter (&converter, inputcharset, outputcharset); + if ( status != noErr ) { + TECDisposeConverter (converter); + return (false); + } sizeoutputbuffer = lentext * 4; @@ -2391,12 +2423,14 @@ // if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /*pop byte order mark*/ // pullfromhandle (h, 0, 3, NULL); + /* if (pullBytes > 0) pullfromhandle (h, 0, pullBytes, NULL); + */ + + lentext = gethandlesize (h) - pullBytes; - lentext = gethandlesize (h); - - status = TECConvertText (converter, (ConstTextPtr)(*h), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); + status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); if (status != noErr) { TECDisposeConverter (converter); @@ -2482,100 +2516,7 @@ #endif } /*converttextencoding*/ -boolean initcharsetstable (void) { -#if MACVERSION - OSStatus err; - ItemCount ct, actual_ct, i; - tyvaluerecord v; - - v.valuetype = longvaluetype; - - err = TECCountAvailableTextEncodings( &ct ); - if ( err != noErr ) { - pophashtable(); - - return (true); // don't kill the whole startup - } - - TextEncoding enc; - TextEncoding availEncodings[ ct ]; - bigstring ianaName; - - err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); - if ( err != noErr ) { - pophashtable(); - - return (true); // we don't want to kill the whole startup here - } - - for ( i = 0; i < actual_ct; i++ ) { - enc = availEncodings[ i ]; - // enc = i; - - err = TECGetTextEncodingInternetName( enc, ianaName ); - if ( err != noErr ) - continue; - - nullterminate( ianaName ); - - v.data.longvalue = (signed long) enc; - - hashtableassign( charsetstable, ianaName, v ); - } -#endif - -#if WIN95VERSION - pushhashtable (charsetstable); /* global, table is created in langstartup.c : inittablestructure() */ - - addlong( "ASCII", 20127 ); - addlong( "US-ASCII" 20127 ); /* alias for ASCII */ - - addlong( "MACINTOSH", 10000 ); - addlong( "MacRoman", 10000 ); /* alias for MACINTOSH */ - - addlong( "iso-8859-1", 28591 ); - addlong( "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ - addlong( "iso-8859-2", 28592 ); - addlong( "iso-8859-3", 28593 ); - addlong( "iso-8859-4", 28594 ); - addlong( "iso-8859-5", 28595 ); - addlong( "iso-8859-6", 28596 ); - addlong( "iso-8859-7", 28597 ); - addlong( "iso-8859-8", 28598 ); - addlong( "iso-8859-9", 28599 ); - addlong( "iso-8859-10", 28592 ); - - addlong( "windows-1250", 1250 ); - addlong( "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", 1252 ); - addlong( "windows-latin-1", 1252 ); - - addlong( "windows-1253", 1253 ); /* code page 1253 */ - addlong( "windows-1254", 1254 ); /* code page 1254, Turkish */ - addlong( "windows-1255", 1255 ); /* code page 1255 */ - addlong( "windows-1256", 1256 ); /* code page 1256 */ - addlong( "windows-1257", 1257 ); /* code page 1257 */ - addlong( "windows-1258", 1258 ); /* code page 1258 */ - addlong( "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", 65000 ); - addlong( "UTF-8", 65001 ); - addlong( "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ - addlong( "UTF-16le", 1200 ); - addlong( "UTF-16be", 1201 ); - - pophashtable(); -#endif - - return (true); - } /* initcharsetstable */ - - - boolean utf16toansi (Handle h, Handle hresult) { /* Modified: Frontier/trunk/Common/source/stringverbs.c =================================================================== --- Frontier/trunk/Common/source/stringverbs.c 2006-04-22 13:05:46 UTC (rev 1320) +++ Frontier/trunk/Common/source/stringverbs.c 2006-04-22 18:04:43 UTC (rev 1321) @@ -2282,8 +2282,6 @@ if (!macromantoutf8 (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2301,8 +2299,6 @@ if (!utf8tomacroman (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2327,11 +2323,11 @@ if (! converttextencoding (h, hresult, charsetIn, charsetOut)) goto error; - disposehandle(h); + // disposehandle(h); return (setheapvalue (hresult, stringvaluetype, v)); } - + default: errornum = notimplementederror; @@ -2358,12 +2354,8 @@ initialize the builtins directly. 2.1b5 dmb: verb initialization is now resource-based - - 2006-04-20 smd: added call to initialize the character sets */ - initcharsetstable(); - return (loadfunctionprocessor (idstringverbs, &stringfunctionvalue)); } /*stringinitverbs*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <and...@us...> - 2006-04-22 13:06:12
|
Revision: 1320 Author: andreradke Date: 2006-04-22 06:05:46 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1320&view=rev Log Message: ----------- Updated build instructions for Visual Studio .NET 2003 and 2005 in README.txt. Modified Paths: -------------- Frontier/trunk/README.txt Modified: Frontier/trunk/README.txt =================================================================== --- Frontier/trunk/README.txt 2006-04-22 12:58:25 UTC (rev 1319) +++ Frontier/trunk/README.txt 2006-04-22 13:05:46 UTC (rev 1320) @@ -38,7 +38,55 @@ Universal Binary of Frontier which will run on both PPC and Intel Macs. -B. Metrowerks CodeWarrior Pro for Mac or Windows +B. Microsoft Visual Studio .NET 2005 +==================================== + +Build directory: build_VC2k5 + +Getting Started: +---------------- + +1. Open the Frontier.sln solution file in Visual Studio. + +2. Select the Configuration Manager from the Build menu and switch +the Active Solution Configuration to Debug. Click the Close button. + +3. Select Build Solution from the Build menu. + + +C. Microsoft Visual Studio .NET 2003 +==================================== + +Build directory: build_VC2k3 + +Getting Started: +---------------- + +1. Open the Frontier.sln solution file in Visual Studio. + +2. Select the Configuration Manager from the Build menu and switch +the Active Solution Configuration to Debug. Click the Close button. + +3. Select Build Solution from the Build menu. + + +D. Microsoft Visual Studio C++ 6.0 for Windows +============================================== + +Build directory : build_VC6 + +Getting Started +--------------- + +1. Open the Frontier.dsp project in MS Visual Studio. + +2. Choose a build configuration from the Project menu. It is a good idea +to start with the Debug build configuration. + +3. Build. + + +E. Metrowerks CodeWarrior Pro for Mac or Windows ================================================ Build directory : build_CWPro8 @@ -84,28 +132,7 @@ prototypes, and some unused variables. You can ignore these warnings. -C. Microsoft Visual Studio C++ 6.0 for Windows -============================================== - -Build directory : build_VC6 - -Getting Started ---------------- - -1. Open the Frontier.dsp project in MS Visual Studio. - -2. Choose a build configuration from the Project menu. It is a good idea -to start with the Debug build configuration. - -3. Build. - -Notes ------ - -Needs more accurate build instructions. - - -D. GNU Tools (initially for Mac OS X only) +F. GNU Tools (initially for Mac OS X only) ========================================== Build directory : build_GNU This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <and...@us...> - 2006-04-22 12:58:34
|
Revision: 1319 Author: andreradke Date: 2006-04-22 05:58:25 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1319&view=rev Log Message: ----------- Define kAlignAbsoluteCenter on Windows. Fixes compilation error introduced in rev 1315. ViewCVS Links: ------------- http://svn.sourceforge.net/frontierkernel/?rev=1315&view=rev Modified Paths: -------------- Frontier/trunk/Common/headers/icon.h Modified: Frontier/trunk/Common/headers/icon.h =================================================================== --- Frontier/trunk/Common/headers/icon.h 2006-04-22 12:20:43 UTC (rev 1318) +++ Frontier/trunk/Common/headers/icon.h 2006-04-22 12:58:25 UTC (rev 1319) @@ -32,6 +32,7 @@ #define atVerticalCenter 0x01 #define atHorizontalCenter 0x02 #define kTransformSelected 0x04 + #define kAlignAbsoluteCenter (atVerticalCenter | atHorizontalCenter) #endif #ifdef MACVERSION /*7.0b9 PBS: tycustomicontypeinfo is for Mac custom icons*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <and...@us...> - 2006-04-22 12:21:08
|
Revision: 1318 Author: andreradke Date: 2006-04-22 05:20:43 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1318&view=rev Log Message: ----------- Updated build instructions for Xcode in README.TXT Modified Paths: -------------- Frontier/trunk/README.txt Modified: Frontier/trunk/README.txt =================================================================== --- Frontier/trunk/README.txt 2006-04-21 02:06:59 UTC (rev 1317) +++ Frontier/trunk/README.txt 2006-04-22 12:20:43 UTC (rev 1318) @@ -1,18 +1,47 @@ -*** UserLand Frontier(tm) -- Version 10.0 Open Source Release +*** UserLand Frontier(tm) -- Version 10.1 Open Source Release *** -Last updated 02 Jan 2005 by Terry Teague +Last updated 22 Apr 2006 by Andre Radke Since the original v10.0a1 Open Source release of Frontier, additional work has been done to allow the building of Frontier using other development environments. The following sections describe these environments. -*** Supported Development Environments +A. Apple Xcode Tools for Mac OS X +================================= + +Build directory : build_XCode -A. Metrowerks CodeWarrior Pro for Mac or Windows +Getting Started with Xcode v1.2 or v1.5 or v2.0 +----------------------------------------------- + +1. Open the Frontier.xcode project in Xcode. + +2. Click the Build button. + +Getting Started with Xcode v2.1 and higher +------------------------------------------ + +1. Open the FrontierFat.xcodeproj project in Xcode. + +2. Click the Build button. + +Notes +----- + +Both the Frontier.xcode and the FrontierFat.xcodeproj projects offer a +development and a deployment build style. + +In the FrontierFat.xcodeproj +project, the development build style will compile for the native +architecture only, but the deployment build style will compile a +Universal Binary of Frontier which will run on both PPC and Intel Macs. + + +B. Metrowerks CodeWarrior Pro for Mac or Windows ================================================ -CVS module, build directory : build_CWPro8 +Build directory : build_CWPro8 Building the Frontier kernel currently requires Metrowerks CodeWarrior Pro 8 for Mac or Windows with the 8.3 updates. Other versions might @@ -40,76 +69,46 @@ Notes ----- -When you open the Frontier.mcp project file on Windows or on classic Mac -OS, CodeWarrior will complain that the access path +When you open the Frontier.mcp project file on Windows, CodeWarrior will +complain that the access path {System}Library/CFM Support/StubLibraries cannot be found. This means that you will not be able to build the Mac -OS X version on those platforms, but it does not affect the versions for -Windows and classic Mac OS. +OS X version on that platforms, but it does not affect the versions for +Windows. -When you build the Frontier PPC or Frontier PPC Debug targets, expect -CodeWarrior to report a single link warning about the errno variable -being defined in OTXTILib and MSL_ALL_PPC.Lib (or MSL_ALL_PPC_D.Lib). -You can safely ignore this warning. - When you build the Frontier Win or Frontier Win Debug target, expect CodeWarrior to report about 240 compiler warnings, mostly about redeclared identifiers in Microsoft header files, some missing function prototypes, and some unused variables. You can ignore these warnings. -B. Microsoft Visual Studio C++ for Windows -========================================== +C. Microsoft Visual Studio C++ 6.0 for Windows +============================================== -CVS module, build directory : build_VC6 +Build directory : build_VC6 -Building the Frontier kernel currently requires Microsoft Visual Studio -C++ v6. Other versions might work, too, but have not been tested. - Getting Started --------------- 1. Open the Frontier.dsp project in MS Visual Studio. -2. Build. +2. Choose a build configuration from the Project menu. It is a good idea +to start with the Debug build configuration. +3. Build. + Notes ----- Needs more accurate build instructions. -C. Apple Xcode Tools for Mac OS X -================================= - -CVS module, build directory : build_XCode - -Building the Frontier kernel currently requires Xcode v1.2 or v1.5. -Other versions might work, too, but have not been tested. - -Getting Started ---------------- - -1. Open the Frontier.xcode project in Xcode. - -2. Click the Build button. - -Notes ------ - -The support for Xcode is preliminary, and currently builds a Debug -(Development build style) version by default. - -When you build, expect Xcode to report a couple of compiler warnings. -You can ignore these warnings. - - D. GNU Tools (initially for Mac OS X only) ========================================== -CVS module, build directory : build_GNU +Build directory : build_GNU Building the Frontier kernel currently requires the Mac OS X Developer Tools to be installed on Mac OS X. Older tools using Project Builder, or @@ -143,7 +142,7 @@ Support for building the Windows version using Cygwin/MinGW or other GNU based development environments on Windows systems, and support for building the Windows -version using WINE on non-Windows systems, is being developed. +version using WINE on non-Windows systems, may be added in the future. *** Reporting Problems This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <set...@us...> - 2006-04-21 02:07:09
|
Revision: 1317 Author: sethdill Date: 2006-04-20 19:06:59 -0700 (Thu, 20 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1317&view=rev Log Message: ----------- Moved the charsets table to system.charsets. Initialization routine moved to strings.c, called from linksystemtablestructure in tablesturcture.c. Other changes involved setting up the global hdlhashtable for the charset table. Modified Paths: -------------- Frontier/trunk/Common/headers/stringdefs.h Frontier/trunk/Common/headers/strings.h Frontier/trunk/Common/headers/tablestructure.h Frontier/trunk/Common/source/langstartup.c Frontier/trunk/Common/source/strings.c Frontier/trunk/Common/source/stringverbs.c Frontier/trunk/Common/source/tablestructure.c Modified: Frontier/trunk/Common/headers/stringdefs.h =================================================================== --- Frontier/trunk/Common/headers/stringdefs.h 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/headers/stringdefs.h 2006-04-21 02:06:59 UTC (rev 1317) @@ -78,6 +78,7 @@ #define STR_this BIGSTRING ("\x04" "this") #define STR_temp "\x04" "temp" #define STR_environment "\x0b" "environment" + #define STR_charsets "\x08" "charsets" #define STR_Stack_overflow BIGSTRING ("\x0f" "Stack overflow!") Modified: Frontier/trunk/Common/headers/strings.h =================================================================== --- Frontier/trunk/Common/headers/strings.h 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/headers/strings.h 2006-04-21 02:06:59 UTC (rev 1317) @@ -266,7 +266,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean converttextencoding (Handle, Handle, long, long); +extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ +extern boolean initcharsetstable (void); /* 2006-04-20 smd */ + #endif Modified: Frontier/trunk/Common/headers/tablestructure.h =================================================================== --- Frontier/trunk/Common/headers/tablestructure.h 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/headers/tablestructure.h 2006-04-21 02:06:59 UTC (rev 1317) @@ -180,7 +180,9 @@ extern hdlhashtable environmenttable; +extern hdlhashtable charsetstable; + extern byte nameinternaltable []; extern byte namemenubar []; @@ -227,7 +229,9 @@ extern byte nameenvironmenttable []; +extern byte namecharsetstable []; + /*prototypes*/ extern boolean linksystemtablestructure (hdlhashtable); /*tablestructure.c*/ Modified: Frontier/trunk/Common/source/langstartup.c =================================================================== --- Frontier/trunk/Common/source/langstartup.c 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/source/langstartup.c 2006-04-21 02:06:59 UTC (rev 1317) @@ -476,6 +476,11 @@ if (!initenvironment (environmenttable)) goto error; + // and now the charsets table + + if (!tablenewsystemtable (htable, namecharsetstable, &charsetstable)) + goto error; + pophashtable (); return (true); @@ -588,144 +593,6 @@ #define addstring(x,y) if (!langaddstringconst ((ptrstring) x, y)) return (false) -static boolean langinit_charset_consttable (void) { - - hdlhashtable hcharsetconsttable; - - if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "charsets", &hcharsetconsttable)) - return (false); - - pushhashtable (hcharsetconsttable); - -#if MACVERSION - #if 1 - OSStatus err; - ItemCount ct, actual_ct, i; - - err = TECCountAvailableTextEncodings( &ct ); - if ( err != noErr ) { - pophashtable(); - - return (true); // don't kill the whole startup - } - - TextEncoding enc; - TextEncoding availEncodings[ ct ]; - bigstring ianaName; - - err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); - if ( err != noErr ) { - pophashtable(); - - return (true); // we don't want to kill the whole startup here - } - - for ( i = 0; i < actual_ct; i++ ) { - enc = availEncodings[ i ]; - // enc = i; - - err = TECGetTextEncodingInternetName( enc, ianaName ); - if ( err != noErr ) - continue; - - nullterminate( ianaName ); - - if ( ! hashsymbolexists( ianaName ) ) - langassignlongvalue( hcharsetconsttable, ianaName, enc ); - } - #endif - #if 0 - addlong( "ASCII", kCFStringEncodingASCII ); - addlong( "MacRoman", kCFStringEncodingMacRoman ); - addlong( "MACINTOSH", kCFStringEncodingMacRoman ); - - addlong( "iso-8859-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-latin-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-8859-2", kCFStringEncodingISOLatin2 ); - addlong( "iso-8859-3", kCFStringEncodingISOLatin3 ); - addlong( "iso-8859-4", kCFStringEncodingISOLatin4 ); - addlong( "iso-8859-5", kCFStringEncodingISOLatin5 ); - addlong( "iso-8859-6", kCFStringEncodingISOLatin6 ); - addlong( "iso-8859-7", kCFStringEncodingISOLatin7 ); - addlong( "iso-8859-8", kCFStringEncodingISOLatin8 ); - addlong( "iso-8859-9", kCFStringEncodingISOLatin9 ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "iso-8859-10", kCFStringEncodingISOLatin10 ); - #endif - - addlong( "windows-1250", kCFStringEncodingWindowsLatin2 ); - addlong( "windows-latin-2", kCFStringEncodingWindowsLatin2 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", kCFStringEncodingWindowsCyrillic ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", kCFStringEncodingWindowsLatin1 ); - addlong( "windows-latin-1", kCFStringEncodingWindowsLatin1 ); /* ANSI 1252 */ - - addlong( "windows-1253", kCFStringEncodingWindowsLatin5 ); /* code page 1253 */ - addlong( "windows-1254", kCFStringEncodingWindowsLatin5 ); /* code page 1254, Turkish */ - addlong( "windows-1255", kCFStringEncodingWindowsHebrew ); /* code page 1255 */ - addlong( "windows-1256", kCFStringEncodingWindowsArabic ); /* code page 1256 */ - addlong( "windows-1257", kCFStringEncodingWindowsBalticRim ); /* code page 1257 */ - addlong( "windows-1258", kCFStringEncodingWindowsVietnamese ); /* code page 1258 */ - addlong( "windows-1361", kCFStringEncodingWindowsKoreanJohab ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", kCFStringEncodingNonLossyASCII ); - addlong( "UTF-8", kCFStringEncodingUTF8 ); - addlong( "UTF-16", kCFStringEncodingUnicode ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "UTF-16le", kCFStringEncodingUTF16LE ); - addlong( "UTF-16be", kCFStringEncodingUTF16BE ); - #endif - #endif -#endif - -#if WIN95VERSION - addlong( "ASCII", 20127 ); - addlong( "MacRoman", 10000 ); - addlong( "MACINTOSH", 10000 ); - - addlong( "iso-8859-1", 28591 ); - addlong( "iso-latin-1", 28591 ); - addlong( "iso-8859-2", 28592 ); - addlong( "iso-8859-3", 28593 ); - addlong( "iso-8859-4", 28594 ); - addlong( "iso-8859-5", 28595 ); - addlong( "iso-8859-6", 28596 ); - addlong( "iso-8859-7", 28597 ); - addlong( "iso-8859-8", 28598 ); - addlong( "iso-8859-9", 28599 ); - addlong( "iso-8859-10", 28592 ); - - addlong( "windows-1250", 1250 ); - addlong( "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", 1252 ); - addlong( "windows-latin-1", 1252 ); - - addlong( "windows-1253", 1253 ); /* code page 1253 */ - addlong( "windows-1254", 1254 ); /* code page 1254, Turkish */ - addlong( "windows-1255", 1255 ); /* code page 1255 */ - addlong( "windows-1256", 1256 ); /* code page 1256 */ - addlong( "windows-1257", 1257 ); /* code page 1257 */ - addlong( "windows-1258", 1258 ); /* code page 1258 */ - addlong( "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", 65000 ); - addlong( "UTF-8", 65001 ); - addlong( "UTF-16", 0 ); - addlong( "UTF-16le", 1200 ); - addlong( "UTF-16be", 1201 ); -#endif - - pophashtable(); - - return (true); - } /* langinit_charset_consttable */ - static boolean langinitconsttable (void) { /* @@ -824,7 +691,7 @@ static boolean langinitbuiltintable (void) { - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "builtins"), &hbuiltinfunctions)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "builtins", &hbuiltinfunctions)) return (false); pushhashtable (hbuiltinfunctions); /*converted to function ops by the parser*/ @@ -879,7 +746,7 @@ 3/6/92 dmb: added "with" token */ - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "keywords"), &hkeywordtable)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "keywords", &hkeywordtable)) return (false); pushhashtable (hkeywordtable); /*converted to tokens by the scanner*/ @@ -955,9 +822,6 @@ if (!langinitconsttable ()) return (false); - if (!langinit_charset_consttable ()) - return (false); - if (!langinitbuiltintable ()) return (false); Modified: Frontier/trunk/Common/source/strings.c =================================================================== --- Frontier/trunk/Common/source/strings.c 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/source/strings.c 2006-04-21 02:06:59 UTC (rev 1317) @@ -35,6 +35,7 @@ #include "ops.h" #include "resources.h" #include "shell.rsrc.h" +#include "tablestructure.h" #include "timedate.h" #include "langinternal.h" /* 2006-02-26 creedon */ #include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */ @@ -2481,7 +2482,100 @@ #endif } /*converttextencoding*/ +boolean initcharsetstable (void) { +#if MACVERSION + OSStatus err; + ItemCount ct, actual_ct, i; + tyvaluerecord v; + + v.valuetype = longvaluetype; + + err = TECCountAvailableTextEncodings( &ct ); + if ( err != noErr ) { + pophashtable(); + + return (true); // don't kill the whole startup + } + + TextEncoding enc; + TextEncoding availEncodings[ ct ]; + bigstring ianaName; + + err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); + if ( err != noErr ) { + pophashtable(); + + return (true); // we don't want to kill the whole startup here + } + + for ( i = 0; i < actual_ct; i++ ) { + enc = availEncodings[ i ]; + // enc = i; + + err = TECGetTextEncodingInternetName( enc, ianaName ); + if ( err != noErr ) + continue; + + nullterminate( ianaName ); + + v.data.longvalue = (signed long) enc; + + hashtableassign( charsetstable, ianaName, v ); + } +#endif + +#if WIN95VERSION + pushhashtable (charsetstable); /* global, table is created in langstartup.c : inittablestructure() */ + + addlong( "ASCII", 20127 ); + addlong( "US-ASCII" 20127 ); /* alias for ASCII */ + + addlong( "MACINTOSH", 10000 ); + addlong( "MacRoman", 10000 ); /* alias for MACINTOSH */ + + addlong( "iso-8859-1", 28591 ); + addlong( "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ + addlong( "iso-8859-2", 28592 ); + addlong( "iso-8859-3", 28593 ); + addlong( "iso-8859-4", 28594 ); + addlong( "iso-8859-5", 28595 ); + addlong( "iso-8859-6", 28596 ); + addlong( "iso-8859-7", 28597 ); + addlong( "iso-8859-8", 28598 ); + addlong( "iso-8859-9", 28599 ); + addlong( "iso-8859-10", 28592 ); + + addlong( "windows-1250", 1250 ); + addlong( "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ + + addlong( "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ + + addlong( "windows-1252", 1252 ); + addlong( "windows-latin-1", 1252 ); + + addlong( "windows-1253", 1253 ); /* code page 1253 */ + addlong( "windows-1254", 1254 ); /* code page 1254, Turkish */ + addlong( "windows-1255", 1255 ); /* code page 1255 */ + addlong( "windows-1256", 1256 ); /* code page 1256 */ + addlong( "windows-1257", 1257 ); /* code page 1257 */ + addlong( "windows-1258", 1258 ); /* code page 1258 */ + addlong( "windows-1361", 1361 ); /* code page 1361, for Windows NT */ + + addlong( "UTF-7", 65000 ); + addlong( "UTF-8", 65001 ); + addlong( "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ + addlong( "UTF-16le", 1200 ); + addlong( "UTF-16be", 1201 ); + + pophashtable(); +#endif + + return (true); + } /* initcharsetstable */ + + + boolean utf16toansi (Handle h, Handle hresult) { /* Modified: Frontier/trunk/Common/source/stringverbs.c =================================================================== --- Frontier/trunk/Common/source/stringverbs.c 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/source/stringverbs.c 2006-04-21 02:06:59 UTC (rev 1317) @@ -2358,8 +2358,12 @@ initialize the builtins directly. 2.1b5 dmb: verb initialization is now resource-based + + 2006-04-20 smd: added call to initialize the character sets */ + initcharsetstable(); + return (loadfunctionprocessor (idstringverbs, &stringfunctionvalue)); } /*stringinitverbs*/ Modified: Frontier/trunk/Common/source/tablestructure.c =================================================================== --- Frontier/trunk/Common/source/tablestructure.c 2006-04-20 20:06:19 UTC (rev 1316) +++ Frontier/trunk/Common/source/tablestructure.c 2006-04-21 02:06:59 UTC (rev 1317) @@ -100,8 +100,10 @@ byte nameenvironmenttable [] = STR_environment; +byte namecharsetstable [] = STR_charsets; + Handle rootvariable = nil; hdlhashtable roottable = nil; @@ -146,8 +148,10 @@ hdlhashtable environmenttable = nil; +hdlhashtable charsetstable = nil; + boolean getsystemtablescript (short idscript, bigstring bsscript) { return (getstringlist (idsystemtablescripts, idscript, bsscript)); @@ -259,6 +263,10 @@ if (!linksystemtable (hsystem, nameenvironmenttable, environmenttable)) return (false); + // link in the charsets table, not part of saved structure + if (!linksystemtable (hsystem, namecharsetstable, charsetstable)) + return (false); + // create the temp table, not part of saved structure if (checktable (hsystem, nametemptable, true, &htemp)) langexternaldontsave (hsystem, nametemptable); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <and...@us...> - 2006-04-20 20:06:37
|
Revision: 1316 Author: andreradke Date: 2006-04-20 13:06:19 -0700 (Thu, 20 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1316&view=rev Log Message: ----------- Fix byte-swapping for RGB values on Intel Macs and in the Win32 version. Modified Paths: -------------- Frontier/trunk/Common/source/langhash.c Frontier/trunk/Common/source/langpack.c Modified: Frontier/trunk/Common/source/langhash.c =================================================================== --- Frontier/trunk/Common/source/langhash.c 2006-04-20 08:42:08 UTC (rev 1315) +++ Frontier/trunk/Common/source/langhash.c 2006-04-20 20:06:19 UTC (rev 1316) @@ -2924,6 +2924,8 @@ 2002-11-11 AR: Added assert to make sure the C compiler chose the proper byte alignment for the tydisktablerecord struct. If it did not, we would end up corrupting any database files we saved. + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ boolean fl; @@ -3122,6 +3124,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb **rgbdisk; + RGBColor rgb; + + if (!hashunpackbinary (hstrings, (Handle *) &rgbdisk, ixstrings)) + goto L1; + + diskrgbtorgb (*rgbdisk, &rgb); + + disposehandle ((Handle) rgbdisk); + + if (!newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &val)) + goto L1; + + exemptfromtmpstack (&val); + + break; + } + #if noextended case doublevaluetype: { @@ -3159,7 +3180,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: #ifndef oplanglists case listvaluetype: case recordvaluetype: Modified: Frontier/trunk/Common/source/langpack.c =================================================================== --- Frontier/trunk/Common/source/langpack.c 2006-04-20 08:42:08 UTC (rev 1315) +++ Frontier/trunk/Common/source/langpack.c 2006-04-20 20:06:19 UTC (rev 1316) @@ -105,6 +105,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b10 dmb: don't disable langerror when getting an address path. + + 2006-04-20 sethdill & aradke: convert rgb values from native byte order to big-endian */ register boolean fl; @@ -213,6 +215,16 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb rgbdiskk; + + rgbtodiskrgb (*val.data.rgbvalue, &rgbdiskk); + + fl = langpackdata (sizeof (rgbdiskk), &rgbdiskk, hpackedvalue); + + break; + } + #if noextended case doublevaluetype: { @@ -239,7 +251,6 @@ case passwordvaluetype: case patternvaluetype: case objspecvaluetype: - case rgbvaluetype: #ifndef version5orgreater case filespecvaluetype: case aliasvaluetype: @@ -494,6 +505,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b3 dmb: unpacking addresses, if stringtoaddress fails, set valuetype to string + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ tyvaluerecord v; @@ -622,6 +635,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + RGBColor rgb; + diskrgb rgbdisk; + + fl = langunpackdata (sizeof (rgbdisk), &rgbdisk, h, &ixunpack); + + if (fl) { + + diskrgbtorgb (&rgbdisk, &rgb); + + fl = newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &v); + + if (fl) + exemptfromtmpstack (&v); + } + + break; + } + #if noextended case doublevaluetype: { @@ -655,7 +687,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: case binaryvaluetype: #ifndef version5orgreater case objspecvaluetype: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <has...@us...> - 2006-04-20 08:42:33
|
Revision: 1315 Author: hasseily Date: 2006-04-20 01:42:08 -0700 (Thu, 20 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1315&view=rev Log Message: ----------- Hack to fix the icons being displayed shifted on Intel macs. Modified Paths: -------------- Frontier/trunk/Common/source/icon.c Frontier/trunk/Common/source/opicons.c Modified: Frontier/trunk/Common/source/icon.c =================================================================== --- Frontier/trunk/Common/source/icon.c 2006-04-19 18:50:44 UTC (rev 1314) +++ Frontier/trunk/Common/source/icon.c 2006-04-20 08:42:08 UTC (rev 1315) @@ -41,6 +41,8 @@ #include "resources.h" /*7.0b9 PBS*/ #include "launch.h" /*7.0b9 PBS*/ +#include "byteorder.h" + /* #define macicon 128 #define bugicon 129 @@ -82,9 +84,18 @@ OSErr ec; CIconHandle hcicon; Handle hicon; + Rect rlocal = *r; - ec = PlotIconID (r, align, transform, resid); +#ifdef SWAP_BYTE_ORDER + /* For some unknown reason the Intel OS X builds shift the icon displays */ + rlocal.top += 3; + rlocal.bottom += 3; + rlocal.left += 6; + rlocal.right += 6; +#endif + ec = PlotIconID (&rlocal, align, transform, resid); + if (ec == noErr) return (true); @@ -92,7 +103,7 @@ if (hcicon != nil) { - PlotCIcon (r, hcicon); + PlotCIcon (&rlocal, hcicon); DisposeCIcon (hcicon); @@ -103,7 +114,7 @@ if (hicon != nil) { - PlotIcon (r, hicon); + PlotIcon (&rlocal, hicon); /*ReleaseResource (hicon);*/ /*dmb 1.0b21 - don't need to*/ Modified: Frontier/trunk/Common/source/opicons.c =================================================================== --- Frontier/trunk/Common/source/opicons.c 2006-04-19 18:50:44 UTC (rev 1314) +++ Frontier/trunk/Common/source/opicons.c 2006-04-20 08:42:08 UTC (rev 1315) @@ -193,16 +193,16 @@ boolean opdefaultgeticonrect (hdlheadrecord hnode, const Rect *linerect, Rect *iconrect) { hdloutlinerecord ho = outlinedata; - Rect r = *linerect; - Rect rcontains; + Rect r; + Rect rcontains = *linerect; - r.bottom = r.top + (**ho).iconheight; + rcontains.bottom = rcontains.top + (**ho).iconheight; - r.left += opnodeindent (hnode); + rcontains.left += opnodeindent (hnode); - r.right = r.left + (**ho).iconwidth; + rcontains.right = rcontains.left + (**ho).iconwidth; - rcontains = r; + r = rcontains; if (opisfatheadlines (ho)) rcontains.bottom = rcontains.top + textvertinset + (**ho).defaultlineheight + textvertinset; @@ -212,7 +212,7 @@ centerrect (&r, rcontains); /*center it vertically within the linerect*/ *iconrect = r; - + return (true); } /*opdefaultgeticonrect*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |