Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 /* -*-Mode: c++;-*- (Tell emacs to use c++ mode) */ 00037 #ifndef anl_srcpos_INCLUDED 00038 #define anl_srcpos_INCLUDED 00039 00040 // ============================================================== 00041 // ============================================================== 00042 // 00043 // 00044 // Description: 00045 // 00046 // An object oriented interface to srcpos utilities. Note that 00047 // all relational comparison operators return FALSE for different 00048 // Filenum(), since we assume no order between files. 00049 // 00050 // ============================================================== 00051 // ============================================================== 00052 00053 #include "srcpos.h" 00054 00055 class ANL_SRCPOS 00056 { 00057 private: 00058 00059 USRCPOS _usrcpos; 00060 00061 public: 00062 00063 // ============== Constructors & Destructors ============== 00064 00065 ANL_SRCPOS() {USRCPOS_srcpos(_usrcpos) = 0;} 00066 ANL_SRCPOS(SRCPOS srcpos) {USRCPOS_srcpos(_usrcpos) = srcpos;} 00067 ANL_SRCPOS(WN *stmt) 00068 { 00069 if (stmt == NULL) 00070 USRCPOS_srcpos(_usrcpos) = 0; 00071 else 00072 USRCPOS_srcpos(_usrcpos) = WN_linenum(stmt); 00073 } 00074 00075 00076 // =============== Accessors =============== 00077 00078 INT32 Filenum() const {return USRCPOS_filenum(_usrcpos);} 00079 INT32 Linenum() const {return USRCPOS_linenum(_usrcpos);} 00080 INT32 Column() const {return USRCPOS_column(_usrcpos);} 00081 00082 00083 // =============== Writing to string buffer =============== 00084 00085 void Write(ANL_CBUF *cbuf); 00086 void Write_Filenum(ANL_CBUF *cbuf) const {cbuf->Write_Int(Filenum());} 00087 void Write_Linenum(ANL_CBUF *cbuf) const {cbuf->Write_Int(Linenum());} 00088 void Write_Column(ANL_CBUF *cbuf) const {cbuf->Write_Int(Column());} 00089 00090 00091 // =============== Assignment Operators =============== 00092 00093 ANL_SRCPOS &operator=(const ANL_SRCPOS &s) 00094 { 00095 _usrcpos.srcpos = s._usrcpos.srcpos; 00096 return *this; 00097 } 00098 ANL_SRCPOS &operator+=(INT32 lineincr) 00099 { 00100 USRCPOS_linenum(_usrcpos) += lineincr; 00101 return *this; 00102 } 00103 ANL_SRCPOS &operator-=(INT32 linedecr) 00104 { 00105 USRCPOS_linenum(_usrcpos) -= linedecr; 00106 return *this; 00107 } 00108 00109 // =============== Comparison Operators =============== 00110 00111 00112 BOOL operator==(const ANL_SRCPOS &s) 00113 { 00114 return s._usrcpos.srcpos == _usrcpos.srcpos; 00115 } 00116 BOOL operator!=(const ANL_SRCPOS &s) 00117 { 00118 return s._usrcpos.srcpos == _usrcpos.srcpos; 00119 } 00120 BOOL operator<(const ANL_SRCPOS &s); 00121 BOOL operator<=(const ANL_SRCPOS &s); 00122 BOOL operator>(const ANL_SRCPOS &s); 00123 BOOL operator>=(const ANL_SRCPOS &s); 00124 00125 }; // class ANL_SRCPOS 00126 00127 #endif // anl_srcpos_INCLUDED