зеркало из https://github.com/mozilla/pjs.git
fix for bug 125617 - use the category manager instead of the registry to keep our list of encoders/decoders
r=dougt, sr=dveditz
This commit is contained in:
Родитель
579b7d30c8
Коммит
ac79a72cbb
|
@ -46,6 +46,7 @@
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
#include "nsIUnicodeEncoder.h"
|
#include "nsIUnicodeEncoder.h"
|
||||||
#include "nsIUnicodeDecoder.h"
|
#include "nsIUnicodeDecoder.h"
|
||||||
|
#include "nsICategoryManager.h"
|
||||||
|
|
||||||
#define NS_ICHARSETCONVERTERMANAGER_IID \
|
#define NS_ICHARSETCONVERTERMANAGER_IID \
|
||||||
{0x3c1c0161, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
{0x3c1c0161, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
||||||
|
@ -57,8 +58,6 @@
|
||||||
// XXX change to NS_CHARSETCONVERTERMANAGER_PID
|
// XXX change to NS_CHARSETCONVERTERMANAGER_PID
|
||||||
#define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1"
|
#define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1"
|
||||||
|
|
||||||
#define NS_REGISTRY_UCONV_BASE "software/netscape/intl/uconv/"
|
|
||||||
// XXX change "xuconv" to "uconv" when the new enc&dec trees are in place
|
|
||||||
#define NS_DATA_BUNDLE_REGISTRY_KEY "software/netscape/intl/xuconv/data/"
|
#define NS_DATA_BUNDLE_REGISTRY_KEY "software/netscape/intl/xuconv/data/"
|
||||||
#define NS_TITLE_BUNDLE_REGISTRY_KEY "software/netscape/intl/xuconv/titles/"
|
#define NS_TITLE_BUNDLE_REGISTRY_KEY "software/netscape/intl/xuconv/titles/"
|
||||||
|
|
||||||
|
@ -76,9 +75,12 @@
|
||||||
#define REGSELF_PRINTF(x,y)
|
#define REGSELF_PRINTF(x,y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NS_UNICODEDECODER_NAME "Charset Decoders"
|
||||||
|
#define NS_UNICODEENCODER_NAME "Charset Encoders"
|
||||||
|
|
||||||
struct nsConverterRegistryInfo {
|
struct nsConverterRegistryInfo {
|
||||||
const char *fromCharset;
|
PRBool isEncoder; // PR_TRUE = encoder, PR_FALSE = decoder
|
||||||
const char *toCharset;
|
const char *charset;
|
||||||
nsCID cid;
|
nsCID cid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,63 +99,96 @@ nsUConverterRegSelf(nsIComponentManager *aCompMgr, \
|
||||||
const char* componentType, \
|
const char* componentType, \
|
||||||
const nsModuleComponentInfo *info) \
|
const nsModuleComponentInfo *info) \
|
||||||
{ \
|
{ \
|
||||||
nsresult res = NS_OK; \
|
nsresult rv; \
|
||||||
nsRegistryKey key; \
|
nsCOMPtr<nsICategoryManager> catman = \
|
||||||
char buff[1024]; \
|
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
|
||||||
PRBool isOpen = PR_FALSE; \
|
if (NS_FAILED(rv)) return rv; \
|
||||||
nsCOMPtr<nsIRegistry> registry = \
|
\
|
||||||
do_GetService(NS_REGISTRY_CONTRACTID, &res); \
|
nsXPIDLCString previous; \
|
||||||
if (NS_FAILED(res)) \
|
PRUint32 i; \
|
||||||
return res; \
|
|
||||||
res = registry->IsOpen(&isOpen); \
|
|
||||||
if (NS_FAILED(res)) \
|
|
||||||
return res; \
|
|
||||||
if(! isOpen) { \
|
|
||||||
res = registry->OpenWellKnownRegistry( \
|
|
||||||
nsIRegistry::ApplicationComponentRegistry); \
|
|
||||||
if (NS_FAILED(res)) \
|
|
||||||
return res; \
|
|
||||||
} \
|
|
||||||
int i; \
|
|
||||||
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
|
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
|
||||||
char * cid_string; \
|
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
|
||||||
cid_string = gConverterRegistryInfo[i].cid.ToString(); \
|
const char *category; \
|
||||||
sprintf(buff, "%s/%s", "software/netscape/intl/uconv", cid_string); \
|
const char *key; \
|
||||||
nsCRT::free(cid_string); \
|
\
|
||||||
res = registry->AddSubtree(nsIRegistry::Common, buff, &key); \
|
if (entry->isEncoder) { \
|
||||||
if (NS_FAILED(res)) \
|
category = NS_UNICODEENCODER_NAME; \
|
||||||
continue; \
|
} else { \
|
||||||
res = registry->SetStringUTF8(key, "source", \
|
category = NS_UNICODEDECODER_NAME; \
|
||||||
gConverterRegistryInfo[i].fromCharset);\
|
|
||||||
if (NS_FAILED(res)) \
|
|
||||||
continue; \
|
|
||||||
res = registry->SetStringUTF8(key, "destination", \
|
|
||||||
gConverterRegistryInfo[i].toCharset); \
|
|
||||||
if (NS_FAILED(res)) \
|
|
||||||
continue; \
|
|
||||||
REGSELF_PRINTF(gConverterRegistryInfo[i].fromCharset, \
|
|
||||||
gConverterRegistryInfo[i].toCharset); \
|
|
||||||
} \
|
} \
|
||||||
return res; \
|
key = entry->charset; \
|
||||||
|
\
|
||||||
|
rv = catman->AddCategoryEntry(category, key, "", \
|
||||||
|
PR_TRUE, \
|
||||||
|
PR_TRUE, \
|
||||||
|
getter_Copies(previous)); \
|
||||||
|
} \
|
||||||
|
return rv; \
|
||||||
} \
|
} \
|
||||||
\
|
|
||||||
static NS_IMETHODIMP \
|
static NS_IMETHODIMP \
|
||||||
nsUConverterUnregSelf(nsIComponentManager *aCompMgr, \
|
nsUConverterUnregSelf(nsIComponentManager *aCompMgr, \
|
||||||
nsIFile *aPath, \
|
nsIFile *aPath, \
|
||||||
const char*, \
|
const char*, \
|
||||||
const nsModuleComponentInfo *info) \
|
const nsModuleComponentInfo *info) \
|
||||||
{ \
|
{ \
|
||||||
return NS_OK; \
|
nsresult rv; \
|
||||||
|
nsCOMPtr<nsICategoryManager> catman = \
|
||||||
|
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
|
||||||
|
if (NS_FAILED(rv)) return rv; \
|
||||||
|
\
|
||||||
|
nsXPIDLCString previous; \
|
||||||
|
PRUint32 i; \
|
||||||
|
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
|
||||||
|
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
|
||||||
|
const char *category; \
|
||||||
|
const char *key; \
|
||||||
|
\
|
||||||
|
if (entry->isEncoder) { \
|
||||||
|
category = NS_UNICODEDECODER_NAME; \
|
||||||
|
} else { \
|
||||||
|
category = NS_UNICODEENCODER_NAME; \
|
||||||
|
} \
|
||||||
|
key = entry->charset; \
|
||||||
|
\
|
||||||
|
char * value = entry->cid.ToString(); \
|
||||||
|
\
|
||||||
|
rv = catman->DeleteCategoryEntry(category, key, PR_TRUE); \
|
||||||
|
CRTFREEIF(value); \
|
||||||
|
} \
|
||||||
|
return rv; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define NS_UCONV_REG_UNREG(_From, _To, _CID ) \
|
#define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \
|
||||||
{ \
|
{ \
|
||||||
_From, \
|
PR_FALSE, \
|
||||||
_To, \
|
_Charset, \
|
||||||
_CID, \
|
_CID, \
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#define NS_UCONV_REG_UNREG_ENCODER(_Charset, _CID) \
|
||||||
|
{ \
|
||||||
|
PR_TRUE, \
|
||||||
|
_Charset, \
|
||||||
|
_CID, \
|
||||||
|
},
|
||||||
|
|
||||||
|
// this needs to be written out per some odd cpp behavior that
|
||||||
|
// I could not work around - the behavior is document in the cpp
|
||||||
|
// info page however, so I'm not the only one to hit this!
|
||||||
|
#define NS_UCONV_REG_UNREG(_Charset, _DecoderCID, _EncoderCID) \
|
||||||
|
{ \
|
||||||
|
PR_FALSE, \
|
||||||
|
_Charset, \
|
||||||
|
_DecoderCID, \
|
||||||
|
}, \
|
||||||
|
{ \
|
||||||
|
PR_TRUE, \
|
||||||
|
_Charset, \
|
||||||
|
_EncoderCID, \
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for a Manager of Charset Converters.
|
* Interface for a Manager of Charset Converters.
|
||||||
*
|
*
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "nsICharsetAlias.h"
|
#include "nsICharsetAlias.h"
|
||||||
#include "nsIRegistry.h"
|
#include "nsIRegistry.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
#include "nsICategoryManager.h"
|
||||||
#include "nsICharsetConverterManager.h"
|
#include "nsICharsetConverterManager.h"
|
||||||
#include "nsICharsetConverterManager2.h"
|
#include "nsICharsetConverterManager2.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
|
@ -52,6 +53,8 @@
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
|
#include "nsISupportsPrimitives.h"
|
||||||
|
|
||||||
// just for CIDs
|
// just for CIDs
|
||||||
#include "nsIUnicodeDecodeHelper.h"
|
#include "nsIUnicodeDecodeHelper.h"
|
||||||
#include "nsIUnicodeEncodeHelper.h"
|
#include "nsIUnicodeEncodeHelper.h"
|
||||||
|
@ -85,6 +88,7 @@ nsCharsetConverterManager::~nsCharsetConverterManager()
|
||||||
NS_IF_RELEASE(mTitleBundle);
|
NS_IF_RELEASE(mTitleBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult nsCharsetConverterManager::RegisterConverterManagerData()
|
nsresult nsCharsetConverterManager::RegisterConverterManagerData()
|
||||||
{
|
{
|
||||||
nsresult res = NS_OK;
|
nsresult res = NS_OK;
|
||||||
|
@ -113,12 +117,11 @@ nsresult nsCharsetConverterManager::RegisterConverterTitles(
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsRegistryKey key;
|
nsRegistryKey key;
|
||||||
|
|
||||||
nsAutoString str; str.AssignWithConversion(aRegistryPath);
|
nsCAutoString str(aRegistryPath);
|
||||||
str.Append(NS_LITERAL_STRING("defaultFile"));
|
str.Append(NS_LITERAL_CSTRING("defaultFile"));
|
||||||
|
|
||||||
|
res = aRegistry->AddSubtree(nsIRegistry::Common, str.get(), &key);
|
||||||
|
|
||||||
char * p = ToNewCString(str);
|
|
||||||
res = aRegistry->AddSubtree(nsIRegistry::Common, p, &key);
|
|
||||||
nsMemory::Free(p);
|
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = aRegistry->SetStringUTF8(key, "name", "chrome://global/locale/charsetTitles.properties");
|
res = aRegistry->SetStringUTF8(key, "name", "chrome://global/locale/charsetTitles.properties");
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
@ -133,12 +136,11 @@ nsresult nsCharsetConverterManager::RegisterConverterData(
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsRegistryKey key;
|
nsRegistryKey key;
|
||||||
|
|
||||||
nsAutoString str; str.AssignWithConversion(aRegistryPath);
|
nsCAutoString str(aRegistryPath);
|
||||||
str.Append(NS_LITERAL_STRING("defaultFile"));
|
str.Append(NS_LITERAL_CSTRING("defaultFile"));
|
||||||
|
|
||||||
|
res = aRegistry->AddSubtree(nsIRegistry::Common, str.get(), &key);
|
||||||
|
|
||||||
char * p = ToNewCString(str);
|
|
||||||
res = aRegistry->AddSubtree(nsIRegistry::Common, p, &key);
|
|
||||||
nsMemory::Free(p);
|
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = aRegistry->SetStringUTF8(key, "name", "resource:/res/charsetData.properties");
|
res = aRegistry->SetStringUTF8(key, "name", "resource:/res/charsetData.properties");
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
@ -264,101 +266,6 @@ next:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX deprecate this method and switch to GetRegistryEnumeration() when
|
|
||||||
// changing the registration style for converters.
|
|
||||||
// The idea is to have two trees:
|
|
||||||
// .../uconv/decoder/name
|
|
||||||
// .../uconv/encoder/name
|
|
||||||
nsresult nsCharsetConverterManager::GetRegistryEnumeration2(
|
|
||||||
const char * aRegistryKey,
|
|
||||||
PRBool aDecoder,
|
|
||||||
nsISupportsArray ** aArray)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsCOMPtr<nsISupportsArray> array = NULL;
|
|
||||||
nsRegistryKey key;
|
|
||||||
|
|
||||||
res = nsComponentManager::CreateInstance(kSupportsArrayCID, NULL,
|
|
||||||
NS_GET_IID(nsISupportsArray), getter_AddRefs(array));
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
// get the registry
|
|
||||||
nsCOMPtr<nsIRegistry> registry(do_GetService(kRegistryCID, &res));
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
// open registry if necessary
|
|
||||||
PRBool regOpen = PR_FALSE;
|
|
||||||
registry->IsOpen(®Open);
|
|
||||||
if (!regOpen) {
|
|
||||||
res = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry);
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get subtree
|
|
||||||
res = registry->GetSubtree(nsIRegistry::Common, aRegistryKey, &key);
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
// enumerate subtrees
|
|
||||||
nsCOMPtr<nsIEnumerator> enumerator;
|
|
||||||
res = registry->EnumerateSubtrees(key, getter_AddRefs(enumerator));
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIRegistryEnumerator> components = do_QueryInterface(enumerator, &res);
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
res = components->First();
|
|
||||||
if (NS_FAILED(res)) return res;
|
|
||||||
|
|
||||||
while (NS_OK != components->IsDone()) {
|
|
||||||
const char *name;
|
|
||||||
char *src;
|
|
||||||
char *dest;
|
|
||||||
nsAutoString fullName;
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
|
|
||||||
res = components->CurrentItemInPlaceUTF8(&key, &name);
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
|
|
||||||
res = registry->GetStringUTF8(key, "source", &src);
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
|
|
||||||
res = registry->GetStringUTF8(key, "destination", &dest);
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
|
|
||||||
if (aDecoder) {
|
|
||||||
if (!strcmp(dest, "Unicode")) {
|
|
||||||
fullName.AssignWithConversion(src);
|
|
||||||
res = GetCharsetAtom(fullName.get(), getter_AddRefs(atom));
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
|
|
||||||
res = array->AppendElement(atom);
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!strcmp(src, "Unicode")) {
|
|
||||||
fullName.AssignWithConversion(dest);
|
|
||||||
res = GetCharsetAtom(fullName.get(), getter_AddRefs(atom));
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
|
|
||||||
res = array->AppendElement(atom);
|
|
||||||
if (NS_FAILED(res)) goto done1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
done1:
|
|
||||||
if (src != NULL) nsCRT::free(src);
|
|
||||||
if (dest != NULL) nsCRT::free(dest);
|
|
||||||
|
|
||||||
res = components->Next();
|
|
||||||
if (NS_FAILED(res)) break; // this is NOT supposed to fail!
|
|
||||||
}
|
|
||||||
|
|
||||||
// everything was fine, set the result
|
|
||||||
*aArray = array;
|
|
||||||
NS_ADDREF(*aArray);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Interface nsICharsetConverterManager [implementation]
|
// Interface nsICharsetConverterManager [implementation]
|
||||||
|
@ -467,27 +374,61 @@ NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeEncoder(
|
||||||
return GetUnicodeEncoder(&name, aResult);
|
return GetUnicodeEncoder(&name, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX move this macro into the UnicodeDecoder/Encoder interface
|
nsresult
|
||||||
#define NS_CHARSET_CONVERTER_REG_BASE "software/netscape/intl/uconv"
|
nsCharsetConverterManager::GetList(PRBool aEncoder, nsISupportsArray** aResult)
|
||||||
|
|
||||||
NS_IMETHODIMP nsCharsetConverterManager::GetDecoderList(
|
|
||||||
nsISupportsArray ** aResult)
|
|
||||||
{
|
{
|
||||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
if (aResult == NULL)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
*aResult = NULL;
|
*aResult = NULL;
|
||||||
|
|
||||||
return GetRegistryEnumeration2(NS_CHARSET_CONVERTER_REG_BASE, PR_TRUE,
|
nsresult rv;
|
||||||
aResult);
|
nsCOMPtr<nsIAtom> atom;
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupportsArray> array = do_CreateInstance(kSupportsArrayCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||||
|
catman->EnumerateCategory(aEncoder ? NS_UNICODEENCODER_NAME : NS_UNICODEDECODER_NAME,
|
||||||
|
getter_AddRefs(enumerator));
|
||||||
|
|
||||||
|
PRBool hasMore;
|
||||||
|
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||||
|
nsCOMPtr<nsISupports> supports;
|
||||||
|
if (NS_FAILED(enumerator->GetNext(getter_AddRefs(supports))))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupportsString> supStr = do_QueryInterface(supports);
|
||||||
|
if (!supStr)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nsXPIDLCString fullName;
|
||||||
|
if (NS_FAILED(supStr->GetData(getter_Copies(fullName))))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rv = GetCharsetAtom2(fullName.get(), getter_AddRefs(atom));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rv = array->AppendElement(atom);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ADDREF(*aResult = array);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we should change the interface so that we can just pass back a enumerator!
|
||||||
|
NS_IMETHODIMP nsCharsetConverterManager::GetDecoderList(nsISupportsArray ** aResult)
|
||||||
|
{
|
||||||
|
return GetList(PR_FALSE, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCharsetConverterManager::GetEncoderList(
|
NS_IMETHODIMP nsCharsetConverterManager::GetEncoderList(
|
||||||
nsISupportsArray ** aResult)
|
nsISupportsArray ** aResult)
|
||||||
{
|
{
|
||||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
return GetList(PR_TRUE, aResult);
|
||||||
*aResult = NULL;
|
|
||||||
|
|
||||||
return GetRegistryEnumeration2(NS_CHARSET_CONVERTER_REG_BASE, PR_FALSE,
|
|
||||||
aResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetDetectorList(
|
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetDetectorList(
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
nsresult GetRegistryEnumeration2(const char * aRegistryKey, PRBool aDecoder,
|
nsresult GetRegistryEnumeration2(const char * aRegistryKey, PRBool aDecoder,
|
||||||
nsISupportsArray ** aArray);
|
nsISupportsArray ** aArray);
|
||||||
|
|
||||||
|
nsresult GetList(PRBool encoder, nsISupportsArray** aResult);
|
||||||
public:
|
public:
|
||||||
static nsresult RegisterConverterManagerData();
|
static nsresult RegisterConverterManagerData();
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,17 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIModule.h"
|
#include "nsIModule.h"
|
||||||
#include "nsIGenericFactory.h"
|
#include "nsIGenericFactory.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
|
#include "nsICategoryManager.h"
|
||||||
#include "nsICharsetConverterManager.h"
|
#include "nsICharsetConverterManager.h"
|
||||||
#include "nsICharsetConverterManager2.h"
|
#include "nsICharsetConverterManager2.h"
|
||||||
#include "nsIUnicodeDecodeHelper.h"
|
#include "nsIUnicodeDecodeHelper.h"
|
||||||
#include "nsIUnicodeEncodeHelper.h"
|
#include "nsIUnicodeEncodeHelper.h"
|
||||||
|
#include "nsIUnicodeDecoder.h"
|
||||||
|
#include "nsIUnicodeEncoder.h"
|
||||||
|
#include "nsICharsetConverterManager.h"
|
||||||
#include "nsIPlatformCharset.h"
|
#include "nsIPlatformCharset.h"
|
||||||
#include "nsICharsetAlias.h"
|
#include "nsICharsetAlias.h"
|
||||||
#include "nsITextToSubURI.h"
|
#include "nsITextToSubURI.h"
|
||||||
|
@ -73,14 +76,10 @@
|
||||||
#include "nsScriptableUConv.h"
|
#include "nsScriptableUConv.h"
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
NS_CONVERTER_REGISTRY_START
|
||||||
NS_UCONV_REG_UNREG("ISO-8859-1", "Unicode", NS_ISO88591TOUNICODE_CID)
|
NS_UCONV_REG_UNREG("ISO-8859-1", NS_ISO88591TOUNICODE_CID, NS_UNICODETOISO88591_CID)
|
||||||
NS_UCONV_REG_UNREG("windows-1252", "Unicode", NS_CP1252TOUNICODE_CID)
|
NS_UCONV_REG_UNREG("windows-1252", NS_CP1252TOUNICODE_CID, NS_UNICODETOCP1252_CID)
|
||||||
NS_UCONV_REG_UNREG("x-mac-roman", "Unicode", NS_MACROMANTOUNICODE_CID)
|
NS_UCONV_REG_UNREG("x-mac-roman", NS_MACROMANTOUNICODE_CID, NS_UNICODETOMACROMAN_CID)
|
||||||
NS_UCONV_REG_UNREG("UTF-8", "Unicode", NS_UTF8TOUNICODE_CID)
|
NS_UCONV_REG_UNREG("UTF-8", NS_UTF8TOUNICODE_CID, NS_UNICODETOUTF8_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "ISO-8859-1", NS_UNICODETOISO88591_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "windows-1252", NS_UNICODETOCP1252_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mac-roman", NS_UNICODETOMACROMAN_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "UTF-8", NS_UNICODETOUTF8_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
NS_CONVERTER_REGISTRY_END
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
NS_IMPL_NSUCONVERTERREGSELF
|
||||||
|
|
|
@ -1,187 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public License
|
|
||||||
* Version 1.1 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nspr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "pratom.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIFactory.h"
|
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIGenericFactory.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsICharsetConverterManager.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
#include "nsUCvCnCID.h"
|
|
||||||
#include "nsUCvCnDll.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
#include "nsHZToUnicode.h"
|
|
||||||
#include "nsUnicodeToHZ.h"
|
|
||||||
#include "nsGBKToUnicode.h"
|
|
||||||
#include "nsUnicodeToGBK.h"
|
|
||||||
#include "nsUnicodeToGBKNoAscii.h"
|
|
||||||
#include "nsCP936ToUnicode.h"
|
|
||||||
#include "nsUnicodeToCP936.h"
|
|
||||||
#include "nsGB2312ToUnicodeV2.h"
|
|
||||||
#include "nsUnicodeToGB2312V2.h"
|
|
||||||
#include "nsUnicodeToGB2312GL.h"
|
|
||||||
#include "gbku.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Global functions and data [declaration]
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
#define DECODER_NAME_BASE "Unicode Decoder-"
|
|
||||||
#define ENCODER_NAME_BASE "Unicode Encoder-"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
|
||||||
NS_UCONV_REG_UNREG("GB2312", "Unicode" , NS_GB2312TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "GB2312", NS_UNICODETOGB2312_CID)
|
|
||||||
NS_UCONV_REG_UNREG("windows-936", "Unicode" , NS_CP936TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "windows-936", NS_UNICODETOCP936_CID)
|
|
||||||
NS_UCONV_REG_UNREG("x-gbk", "Unicode" , NS_GBKTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-gbk", NS_UNICODETOGBK_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-gbk-noascii", NS_UNICODETOGBKNOASCII_CID)
|
|
||||||
NS_UCONV_REG_UNREG("HZ-GB-2312", "Unicode" , NS_HZTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "HZ-GB-2312", NS_UNICODETOHZ_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "gb_2312-80", NS_UNICODETOGB2312GL_CID)
|
|
||||||
NS_UCONV_REG_UNREG("gb18030", "Unicode" , NS_GB18030TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "gb18030", NS_UNICODETOGB18030_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "gb18030.2000-0", NS_UNICODETOGB18030Font0_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "gb18030.2000-1", NS_UNICODETOGB18030Font1_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGB2312ToUnicodeV2);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB2312V2);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP936ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP936);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGBKToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGBK);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGBKNoAscii);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHZToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToHZ);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB2312GL);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGB18030ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB18030);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB18030Font0);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB18030Font1);
|
|
||||||
|
|
||||||
|
|
||||||
static const nsModuleComponentInfo components[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "GB2312" , NS_GB2312TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "GB2312",
|
|
||||||
nsGB2312ToUnicodeV2Constructor ,
|
|
||||||
// global converter registration
|
|
||||||
nsUConverterRegSelf, nsUConverterUnregSelf,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "GB2312" , NS_UNICODETOGB2312_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "GB2312",
|
|
||||||
nsUnicodeToGB2312V2Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "windows-936" , NS_CP936TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "windows-936",
|
|
||||||
nsCP936ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "windows-936" , NS_UNICODETOCP936_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "windows-936",
|
|
||||||
nsUnicodeToCP936Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "x-gbk" , NS_GBKTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "x-gbk",
|
|
||||||
nsGBKToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-gbk" , NS_UNICODETOGBK_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-gbk",
|
|
||||||
nsUnicodeToGBKConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-gbk-noascii" , NS_UNICODETOGBKNOASCII_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-gbk-noascii",
|
|
||||||
nsUnicodeToGBKNoAsciiConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "HZ-GB-2312" , NS_HZTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "HZ-GB-2312",
|
|
||||||
nsHZToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "HZ-GB-2312" , NS_UNICODETOHZ_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "HZ-GB-2312",
|
|
||||||
nsUnicodeToHZConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "gb_2312-80" , NS_UNICODETOGB2312GL_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "gb_2312-80",
|
|
||||||
nsUnicodeToGB2312GLConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "gb18030" , NS_GB18030TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "gb18030",
|
|
||||||
nsGB18030ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "gb18030.2000-0" , NS_UNICODETOGB18030Font0_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "gb18030.2000-0",
|
|
||||||
nsUnicodeToGB18030Font0Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "gb18030.2000-1" , NS_UNICODETOGB18030Font1_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "gb18030.2000-1",
|
|
||||||
nsUnicodeToGB18030Font1Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "gb18030" , NS_UNICODETOGB18030_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "gb18030",
|
|
||||||
nsUnicodeToGB18030Constructor,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE(nsUCvCnModule, components);
|
|
|
@ -1,187 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public
|
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS
|
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
||||||
* implied. See the License for the specific language governing
|
|
||||||
* rights and limitations under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Netscape Communications
|
|
||||||
* Corporation. Portions created by Netscape are
|
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
||||||
* Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* IBM Corporation
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
*
|
|
||||||
* This Original Code has been modified by IBM Corporation.
|
|
||||||
* Modifications made by IBM described herein are
|
|
||||||
* Copyright (c) International Business Machines
|
|
||||||
* Corporation, 1999
|
|
||||||
*
|
|
||||||
* Modifications to Mozilla code or documentation
|
|
||||||
* identified per MPL Section 3.3
|
|
||||||
*
|
|
||||||
* Date Modified by Description of modification
|
|
||||||
* 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "pratom.h"
|
|
||||||
#include "nspr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIFactory.h"
|
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIGenericFactory.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsICharsetConverterManager.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
#include "nsUCvIBMCID.h"
|
|
||||||
#include "nsUCvIBMDll.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
#include "nsCP850ToUnicode.h"
|
|
||||||
#include "nsCP852ToUnicode.h"
|
|
||||||
#include "nsCP855ToUnicode.h"
|
|
||||||
#include "nsCP857ToUnicode.h"
|
|
||||||
#include "nsCP862ToUnicode.h"
|
|
||||||
#include "nsCP864ToUnicode.h"
|
|
||||||
#include "nsCP864iToUnicode.h"
|
|
||||||
#include "nsUnicodeToCP850.h"
|
|
||||||
#include "nsUnicodeToCP852.h"
|
|
||||||
#include "nsUnicodeToCP855.h"
|
|
||||||
#include "nsUnicodeToCP857.h"
|
|
||||||
#include "nsUnicodeToCP862.h"
|
|
||||||
#include "nsUnicodeToCP864.h"
|
|
||||||
#include "nsUnicodeToCP864i.h"
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Global functions and data [declaration]
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
#define DECODER_NAME_BASE "Unicode Decoder-"
|
|
||||||
#define ENCODER_NAME_BASE "Unicode Encoder-"
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
|
||||||
|
|
||||||
NS_UCONV_REG_UNREG("IBM850", "Unicode" , NS_CP850TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM852", "Unicode" , NS_CP852TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM855", "Unicode" , NS_CP855TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM857", "Unicode" , NS_CP857TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM862", "Unicode" , NS_CP862TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM864", "Unicode" , NS_CP864TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("IBM864i", "Unicode", NS_CP864ITOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM850", NS_UNICODETOCP850_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM852", NS_UNICODETOCP852_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM855", NS_UNICODETOCP855_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM857", NS_UNICODETOCP857_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM862", NS_UNICODETOCP862_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM864", NS_UNICODETOCP864_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "IBM864i", NS_UNICODETOCP864I_CID)
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP850ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP852ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP855ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP857ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP862ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP864ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCP864iToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP850);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP852);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP855);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP857);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP862);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP864);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCP864i);
|
|
||||||
|
|
||||||
static const nsModuleComponentInfo components[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM850" , NS_CP850TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM850",
|
|
||||||
nsCP850ToUnicodeConstructor ,
|
|
||||||
// global converter registration
|
|
||||||
nsUConverterRegSelf,
|
|
||||||
nsUConverterUnregSelf,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM852" , NS_CP852TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM852",
|
|
||||||
nsCP852ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM855" , NS_CP855TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM855",
|
|
||||||
nsCP855ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM857" , NS_CP857TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM857",
|
|
||||||
nsCP857ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM862" , NS_CP862TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM862",
|
|
||||||
nsCP862ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM864" , NS_CP864TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM864",
|
|
||||||
nsCP864ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "IBM864i" , NS_CP864ITOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "IBM864i",
|
|
||||||
nsCP864iToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM850" , NS_UNICODETOCP850_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM850",
|
|
||||||
nsUnicodeToCP850Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM852" , NS_UNICODETOCP852_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM852",
|
|
||||||
nsUnicodeToCP852Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM855" , NS_UNICODETOCP855_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM855",
|
|
||||||
nsUnicodeToCP855Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM857" , NS_UNICODETOCP857_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM857",
|
|
||||||
nsUnicodeToCP857Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM862" , NS_UNICODETOCP862_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM862",
|
|
||||||
nsUnicodeToCP862Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM864" , NS_UNICODETOCP864_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM864",
|
|
||||||
nsUnicodeToCP864Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "IBM864i" , NS_UNICODETOCP864I_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "IBM864i",
|
|
||||||
nsUnicodeToCP864iConstructor,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE(nsUCvIBMModule, components);
|
|
||||||
|
|
|
@ -1,164 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public License
|
|
||||||
* Version 1.1 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nspr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "pratom.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIFactory.h"
|
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIGenericFactory.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsICharsetConverterManager.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
#include "nsUCVJACID.h"
|
|
||||||
#include "nsUCVJA2CID.h"
|
|
||||||
#include "nsUCVJADll.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
#include "nsJapaneseToUnicode.h"
|
|
||||||
#include "nsUnicodeToSJIS.h"
|
|
||||||
#include "nsUnicodeToEUCJP.h"
|
|
||||||
#include "nsUnicodeToISO2022JP.h"
|
|
||||||
#include "nsUnicodeToJISx0201.h"
|
|
||||||
#include "nsUnicodeToJISx0208.h"
|
|
||||||
#include "nsUnicodeToJISx0212.h"
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Global functions and data [declaration]
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
#define DECODER_NAME_BASE "Unicode Decoder-"
|
|
||||||
#define ENCODER_NAME_BASE "Unicode Encoder-"
|
|
||||||
|
|
||||||
PRUint16 g_uf0201Mapping[] = {
|
|
||||||
#include "jis0201.uf"
|
|
||||||
};
|
|
||||||
PRUint16 g_uf0201GLMapping[] = {
|
|
||||||
#include "jis0201gl.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_uf0208Mapping[] = {
|
|
||||||
#include "jis0208.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_uf0208extMapping[] = {
|
|
||||||
#include "jis0208ext.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_uf0212Mapping[] = {
|
|
||||||
#include "jis0212.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
|
||||||
NS_UCONV_REG_UNREG("Shift_JIS", "Unicode" , NS_SJISTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("ISO-2022-JP", "Unicode" , NS_ISO2022JPTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("EUC-JP", "Unicode" , NS_EUCJPTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "Shift_JIS" , NS_UNICODETOSJIS_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "EUC-JP" , NS_UNICODETOEUCJP_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "ISO-2022-JP" , NS_UNICODETOISO2022JP_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "jis_0201" , NS_UNICODETOJISX0201_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "jis_0208-1983" , NS_UNICODETOJISX0208_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "jis_0212-1990" , NS_UNICODETOJISX0212_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsShiftJISToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEUCJPToUnicodeV2);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsISO2022JPToUnicodeV2);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToSJIS);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToEUCJP);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToISO2022JP);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToJISx0201);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToJISx0208);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToJISx0212);
|
|
||||||
|
|
||||||
static const nsModuleComponentInfo components[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "Shift_JIS" , NS_SJISTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "Shift_JIS",
|
|
||||||
nsShiftJISToUnicodeConstructor ,
|
|
||||||
// global converter registration
|
|
||||||
nsUConverterRegSelf, nsUConverterUnregSelf,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "EUC-JP" , NS_EUCJPTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "EUC-JP",
|
|
||||||
nsEUCJPToUnicodeV2Constructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "ISO-2022-JP" , NS_ISO2022JPTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "ISO-2022-JP",
|
|
||||||
nsISO2022JPToUnicodeV2Constructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "Shift_JIS" , NS_UNICODETOSJIS_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "Shift_JIS",
|
|
||||||
nsUnicodeToSJISConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "EUC-JP" , NS_UNICODETOEUCJP_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "EUC-JP",
|
|
||||||
nsUnicodeToEUCJPConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "ISO-2022-JP" , NS_UNICODETOISO2022JP_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "ISO-2022-JP",
|
|
||||||
nsUnicodeToISO2022JPConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "jis_0201" , NS_UNICODETOJISX0201_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "jis_0201",
|
|
||||||
nsUnicodeToJISx0201Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "jis_0208-1983" , NS_UNICODETOJISX0208_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "jis_0208-1983",
|
|
||||||
nsUnicodeToJISx0208Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "jis_0212-1990" , NS_UNICODETOJISX0212_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "jis_0212-1990",
|
|
||||||
nsUnicodeToJISx0212Constructor,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE(nsUCvJAModule, components);
|
|
||||||
|
|
|
@ -87,16 +87,14 @@ PRUint16 g_HangulNullMapping[] ={
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
NS_CONVERTER_REGISTRY_START
|
||||||
NS_UCONV_REG_UNREG("EUC-KR", "Unicode" , NS_EUCKRTOUNICODE_CID)
|
NS_UCONV_REG_UNREG("EUC-KR", NS_EUCKRTOUNICODE_CID, NS_UNICODETOEUCKR_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "EUC-KR", NS_UNICODETOEUCKR_CID)
|
NS_UCONV_REG_UNREG("x-johab", NS_JOHABTOUNICODE_CID, NS_UNICODETOJOHAB_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "ks_c_5601-1987", NS_UNICODETOKSC5601_CID)
|
NS_UCONV_REG_UNREG("x-windows-949", NS_CP949TOUNICODE_CID, NS_UNICODETOCP949_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-x11johab", NS_UNICODETOX11JOHAB_CID)
|
NS_UCONV_REG_UNREG_DECODER("ISO-2022-KR", NS_ISO2022KRTOUNICODE_CID)
|
||||||
NS_UCONV_REG_UNREG("x-johab", "Unicode" , NS_JOHABTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-johab", NS_UNICODETOJOHAB_CID)
|
NS_UCONV_REG_UNREG_ENCODER("ks_c_5601-1987", NS_UNICODETOKSC5601_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-johab-noascii", NS_UNICODETOJOHABNOASCII_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-x11johab", NS_UNICODETOX11JOHAB_CID)
|
||||||
NS_UCONV_REG_UNREG("x-windows-949", "Unicode" , NS_CP949TOUNICODE_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-johab-noascii", NS_UNICODETOJOHABNOASCII_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-windows-949", NS_UNICODETOCP949_CID)
|
|
||||||
NS_UCONV_REG_UNREG("ISO-2022-KR", "Unicode" , NS_ISO2022KRTOUNICODE_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
NS_CONVERTER_REGISTRY_END
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
NS_IMPL_NSUCONVERTERREGSELF
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*/
|
*/
|
||||||
nsUnicodeToX11Johab();
|
nsUnicodeToX11Johab();
|
||||||
~nsUnicodeToX11Johab();
|
virtual ~nsUnicodeToX11Johab();
|
||||||
|
|
||||||
NS_IMETHOD Convert(
|
NS_IMETHOD Convert(
|
||||||
const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -78,22 +78,22 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
NS_CONVERTER_REGISTRY_START
|
||||||
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-ttf-cmr", NS_UNICODETOTEXCMRTTF_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmr", NS_UNICODETOTEXCMRTTF_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-ttf-cmmi", NS_UNICODETOTEXCMMITTF_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmmi", NS_UNICODETOTEXCMMITTF_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-ttf-cmsy", NS_UNICODETOTEXCMSYTTF_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmsy", NS_UNICODETOTEXCMSYTTF_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-ttf-cmex", NS_UNICODETOTEXCMEXTTF_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmex", NS_UNICODETOTEXCMEXTTF_CID)
|
||||||
#if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC)
|
#if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-t1-cmr", NS_UNICODETOTEXCMRT1_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-t1-cmr", NS_UNICODETOTEXCMRT1_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-t1-cmmi", NS_UNICODETOTEXCMMIT1_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-t1-cmmi", NS_UNICODETOTEXCMMIT1_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-t1-cmsy", NS_UNICODETOTEXCMSYT1_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-t1-cmsy", NS_UNICODETOTEXCMSYT1_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-t1-cmex", NS_UNICODETOTEXCMEXT1_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-t1-cmex", NS_UNICODETOTEXCMEXT1_CID)
|
||||||
#endif
|
#endif
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mathematica1", NS_UNICODETOMATHEMATICA1_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mathematica1", NS_UNICODETOMATHEMATICA1_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mathematica2", NS_UNICODETOMATHEMATICA2_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mathematica2", NS_UNICODETOMATHEMATICA2_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mathematica3", NS_UNICODETOMATHEMATICA3_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mathematica3", NS_UNICODETOMATHEMATICA3_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mathematica4", NS_UNICODETOMATHEMATICA4_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mathematica4", NS_UNICODETOMATHEMATICA4_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mathematica5", NS_UNICODETOMATHEMATICA5_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mathematica5", NS_UNICODETOMATHEMATICA5_CID)
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-mtextra", NS_UNICODETOMTEXTRA_CID)
|
NS_UCONV_REG_UNREG_ENCODER("x-mtextra", NS_UNICODETOMTEXTRA_CID)
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
NS_CONVERTER_REGISTRY_END
|
||||||
|
|
||||||
|
|
|
@ -1,143 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public License
|
|
||||||
* Version 1.1 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nspr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "pratom.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIFactory.h"
|
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIGenericFactory.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsICharsetConverterManager.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
#include "nsUCvTWCID.h"
|
|
||||||
#include "nsUCvTWDll.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
|
|
||||||
#include "nsBIG5ToUnicode.h"
|
|
||||||
#include "nsUnicodeToBIG5.h"
|
|
||||||
#include "nsUnicodeToBIG5NoAscii.h"
|
|
||||||
#include "nsBIG5HKSCSToUnicode.h"
|
|
||||||
#include "nsUnicodeToBIG5HKSCS.h"
|
|
||||||
#include "nsUnicodeToHKSCS.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Global functions and data [declaration]
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
#define DECODER_NAME_BASE "Unicode Decoder-"
|
|
||||||
#define ENCODER_NAME_BASE "Unicode Encoder-"
|
|
||||||
|
|
||||||
PRUint16 g_ufBig5Mapping[] = {
|
|
||||||
#include "big5.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utBIG5Mapping[] = {
|
|
||||||
#include "big5.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ASCIIMapping[] = {
|
|
||||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufBig5HKSCSMapping[] = {
|
|
||||||
#include "hkscs.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utBig5HKSCSMapping[] = {
|
|
||||||
#include "hkscs.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
|
||||||
NS_UCONV_REG_UNREG("Big5", "Unicode" , NS_BIG5TOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-x-big5", NS_UNICODETOBIG5NOASCII_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "Big5" , NS_UNICODETOBIG5_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Big5-HKSCS", "Unicode" , NS_BIG5HKSCSTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "Big5-HKSCS" , NS_UNICODETOBIG5HKSCS_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "hkscs-1" , NS_UNICODETOHKSCS_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBIG5ToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToBIG5);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToBIG5NoAscii);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBIG5HKSCSToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToBIG5HKSCS);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToHKSCS);
|
|
||||||
|
|
||||||
static const nsModuleComponentInfo components[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "Big5" , NS_UNICODETOBIG5_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "Big5",
|
|
||||||
nsUnicodeToBIG5Constructor,
|
|
||||||
// global converter registration
|
|
||||||
nsUConverterRegSelf, nsUConverterUnregSelf,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-x-big5" , NS_UNICODETOBIG5NOASCII_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-x-big5",
|
|
||||||
nsUnicodeToBIG5NoAsciiConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "Big5" , NS_BIG5TOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "Big5",
|
|
||||||
nsBIG5ToUnicodeConstructor ,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "Big5-HKSCS" , NS_UNICODETOBIG5HKSCS_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "Big5-HKSCS",
|
|
||||||
nsUnicodeToBIG5HKSCSConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "hkscs-1" , NS_UNICODETOHKSCS_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "hkscs-1",
|
|
||||||
nsUnicodeToHKSCSConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "Big5-HKSCS" , NS_BIG5HKSCSTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "Big5-HKSCS",
|
|
||||||
nsBIG5HKSCSToUnicodeConstructor ,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE(nsUCvTWModule, components);
|
|
||||||
|
|
|
@ -1,208 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public License
|
|
||||||
* Version 1.1 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
||||||
* Roy Yokoyama <yokoyama@netscape.com>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nspr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsCRT.h"
|
|
||||||
#include "pratom.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIFactory.h"
|
|
||||||
#include "nsIRegistry.h"
|
|
||||||
#include "nsIGenericFactory.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsICharsetConverterManager.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
#include "nsUCvTW2CID.h"
|
|
||||||
#include "nsUCvTW2Dll.h"
|
|
||||||
|
|
||||||
#include "nsEUCTWToUnicode.h"
|
|
||||||
#include "nsUnicodeToEUCTW.h"
|
|
||||||
#include "nsUnicodeToCNS11643p1.h"
|
|
||||||
#include "nsUnicodeToCNS11643p2.h"
|
|
||||||
#include "nsUnicodeToCNS11643p3.h"
|
|
||||||
#include "nsUnicodeToCNS11643p4.h"
|
|
||||||
#include "nsUnicodeToCNS11643p5.h"
|
|
||||||
#include "nsUnicodeToCNS11643p6.h"
|
|
||||||
#include "nsUnicodeToCNS11643p7.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Global functions and data [declaration]
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
#define DECODER_NAME_BASE "Unicode Decoder-"
|
|
||||||
#define ENCODER_NAME_BASE "Unicode Encoder-"
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS1MappingTable[] = {
|
|
||||||
#include "cns_1.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS2MappingTable[] = {
|
|
||||||
#include "cns_2.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS3MappingTable[] = {
|
|
||||||
#include "cns3.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS4MappingTable[] = {
|
|
||||||
#include "cns4.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS5MappingTable[] = {
|
|
||||||
#include "cns5.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS6MappingTable[] = {
|
|
||||||
#include "cns6.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ufCNS7MappingTable[] = {
|
|
||||||
#include "cns7.uf"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS1MappingTable[] = {
|
|
||||||
#include "cns_1.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS2MappingTable[] = {
|
|
||||||
#include "cns_2.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS3MappingTable[] = {
|
|
||||||
#include "cns3.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS4MappingTable[] = {
|
|
||||||
#include "cns4.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS5MappingTable[] = {
|
|
||||||
#include "cns5.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS6MappingTable[] = {
|
|
||||||
#include "cns6.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_utCNS7MappingTable[] = {
|
|
||||||
#include "cns7.ut"
|
|
||||||
};
|
|
||||||
|
|
||||||
PRUint16 g_ASCIIMappingTable[] = {
|
|
||||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_CONVERTER_REGISTRY_START
|
|
||||||
NS_UCONV_REG_UNREG("x-euc-tw", "Unicode" , NS_EUCTWTOUNICODE_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-euc-tw" , NS_UNICODETOEUCTW_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-1" , NS_UNICODETOCNS11643P1_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-2" , NS_UNICODETOCNS11643P2_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-3" , NS_UNICODETOCNS11643P3_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-4" , NS_UNICODETOCNS11643P4_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-5" , NS_UNICODETOCNS11643P5_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-6" , NS_UNICODETOCNS11643P6_CID)
|
|
||||||
NS_UCONV_REG_UNREG("Unicode", "x-cns-11643-7" , NS_UNICODETOCNS11643P7_CID)
|
|
||||||
NS_CONVERTER_REGISTRY_END
|
|
||||||
|
|
||||||
NS_IMPL_NSUCONVERTERREGSELF
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEUCTWToUnicode);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToEUCTW);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p1);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p2);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p3);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p4);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p5);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p6);
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToCNS11643p7);
|
|
||||||
|
|
||||||
static const nsModuleComponentInfo components[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
DECODER_NAME_BASE "x-euc-tw" , NS_EUCTWTOUNICODE_CID,
|
|
||||||
NS_UNICODEDECODER_CONTRACTID_BASE "x-euc-tw",
|
|
||||||
nsEUCTWToUnicodeConstructor,
|
|
||||||
// global converter registration
|
|
||||||
nsUConverterRegSelf, nsUConverterUnregSelf
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-euc-tw" , NS_UNICODETOEUCTW_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-euc-tw",
|
|
||||||
nsUnicodeToEUCTWConstructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-1" , NS_UNICODETOCNS11643P1_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-1",
|
|
||||||
nsUnicodeToCNS11643p1Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-2" , NS_UNICODETOCNS11643P2_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-2",
|
|
||||||
nsUnicodeToCNS11643p2Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-3" , NS_UNICODETOCNS11643P3_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-3",
|
|
||||||
nsUnicodeToCNS11643p3Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-4" , NS_UNICODETOCNS11643P4_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-4",
|
|
||||||
nsUnicodeToCNS11643p4Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-5" , NS_UNICODETOCNS11643P5_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-5",
|
|
||||||
nsUnicodeToCNS11643p5Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-6" , NS_UNICODETOCNS11643P6_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-6",
|
|
||||||
nsUnicodeToCNS11643p6Constructor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ENCODER_NAME_BASE "x-cns-11643-7" , NS_UNICODETOCNS11643P7_CID,
|
|
||||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-cns-11643-7",
|
|
||||||
nsUnicodeToCNS11643p7Constructor,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE(nsUCvTW2Module, components);
|
|
Загрузка…
Ссылка в новой задаче