Back to index

lightning-sunbird  0.9+nobinonly
nsUCvMathModule.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Roger B. Sidje <rbs@maths.uq.edu.au>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "pratom.h"
00040 #include "nspr.h"
00041 #include "nsString.h"
00042 #include "nsCOMPtr.h"
00043 #include "nsIFactory.h"
00044 #include "nsIGenericFactory.h"
00045 #include "nsIServiceManager.h"
00046 #include "nsICharsetConverterManager.h"
00047 #include "nsICategoryManager.h"
00048 #include "nsEncoderDecoderUtils.h"
00049 #include "nsIModule.h"
00050 #include "nsUCvMathCID.h"
00051 #include "nsUCvMathDll.h"
00052 #include "nsCRT.h"
00053 
00054 #include "nsUnicodeToTeXCMRttf.h"
00055 #include "nsUnicodeToTeXCMMIttf.h"
00056 #include "nsUnicodeToTeXCMSYttf.h"
00057 #include "nsUnicodeToTeXCMEXttf.h"
00058 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
00059 #include "nsUnicodeToTeXCMRt1.h"
00060 #include "nsUnicodeToTeXCMMIt1.h"
00061 #include "nsUnicodeToTeXCMSYt1.h"
00062 #include "nsUnicodeToTeXCMEXt1.h"
00063 #endif
00064 #include "nsUnicodeToMathematica1.h"
00065 #include "nsUnicodeToMathematica2.h"
00066 #include "nsUnicodeToMathematica3.h"
00067 #include "nsUnicodeToMathematica4.h"
00068 #include "nsUnicodeToMathematica5.h"
00069 #include "nsUnicodeToMTExtra.h"
00070 
00071 //----------------------------------------------------------------------------
00072 // Global functions and data [declaration]
00073 
00074 #define DECODER_NAME_BASE "Unicode Decoder-"
00075 #define ENCODER_NAME_BASE "Unicode Encoder-"
00076 
00077 NS_CONVERTER_REGISTRY_START
00078 
00079 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmr",   NS_UNICODETOTEXCMRTTF_CID)
00080 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmmi",  NS_UNICODETOTEXCMMITTF_CID)
00081 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmsy",  NS_UNICODETOTEXCMSYTTF_CID)
00082 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmex",  NS_UNICODETOTEXCMEXTTF_CID)
00083 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
00084 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmr",   NS_UNICODETOTEXCMRT1_CID)
00085 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmmi",  NS_UNICODETOTEXCMMIT1_CID)
00086 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmsy",  NS_UNICODETOTEXCMSYT1_CID)
00087 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmex",  NS_UNICODETOTEXCMEXT1_CID)
00088 #endif
00089 NS_UCONV_REG_UNREG_ENCODER("x-mathematica1",  NS_UNICODETOMATHEMATICA1_CID)
00090 NS_UCONV_REG_UNREG_ENCODER("x-mathematica2",  NS_UNICODETOMATHEMATICA2_CID)
00091 NS_UCONV_REG_UNREG_ENCODER("x-mathematica3",  NS_UNICODETOMATHEMATICA3_CID)
00092 NS_UCONV_REG_UNREG_ENCODER("x-mathematica4",  NS_UNICODETOMATHEMATICA4_CID)
00093 NS_UCONV_REG_UNREG_ENCODER("x-mathematica5",  NS_UNICODETOMATHEMATICA5_CID)
00094 NS_UCONV_REG_UNREG_ENCODER("x-mtextra",  NS_UNICODETOMTEXTRA_CID)
00095 
00096 NS_CONVERTER_REGISTRY_END
00097 
00098 NS_IMPL_NSUCONVERTERREGSELF
00099 
00100 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMRttf)
00101 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMMIttf)
00102 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMSYttf)
00103 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMEXttf)
00104 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
00105 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMRt1)
00106 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMMIt1)
00107 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMSYt1)
00108 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMEXt1)
00109 #endif
00110 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica1)
00111 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica2)
00112 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica3)
00113 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica4)
00114 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica5)
00115 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMTExtra)
00116 
00117 static const nsModuleComponentInfo components[] = 
00118 {
00119   { 
00120     ENCODER_NAME_BASE "x-ttf-cmr" , NS_UNICODETOTEXCMRTTF_CID, 
00121     NS_UNICODEENCODER_CONTRACTID_BASE "x-ttf-cmr",
00122     nsUnicodeToTeXCMRttfConstructor, 
00123   },
00124   { 
00125     ENCODER_NAME_BASE "x-ttf-cmmi" , NS_UNICODETOTEXCMMITTF_CID, 
00126     NS_UNICODEENCODER_CONTRACTID_BASE "x-ttf-cmmi",
00127     nsUnicodeToTeXCMMIttfConstructor, 
00128   },
00129   { 
00130     ENCODER_NAME_BASE "x-ttf-cmsy" , NS_UNICODETOTEXCMSYTTF_CID, 
00131     NS_UNICODEENCODER_CONTRACTID_BASE "x-ttf-cmsy",
00132     nsUnicodeToTeXCMSYttfConstructor, 
00133   },
00134   { 
00135     ENCODER_NAME_BASE "x-ttf-cmex" , NS_UNICODETOTEXCMEXTTF_CID, 
00136     NS_UNICODEENCODER_CONTRACTID_BASE "x-ttf-cmex",
00137     nsUnicodeToTeXCMEXttfConstructor, 
00138   },
00139 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
00140   { 
00141     ENCODER_NAME_BASE "x-t1-cmr" , NS_UNICODETOTEXCMRT1_CID, 
00142     NS_UNICODEENCODER_CONTRACTID_BASE "x-t1-cmr",
00143     nsUnicodeToTeXCMRt1Constructor, 
00144   },
00145   { 
00146     ENCODER_NAME_BASE "x-t1-cmmi" , NS_UNICODETOTEXCMMIT1_CID, 
00147     NS_UNICODEENCODER_CONTRACTID_BASE "x-t1-cmmi",
00148     nsUnicodeToTeXCMMIt1Constructor, 
00149   },
00150   { 
00151     ENCODER_NAME_BASE "x-t1-cmsy" , NS_UNICODETOTEXCMSYT1_CID, 
00152     NS_UNICODEENCODER_CONTRACTID_BASE "x-t1-cmsy",
00153     nsUnicodeToTeXCMSYt1Constructor, 
00154   },
00155   { 
00156     ENCODER_NAME_BASE "x-t1-cmex" , NS_UNICODETOTEXCMEXT1_CID, 
00157     NS_UNICODEENCODER_CONTRACTID_BASE "x-t1-cmex",
00158     nsUnicodeToTeXCMEXt1Constructor, 
00159   },
00160 #endif
00161   { 
00162     ENCODER_NAME_BASE "x-mathematica1" , NS_UNICODETOMATHEMATICA1_CID, 
00163     NS_UNICODEENCODER_CONTRACTID_BASE "x-mathematica1",
00164     nsUnicodeToMathematica1Constructor, 
00165     nsUConverterRegSelf, nsUConverterUnregSelf,
00166   },
00167   { 
00168     ENCODER_NAME_BASE "x-mathematica2" , NS_UNICODETOMATHEMATICA2_CID, 
00169     NS_UNICODEENCODER_CONTRACTID_BASE "x-mathematica2",
00170     nsUnicodeToMathematica2Constructor, 
00171   },
00172   { 
00173     ENCODER_NAME_BASE "x-mathematica3" , NS_UNICODETOMATHEMATICA3_CID, 
00174     NS_UNICODEENCODER_CONTRACTID_BASE "x-mathematica3",
00175     nsUnicodeToMathematica3Constructor, 
00176   },
00177   { 
00178     ENCODER_NAME_BASE "x-mathematica4" , NS_UNICODETOMATHEMATICA4_CID, 
00179     NS_UNICODEENCODER_CONTRACTID_BASE "x-mathematica4",
00180     nsUnicodeToMathematica4Constructor, 
00181   },
00182   { 
00183     ENCODER_NAME_BASE "x-mathematica5" , NS_UNICODETOMATHEMATICA5_CID, 
00184     NS_UNICODEENCODER_CONTRACTID_BASE "x-mathematica5",
00185     nsUnicodeToMathematica5Constructor, 
00186   },
00187   { 
00188     ENCODER_NAME_BASE "x-mtextra" , NS_UNICODETOMTEXTRA_CID, 
00189     NS_UNICODEENCODER_CONTRACTID_BASE "x-mtextra",
00190     nsUnicodeToMTExtraConstructor, 
00191   }
00192 };
00193 
00194 NS_IMPL_NSGETMODULE(nsUCvMathModule, components)
00195