This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH RFA] Pascal language part 2.



  This is the second part of pascal language support
(it does not close the long list of changes I made for it !)

  Could someone please try this on some other target that cygwin?
(it should not give any problems as there is no 
target specific code at all !)

ChangeLog:
    * defs.h: define language_pascal in language enumeration.
    * language.h: define _LANG_pascal macro.
    * language.c: add language_pascal support in all language dependant
functions.
    * Makefile.in: add rules and dependencies for the new pascal files.
    *  symfile.c: add ".pas", ".p", ".pp" and ".inc" as default pascal
extensions.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.25
diff -c -r1.25 defs.h
*** defs.h	2000/06/07 04:43:30	1.25
--- defs.h	2000/06/14 13:09:43
***************
*** 196,202 ****
      language_fortran,		/* Fortran */
      language_m2,		/* Modula-2 */
      language_asm,		/* Assembly language */
!     language_scm		/* Scheme / Guile */
    };
  
  enum precision_type
--- 196,203 ----
      language_fortran,		/* Fortran */
      language_m2,		/* Modula-2 */
      language_asm,		/* Assembly language */
!     language_scm,    		/* Scheme / Guile */
!     language_pascal		/* Pascal */
    };
  
  enum precision_type
Index: language.h
===================================================================
RCS file: /cvs/src/src/gdb/language.h,v
retrieving revision 1.4
diff -c -r1.4 language.h
*** language.h	2000/06/04 00:41:09	1.4
--- language.h	2000/06/14 13:09:44
***************
*** 35,41 ****
  #define	_LANG_c
  #define	_LANG_m2
  #define	_LANG_chill
! #define _LANG_fortran
  
  #define MAX_FORTRAN_DIMS  7	/* Maximum number of F77 array dims */
  
--- 35,42 ----
  #define	_LANG_c
  #define	_LANG_m2
  #define	_LANG_chill
! #define  _LANG_fortran
! #define  _LANG_pascal
  
  #define MAX_FORTRAN_DIMS  7	/* Maximum number of F77 array dims */
  
Index: language.c
===================================================================
RCS file: /cvs/src/src/gdb/language.c,v
retrieving revision 1.5
diff -c -r1.5 language.c
*** language.c	2000/05/28 01:12:28	1.5
--- language.c	2000/06/14 13:09:44
***************
*** 814,819 ****
--- 814,820 ----
        return (TYPE_CODE (type) != TYPE_CODE_INT) &&
  	(TYPE_CODE (type) != TYPE_CODE_ENUM) ? 0 : 1;
      case language_m2:
+     case language_pascal:
        return TYPE_CODE (type) != TYPE_CODE_INT ? 0 : 1;
      case language_chill:
        error ("Missing Chill support in function integral_type.");	/*FIXME */
***************
*** 849,854 ****
--- 850,856 ----
      {
      case language_chill:
      case language_m2:
+     case language_pascal:
        return TYPE_CODE (type) != TYPE_CODE_CHAR ? 0 : 1;
  
      case language_c:
***************
*** 871,876 ****
--- 873,879 ----
      {
      case language_chill:
      case language_m2:
+     case language_pascal:
        return TYPE_CODE (type) != TYPE_CODE_STRING ? 0 : 1;
  
      case language_c:
***************
*** 935,940 ****
--- 938,948 ----
        return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
  	(TYPE_CODE (type) == TYPE_CODE_UNION) ||
  	(TYPE_CODE (type) == TYPE_CODE_ARRAY);
+    case language_pascal:
+       return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
+ 	 (TYPE_CODE(type) == TYPE_CODE_UNION) ||
+ 	 (TYPE_CODE(type) == TYPE_CODE_SET) ||
+ 	    (TYPE_CODE(type) == TYPE_CODE_ARRAY);
      case language_m2:
        return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
  	(TYPE_CODE (type) == TYPE_CODE_SET) ||
***************
*** 966,972 ****
  	}
        return builtin_type_f_logical_s2;
      case language_cplus:
!       sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);
        if (sym)
  	{
  	  type = SYMBOL_TYPE (sym);
--- 974,984 ----
  	}
        return builtin_type_f_logical_s2;
      case language_cplus:
!     case language_pascal:
!       if (current_language->la_language==language_cplus)
!         {sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);}
!       else
!         {sym = lookup_symbol ("boolean", NULL, VAR_NAMESPACE, NULL, NULL);}
        if (sym)
  	{
  	  type = SYMBOL_TYPE (sym);
***************
*** 1158,1163 ****
--- 1170,1190 ----
  		type_op_error ("Arguments to %s must be of integral type.", op);
  	      break;
  	    }
+ #endif
+ 
+ #ifdef _LANG_pascal
+       case language_pascal:
+ 	 switch(op)
+ 	 {
+ 	 case BINOP_DIV:
+ 	    if (!float_type(t1) && !float_type(t2))
+ 	       type_op_error ("Arguments to %s must be floating point
numbers.",op);
+ 	    break;
+ 	 case BINOP_INTDIV:
+ 	    if (!integral_type(t1) || !integral_type(t2))
+ 	       type_op_error ("Arguments to %s must be of integral type.",op);
+ 	    break;
+ 	 }
  #endif
  
  #ifdef _LANG_chill
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.35
diff -c -r1.35 Makefile.in
*** Makefile.in	2000/06/12 06:09:04	1.35
--- Makefile.in	2000/06/14 13:09:48
***************
*** 487,493 ****
  	varobj.c wrapper.c \
  	jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
  	m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
! 	mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c parse.c \
  	printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
  	scm-valprint.c source.c stabsread.c stack.c symfile.c \
  	symmisc.c symtab.c target.c thread.c top.c tracepoint.c \
--- 487,494 ----
  	varobj.c wrapper.c \
  	jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
  	m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
! 	mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \
! 	p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \
  	printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
  	scm-valprint.c source.c stabsread.c stack.c symfile.c \
  	symmisc.c symtab.c target.c thread.c top.c tracepoint.c \
***************
*** 576,582 ****
  	symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \
  	c-lang.h ch-lang.h f-lang.h \
  	jv-lang.h \
! 	m2-lang.h \
  	complaints.h valprint.h \
  	29k-share/udi/udiids.h 29k-share/udi_soc nindy-share/b.out.h \
  	nindy-share/block_io.h nindy-share/coff.h \
--- 577,583 ----
  	symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \
  	c-lang.h ch-lang.h f-lang.h \
  	jv-lang.h \
! 	m2-lang.h  p-lang.h \
  	complaints.h valprint.h \
  	29k-share/udi/udiids.h 29k-share/udi_soc nindy-share/b.out.h \
  	nindy-share/block_io.h nindy-share/coff.h \
***************
*** 630,636 ****
  	ui-out.o cli-out.o \
  	varobj.o wrapper.o \
  	jv-lang.o jv-valprint.o jv-typeprint.o \
! 	m2-lang.o \
  	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \
  	c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \
  	c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \
--- 631,637 ----
  	ui-out.o cli-out.o \
  	varobj.o wrapper.o \
  	jv-lang.o jv-valprint.o jv-typeprint.o \
!  	m2-lang.o p-lang.o p-typeprint.o p-valprint.o \
  	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \
  	c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \
  	c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \
***************
*** 650,659 ****
  # For now, shortcut the "configure GDB for fewer languages" stuff.
  YYFILES = c-exp.tab.c \
  	jv-exp.tab.c \
! 	f-exp.tab.c m2-exp.tab.c
  YYOBJ = c-exp.tab.o \
  	jv-exp.tab.o \
! 	f-exp.tab.o m2-exp.tab.o
  
  # Things which need to be built when making a distribution.
  
--- 651,660 ----
  # For now, shortcut the "configure GDB for fewer languages" stuff.
  YYFILES = c-exp.tab.c \
  	jv-exp.tab.c \
! 	f-exp.tab.c m2-exp.tab.c p-exp.tab.c
  YYOBJ = c-exp.tab.o \
  	jv-exp.tab.o \
! 	f-exp.tab.o m2-exp.tab.o p-exp.tab.o
  
  # Things which need to be built when making a distribution.
  
***************
*** 801,811 ****
--- 802,814 ----
  	#unload $(srcdir)/c-exp.y
  	#unload $(srcdir)/jv-exp.y
  	#unload $(srcdir)/m2-exp.y
+ 	#unload $(srcdir)/p-exp.y
  	#unload vx-share/*.h
  	#unload nindy-share/[A-Z]*
  	#load c-exp.tab.c
  	#load jv-exp.tab.c
  	#load m2-exp.tab.c
+ 	#load p-exp.tab.c
  	#load copying.c version.c
  	#load ../opcodes/libopcodes.a
  	#load ../libiberty/libiberty.a
***************
*** 898,904 ****
  	@echo "it deletes files that may require special tools to rebuild."
  	rm -f c-exp.tab.c \
  		jv-exp.tab \
! 		f-exp.tab.c m2-exp.tab.c
  	rm -f TAGS $(INFOFILES)
  	rm -f $(YYFILES)
  	rm -f nm.h tm.h xm.h config.status
--- 901,907 ----
  	@echo "it deletes files that may require special tools to rebuild."
  	rm -f c-exp.tab.c \
  		jv-exp.tab \
! 		f-exp.tab.c m2-exp.tab.c p-exp.tab.c
  	rm -f TAGS $(INFOFILES)
  	rm -f $(YYFILES)
  	rm -f nm.h tm.h xm.h config.status
***************
*** 1032,1040 ****
  	-rm m2-exp.tmp
  	mv m2-exp.new ./m2-exp.tab.c
  
  # These files are updated atomically, so make never has to remove them
  .PRECIOUS: m2-exp.tab.c f-exp.tab.c c-exp.tab.c
! .PRECIOUS: jv-exp.tab.c
  
  lint: $(LINTFILES)
  	$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
--- 1035,1061 ----
  	-rm m2-exp.tmp
  	mv m2-exp.new ./m2-exp.tab.c
  
+ # p-exp.tab.c is generated in objdir from p-exp.y if it doesn't exist
+ # in srcdir, then compiled in objdir to p-exp.tab.o.
+ # Remove bogus decls for malloc/realloc/free which conflict with everything
+ # else.
+ p-exp.tab.o: p-exp.tab.c
+ p-exp.tab.c: p-exp.y
+ 	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/p-exp.y  y.tab.c p-exp.tmp --
$(YFLAGS)
+ 	-sed -e '/extern.*malloc/d' \
+ 	     -e '/extern.*realloc/d' \
+ 	     -e '/extern.*free/d' \
+ 	     -e '/include.*malloc.h/d' \
+ 	     -e 's/malloc/xmalloc/g' \
+ 	     -e 's/realloc/xrealloc/g' \
+ 	     -e '/^#line.*y.tab.c/d' \
+ 	  < p-exp.tmp > p-exp.new
+ 	-rm p-exp.tmp
+ 	mv p-exp.new ./p-exp.tab.c
+ 
  # These files are updated atomically, so make never has to remove them
  .PRECIOUS: m2-exp.tab.c f-exp.tab.c c-exp.tab.c
! .PRECIOUS: jv-exp.tab.c p-exp.tab.c
  
  lint: $(LINTFILES)
  	$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
***************
*** 1504,1509 ****
--- 1525,1540 ----
  m3-nat.o: m3-nat.c $(defs_h) $(inferior_h) $(value_h) language.h target.h \
  	gdb_wait.h $(gdbcmd_h) $(gdbcore_h)
  
+ p-lang.o: p-lang.c p-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \
+ 	language.h parser-defs.h $(symtab_h) gdb_string.h
+ 
+ p-typeprint.o: p-typeprint.c p-lang.h $(defs_h) $(expression_h) \
+ 	$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) language.h $(symtab_h) \
+ 	target.h typeprint.h $(value_h) gdb_string.h
+ 
+ p-valprint.o: p-valprint.c $(defs_h) $(expression_h) $(gdbtypes_h) \
+ 	language.h $(symtab_h) valprint.h $(value_h) gdb_string.h
+ 
  m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
  	$(gdbcore_h) gdb_string.h
  
***************
*** 1948,1953 ****
--- 1979,1988 ----
  
  m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
  	language.h m2-lang.h parser-defs.h $(symtab_h) $(value_h) \
+ 	$(bfd_h) objfiles.h symfile.h
+ 
+ p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
+ 	language.h p-lang.h parser-defs.h $(symtab_h) $(value_h) \
  	$(bfd_h) objfiles.h symfile.h
  
  gdb-events.o: gdb-events.c gdb-events.h $(defs_h) $(gdbcmd_h)
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.13
diff -c -r1.13 symfile.c
*** symfile.c	2000/06/12 14:05:44	1.13
--- symfile.c	2000/06/14 13:09:53
***************
*** 1927,1932 ****
--- 1927,1936 ----
        add_filename_language (".F", language_fortran);
        add_filename_language (".s", language_asm);
        add_filename_language (".S", language_asm);
+       add_filename_language (".pas",   language_pascal);
+       add_filename_language (".p",     language_pascal);
+       add_filename_language (".pp",    language_pascal);
+       add_filename_language (".inc",   language_pascal);
      }
  }
  



Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]