/home/archives/ucsd-psystem-xc/branch.0/branch.0/delta27403.167/lib/symbol.h

Go to the documentation of this file.
00001 //
00002 // UCSD p-System cross compiler
00003 // Copyright (C) 2006 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or (at
00008 // you option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
00018 // USA
00019 //
00020 
00021 #ifndef LIB_SYMBOL_H
00022 #define LIB_SYMBOL_H
00023 
00024 #include <lib/bit_address.h>
00025 #include <lib/location.h>
00026 #include <lib/rcstring.h>
00027 #include <lib/type.h>
00028 
00029 class variable_name; // forward
00030 
00035 class symbol
00036 {
00037 public:
00041     virtual ~symbol();
00042 
00056     symbol(const variable_name &name, const type::pointer &typ,
00057         int lex_level);
00058 
00072     symbol(const rcstring &name, const type::pointer &typ, int lex_level);
00073 
00077     rcstring get_name() const { return name; }
00078 
00084     type::pointer get_type() const { return type; }
00085 
00090     const bit_address &get_bit_offset() const { return bit_offset; }
00091 
00103     void set_bit_offset(const bit_address &boff, bool pkd);
00104 
00110     virtual unsigned get_size_in_bytes() const;
00111 
00117     virtual unsigned get_size_in_bits() const;
00118 
00124     void add_reference(const rcstring &name);
00125 
00131     virtual void add_reference(const variable_name &name);
00132 
00137     int get_lex_level() const { return lex_level; }
00138 
00143     const location &get_declaration_location() const { return locn; }
00144 
00149     bool is_packed() const;
00150 
00155     virtual void type_late_binding();
00156 
00162     virtual void check_defined();
00163 
00164 protected:
00174     void change_type(const type::pointer &tsp);
00175 
00176 private:
00181     rcstring name;
00182 
00187     location locn;
00188 
00194     type::pointer type;
00195 
00200     bit_address bit_offset;
00201 
00206     bool packed;
00207 
00214     int lex_level;
00215 
00219     symbol();
00220 
00224     symbol(const symbol &);
00225 
00229     symbol &operator=(const symbol &);
00230 };
00231 
00232 #endif // LIB_SYMBOL_H

Generated on Sun Feb 25 01:27:10 2007 for UCSDp-SystemCrossCompiler by  doxygen 1.5.1