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 /* ======================================================================= 00037 * ======================================================================= 00038 * 00039 * Module: note.c 00040 * $Revision: 1.2 $ 00041 * $Date: 02/11/07 23:41:27-00:00 $ 00042 * $Author: fchow@keyresearch.com $ 00043 * $Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/SCCS/s.note.cxx $ 00044 * 00045 * Revision comments: 00046 * 00047 * 8-Mar-1994 - Initial version 00048 * 00049 * Description: 00050 * ============ 00051 * 00052 * Compiler to user note implementation. 00053 * 00054 * ======================================================================= 00055 * ======================================================================= 00056 */ 00057 00058 00059 #include "defs.h" 00060 #include "config.h" 00061 #include "tracing.h" 00062 #include "erglob.h" 00063 00064 #include "tn.h" 00065 #include "bb.h" 00066 #include "op.h" 00067 00068 #include "note.h" 00069 00070 /* ======================================================================= 00071 * 00072 * NOTE_Add_To_BB 00073 * 00074 * See interface description. 00075 * 00076 * ======================================================================= 00077 */ 00078 void 00079 NOTE_Add_To_BB( 00080 BB *bb, 00081 NOTE_HANDLER handler, 00082 NOTE_INFO *info 00083 ) 00084 { 00085 NOTE *comment = TYPE_MEM_POOL_ALLOC(NOTE,&MEM_pu_pool); 00086 NOTE_handler(comment) = handler; 00087 NOTE_info(comment) = info; 00088 BB_Add_Annotation (bb, ANNOT_NOTE, comment); 00089 } 00090 00091 00092 /* ======================================================================= 00093 * 00094 * NOTE_BB_Act 00095 * 00096 * See interface description. 00097 * 00098 * ======================================================================= 00099 */ 00100 void 00101 NOTE_BB_Act( 00102 BB *bb, 00103 NOTE_ACTION action, 00104 FILE *file 00105 ) 00106 { 00107 ANNOTATION *ant; 00108 00109 for (ant = ANNOT_First (BB_annotations(bb), ANNOT_NOTE); 00110 ant != NULL; 00111 ant = ANNOT_Next (ant, ANNOT_NOTE)) 00112 { 00113 NOTE_ACT(ANNOT_note(ant), action, file); 00114 } 00115 } 00116 00117 00118 /* ======================================================================= 00119 * 00120 * NOTE_Retrieve_Note_For_Handler 00121 * 00122 * See interface description. 00123 * 00124 * ======================================================================= 00125 */ 00126 NOTE_INFO * 00127 NOTE_Retrieve_Note_For_Handler( 00128 BB *bb, 00129 NOTE_HANDLER handler 00130 ) 00131 { 00132 ANNOTATION *ant; 00133 00134 for (ant = ANNOT_First (BB_annotations(bb), ANNOT_NOTE); 00135 ant != NULL; 00136 ant = ANNOT_Next (ant, ANNOT_NOTE)) 00137 { 00138 if (NOTE_handler(ANNOT_note(ant)) == handler) 00139 return NOTE_info(ANNOT_note(ant)); 00140 } 00141 return NULL; 00142 }
1.5.6