00001 /* Write cross reference information extracted from Java(TM) 00002 source and bytecode files, in one of formats documented below. 00003 Copyright (C) 1999, 2000 Free Software Foundation, Inc. 00004 Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) 00005 00006 This file is part of GNU CC. 00007 00008 GNU CC is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2, or (at your option) 00011 any later version. 00012 00013 GNU CC is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with GNU CC; see the file COPYING. If not, write to 00020 the Free Software Foundation, 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. 00022 00023 Java and all Java-based marks are trademarks or registered trademarks 00024 of Sun Microsystems, Inc. in the United States and other countries. 00025 The Free Software Foundation is independent of Sun Microsystems, Inc. */ 00026 00027 #include "config.h" 00028 #include "system.h" 00029 #include "tree.h" 00030 #include "java-tree.h" 00031 #include "xref.h" 00032 #include "jcf.h" 00033 #include "parse.h" 00034 #include "obstack.h" 00035 00036 00037 static xref_flag_table xref_table [] = { 00038 {NULL, NULL, NULL, NULL}, 00039 }; 00040 00041 /* Decode an xref flag value. Return 0 if the flag wasn't found. */ 00042 00043 int 00044 xref_flag_value (flag) 00045 const char *flag; 00046 { 00047 int i; 00048 for (i = 0; xref_table [i].key; i++) 00049 if (!strcmp (flag, xref_table [i].key)) 00050 return i+1; 00051 return 0; 00052 } 00053 00054 void 00055 xref_set_data (flag, data) 00056 int flag; 00057 void *data; 00058 { 00059 xref_table [flag-1].data = data; 00060 } 00061 00062 void * 00063 xref_get_data (flag) 00064 int flag; 00065 { 00066 return xref_table [flag-1].data; 00067 } 00068 00069 void 00070 xref_set_current_fp (fp) 00071 FILE *fp; 00072 { 00073 xref_table [flag_emit_xref-1].fp = fp; 00074 } 00075 00076 /* Branch to the right xref "back-end". */ 00077 00078 void 00079 expand_xref (node) 00080 tree node; 00081 { 00082 /* Maintain these two cached. */ 00083 static FILE *fp = NULL; 00084 static void (*current_expand) PARAMS ((FILE *, tree)) = NULL; 00085 00086 if ( !flag_emit_xref ) 00087 return; 00088 00089 if (!fp) 00090 fp = xref_table [flag_emit_xref-1].fp; 00091 if (!current_expand) 00092 current_expand = xref_table [flag_emit_xref-1].expand; 00093 00094 (*current_expand) (fp, node); 00095 } 00096 00097 /* Implementation of the xref back-ends. */ 00098
1.5.6