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 #ifndef srcpos_INCLUDED 00037 #define srcpos_INCLUDED 00038 00039 #include "config_host.h" /* for HOST_IS_LITTLE_ENDIAN */ 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 /* ==================================================================== 00046 * ==================================================================== 00047 * 00048 * Module: srcpos.h 00049 * $Revision: 1.1.1.1 $ 00050 * $Date: 2005/10/21 19:00:00 $ 00051 * $Author: marcel $ 00052 * $Source: /proj/osprey/CVS/open64/osprey1.0/common/com/srcpos.h,v $ 00053 * 00054 * Description: 00055 * 00056 * Description of the various fields in the source position structure. 00057 * 00058 * ==================================================================== 00059 */ 00060 00061 00062 /* SRCPOS is defined as a 64bit unsigned integer. This is the declaration 00063 * visible to most files. Defining it this way allows existing calls that 00064 * pass a INT32 line number to still compile fine. The prototype will 00065 * automatically do the conversion from INT32 to the SRCPOS type. The 00066 * value of the linenum field is still valid, since it is the lower 00067 * 32bits of the source_position structure. 00068 */ 00069 00070 typedef mUINT64 SRCPOS; 00071 00072 00073 /* The following struct, the union and with SRCPOS and the macros are 00074 * for use by routines that need to setup or access the individual 00075 * fields of the source position descriptor. 00076 */ 00077 struct srcpos_struct { 00078 mUINT16 filenum; 00079 mUINT16 column : 12; 00080 mUINT16 stmt_begin : 1; 00081 mUINT16 bb_begin : 1; 00082 mUINT16 unused : 2; 00083 mINT32 linenum; 00084 }; 00085 #define SRC_POS_SIZE 2 /* 2 * sizeof(mINT32) */ 00086 00087 typedef union source_position { 00088 SRCPOS srcpos; 00089 struct srcpos_struct t; 00090 mINT32 fillers[SRC_POS_SIZE]; 00091 } USRCPOS; 00092 00093 #define CHECK_SIZE_CONSISTENCY(s) check_assertion(sizeof(s) == (SRC_POS_SIZE*sizeof(INT32))) 00094 #define USRCPOS_clear(s) ((s).fillers[0] = 0,(s).fillers[1] = 0) 00095 00096 #define USRCPOS_srcpos(s) ((s).srcpos) 00097 #define USRCPOS_filenum(s) ((s).t.filenum) 00098 #define USRCPOS_column(s) ((s).t.column) 00099 #define USRCPOS_stmt_begin(s) ((s).t.stmt_begin) 00100 #define USRCPOS_bb_begin(s) ((s).t.bb_begin) 00101 #define USRCPOS_linenum(s) ((s).t.linenum) 00102 00103 #define SRCPOS_clear(s) ((s) = 0) 00104 #define SRCPOS_filenum(s) (((USRCPOS *)&(s))->t.filenum) 00105 #define SRCPOS_column(s) (((USRCPOS *)&(s))->t.column) 00106 #define SRCPOS_stmt_begin(s) (((USRCPOS *)&(s))->t.stmt_begin) 00107 #define SRCPOS_bb_begin(s) (((USRCPOS *)&(s))->t.bb_begin) 00108 #define SRCPOS_linenum(s) (((USRCPOS *)&(s))->t.linenum) 00109 00110 #if HOST_IS_LITTLE_ENDIAN 00111 #define Srcpos_To_Line(s) ((mINT32)((s)>>32)) 00112 #else 00113 #define Srcpos_To_Line(s) ((mINT32)(s)) 00114 #endif /* HOST_IS_LITTLE_ENDIAN */ 00115 00116 #ifdef __cplusplus 00117 } 00118 #endif 00119 #endif /* srcpos_INCLUDED */
1.5.6