commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/lib/classdefs classdata.c gcdparser.c...


From: Neil Tiffin
Subject: gnue/geas/lib/classdefs classdata.c gcdparser.c...
Date: Mon, 04 Jun 2001 09:57:35 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Neil Tiffin <address@hidden>    01/06/04 09:57:34

Modified files:
        geas/lib/classdefs: classdata.c gcdparser.c lparser.h lparser.l 
                            yparser.y 

Log message:
        Add ability to track source file name of modules and classes.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/classdata.c.diff?cvsroot=OldCVS&tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/gcdparser.c.diff?cvsroot=OldCVS&tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/lparser.h.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/lparser.l.diff?cvsroot=OldCVS&tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/yparser.y.diff?cvsroot=OldCVS&tr1=1.30&tr2=1.31&r1=text&r2=text

Patches:
Index: gnue/geas/lib/classdefs/classdata.c
diff -u gnue/geas/lib/classdefs/classdata.c:1.57 
gnue/geas/lib/classdefs/classdata.c:1.58
--- gnue/geas/lib/classdefs/classdata.c:1.57    Mon Jun  4 06:50:11 2001
+++ gnue/geas/lib/classdefs/classdata.c Mon Jun  4 09:57:34 2001
@@ -22,7 +22,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
-   $Id: classdata.c,v 1.57 2001/06/04 13:50:11 ntiffin Exp $
+   $Id: classdata.c,v 1.58 2001/06/04 16:57:34 ntiffin Exp $
    
 */
 
@@ -132,6 +132,7 @@
       indexes = g_list_next (indexes);
       fprintf (out, "\n");
     }
+  fprintf( out, "         filename: %s\n", container->filename);
 }
 
 /* ------------------------------------------------------------------------- *\
@@ -2432,14 +2433,15 @@
   switch (item->base.type)
     {
     case IT_class:
+      if (item->filename != NULL)
+        {
+          fprintf(out, "[%s]", g_basename(((odl_container *)item)->filename));
+        }
       l = item->parents;
       if (l)
         {
           fprintf (out, "\n");
-          for (i = 0; i < indent; i++)
-            {
-              fprintf (out, " ");
-            }
+          for (i = 0; i < indent; i++) fprintf (out, " ");
           fprintf (out, "Parents:");
           while (l)
             {
@@ -2516,8 +2518,12 @@
       fprintf (out, "\n");
       break;
     case IT_module:
-      fprintf (out, "\n");
       l = item->contents;
+      if (item->filename != NULL)
+        {
+          fprintf(out, " [%s]", g_basename(item->filename));
+        }
+      fprintf(out, "\n");
       while (l)
         {
           real_odl_display_tree (out, l->data, indent + INDENT,
Index: gnue/geas/lib/classdefs/gcdparser.c
diff -u gnue/geas/lib/classdefs/gcdparser.c:1.36 
gnue/geas/lib/classdefs/gcdparser.c:1.37
--- gnue/geas/lib/classdefs/gcdparser.c:1.36    Sun May 27 16:00:26 2001
+++ gnue/geas/lib/classdefs/gcdparser.c Mon Jun  4 09:57:34 2001
@@ -22,7 +22,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
-   $Id: gcdparser.c,v 1.36 2001/05/27 23:00:26 ntiffin Exp $
+   $Id: gcdparser.c,v 1.37 2001/06/04 16:57:34 ntiffin Exp $
    
 */
 
@@ -113,6 +113,7 @@
       o->parents = NULL;
       o->indexes = NULL;
       o->orderby = NULL;
+      o->filename = NULL;
     }
   return (o);
 }
Index: gnue/geas/lib/classdefs/lparser.h
diff -u gnue/geas/lib/classdefs/lparser.h:1.3 
gnue/geas/lib/classdefs/lparser.h:1.4
--- gnue/geas/lib/classdefs/lparser.h:1.3       Sun May  6 16:20:42 2001
+++ gnue/geas/lib/classdefs/lparser.h   Mon Jun  4 09:57:34 2001
@@ -19,7 +19,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
-   $Id: lparser.h,v 1.3 2001/05/06 23:20:42 ntiffin Exp $
+   $Id: lparser.h,v 1.4 2001/06/04 16:57:34 ntiffin Exp $
 */
 
 #ifndef LPARSER_Y
@@ -42,6 +42,7 @@
 int yystartfile( char *filename );
 void clear_file_history( );
 void errors_show_file( int state );
+const char * yyget_current_filename( );
 
 extern struct _odl_container *yycurrent_container;
 
Index: gnue/geas/lib/classdefs/lparser.l
diff -u gnue/geas/lib/classdefs/lparser.l:1.23 
gnue/geas/lib/classdefs/lparser.l:1.24
--- gnue/geas/lib/classdefs/lparser.l:1.23      Mon Jun  4 06:50:11 2001
+++ gnue/geas/lib/classdefs/lparser.l   Mon Jun  4 09:57:34 2001
@@ -24,7 +24,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    
-   $Id: lparser.l,v 1.23 2001/06/04 13:50:11 ntiffin Exp $
+   $Id: lparser.l,v 1.24 2001/06/04 16:57:34 ntiffin Exp $
 
 */
 
@@ -501,7 +501,7 @@
   printf("   module name: %s\n", filedata_ptr->modulename);
   printf(" module prefix: %s\n", filedata_ptr->moduleprefix);
   printf("      yybuffer: %p\n", filedata_ptr->yybuffer);
-  printf("         dummy: %s\n", filedata_ptr->dummy);
+  printf("         dummy: %s\n", (char *)filedata_ptr->dummy);
 }
 #endif
 
@@ -553,7 +553,6 @@
       g_free (filename);
       filename = g_strdup (fn);
     }
-
   newfile = fopen (filename, "r");
   if (!newfile)
     {
@@ -571,9 +570,8 @@
       memcpy (tmp, &currentfile, sizeof (struct FileData));
       tmp->next = file_stack;  /* insert the new one */
       file_stack = tmp;
-                             /* copy currentfile -> tmp */
+                              /* copy currentfile -> tmp */
       tmp->yybuffer = YY_CURRENT_BUFFER;
-
       yyin = newfile;
       yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
       g_assert( strlen(filename) < FILEDATA_FILENAME_LENGTH);
@@ -589,7 +587,6 @@
           return (1);
         }
     }
-
   /* out of memory */
   /* printf( "fclose : %08lx\n" , newfile ); */
   fclose (newfile);
@@ -773,6 +770,14 @@
 
   processed_files = NULL;
   /* printf( "freed processed files array\n" ); */
+}
+
+/* ------------------------------------------------------------------------- *\
+ * Return address of the current file name for use by the lexer
+\* ------------------------------------------------------------------------- */
+const char * yyget_current_filename( )
+{
+  return (&currentfile.name[0]);
 }
 
 /* ------------------------------------------------------------------------- *\
Index: gnue/geas/lib/classdefs/yparser.y
diff -u gnue/geas/lib/classdefs/yparser.y:1.30 
gnue/geas/lib/classdefs/yparser.y:1.31
--- gnue/geas/lib/classdefs/yparser.y:1.30      Sun May 27 18:24:07 2001
+++ gnue/geas/lib/classdefs/yparser.y   Mon Jun  4 09:57:34 2001
@@ -99,6 +99,7 @@
                        if( current_pass == 1 ) {
                          odl_module *newone =
                              odl_new_module($<uint>-2,$<string>0);
+                         newone->filename = g_strdup( yyget_current_filename() 
);
                          odl_container_insert_container( yycurrent_container ,
                                                   (odl_container *)newone );
                          newone->base.parent = (odl_base *)yycurrent_container;
@@ -176,6 +177,7 @@
                            newone = odl_new_class($<uint>-4,$<string>0);
                            g_assert( newone );
                            newone->base.parent = (odl_base 
*)yycurrent_container;
+                           newone->filename = g_strdup( 
yyget_current_filename() );
                            /* try to find a class with the same name   */
                            fullname = odl_make_fullname_base( (odl_base*) 
newone );
                            check_class = odl_find_class(yycurrenttree, 
fullname, NULL);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]