Special.hxx

Go to the documentation of this file.
00001 #ifndef SPECIAL_HXX
00002 #define SPECIAL_HXX
00003 
00004 /**************************************************************************
00005  *
00006  * Copyright (C) 2008, Johns Hopkins University.
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or
00010  * without modification, are permitted provided that the following
00011  * conditions are met:
00012  *
00013  *   - Redistributions of source code must contain the above 
00014  *     copyright notice, this list of conditions, and the following
00015  *     disclaimer. 
00016  *
00017  *   - Redistributions in binary form must reproduce the above
00018  *     copyright notice, this list of conditions, and the following
00019  *     disclaimer in the documentation and/or other materials 
00020  *     provided with the distribution.
00021  *
00022  *   - Neither the names of the copyright holders nor the names of any
00023  *     of any contributors may be used to endorse or promote products
00024  *     derived from this software without specific prior written
00025  *     permission. 
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00028  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00029  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00030  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00031  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00032  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00033  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00034  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00035  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00036  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  **************************************************************************/
00040 
00041 #include <string>
00042 #include "shared_ptr.hxx"
00043 
00044 #include "AST.hxx"
00045 #include "Type.hxx"
00046 #include "UocInfo.hxx"
00047 
00048 /* Structure that is used by the specializer */
00049 struct spStruct {  
00050   boost::shared_ptr<AST> ast; 
00051   boost::shared_ptr<Type> typ;
00052   bool lifted;
00053 
00054   spStruct(boost::shared_ptr<AST> _ast, boost::shared_ptr<Type> _typ)
00055   {
00056     typ = _typ;
00057     ast = _ast;
00058     lifted = false;
00059   }
00060 };
00061  
00062 /* Structure to hold the names of certain Special ASTs that are
00063    mostly part of the prelude. They are needed by the
00064    type inference engine. They are stored here because will
00065    otherwise become unidentifiable after the name-mangling phase. */
00066 
00067 /* I am not superimpressed with this structure, Once a better method
00068    is obtained, THIS SRUCTURE IS VERY LIKELY TO GO AWAY */
00069 
00070 enum SpNameId {
00071   SP_NAME_INTEGER           = 0x1u,
00072   SP_NAME_FP                = 0x2u,
00073   SP_NAME_IOB               = 0x3u,
00074   SP_NAME_LT                = 0x4u,
00075   SP_NAME_REF_TYPES         = 0x5u,
00076   SP_NAME_COPY_COMPAT       = 0x6u,
00077   SP_NAME_COPY_FROM_TO      = 0x7u,
00078   SP_NAME_HAS_FIELD         = 0x8u,
00079 };
00080 
00081 struct SpecialNames {
00082   std::string sp_integral;
00083   std::string sp_fp;
00084   std::string sp_iob;
00085   std::string sp_lt;
00086   std::string sp_ref_types;
00087   std::string sp_copy_compat;
00088   std::string sp_copy_from_to;
00089   std::string sp_has_field;
00090 
00091   SpecialNames();
00092   std::string getSpName(SpNameId name);
00093   void fixUpSpNames(boost::shared_ptr<UocInfo> prelude);
00094   static SpecialNames spNames;
00095 };
00096 
00097 #endif /* SPECIAL_HXX */

Generated on Thu May 17 23:59:16 2012 for BitC Compiler by  doxygen 1.4.7