diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 2bd60ca2939..ed677a42974 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -512,6 +512,8 @@ MC=m2/boot-bin/mc$(exeext) $(MC_ARGS) MC_LIBS=m2/mc-boot-ch/Glibc.o m2/mc-boot-ch/Gmcrts.o +MC_SRC_FLAGS=-DMC_M2 + M2LINK=m2/boot-bin/mklink$(exeext) GM2_O=-O0 GM2_O_S3=-O @@ -1434,17 +1436,17 @@ m2/boot-bin/mc$(exeext): $(BUILD-MC-BOOT-O) $(BUILD-MC-INTERFACE-O) \ m2/mc-boot/$(SRC_PREFIX)%.o: m2/mc-boot/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ $(POSTCOMPILE) m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ $(POSTCOMPILE) m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ $(POSTCOMPILE) m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit @@ -1464,80 +1466,82 @@ mcflex.c: $(srcdir)/m2/mc/mc.flex m2/gm2-libs-boot/M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) --suppress-noreturn -o=m2/gm2-libs-boot/M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod - $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -I$(srcdir)/m2/gm2-libs-ch $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ $(POSTCOMPILE) m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs-boot/$*.mod - $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) $(MCINCLUDES) -I$(srcdir)/m2/gm2-libs-ch m2/gm2-libs-boot/$*.c -o $@ $(POSTCOMPILE) m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs/$*.mod - $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -I$(srcdir)/m2/gm2-libs-ch $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ $(POSTCOMPILE) m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def -m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c m2/gm2-libs/gm2-libs-host.h +GM2-LIBS-BOOT-H=m2/gm2-libs/gm2-libs-host.h m2/gm2-libs-boot/GM2RTS.h m2/gm2-libs-boot/GSYSTEM.h + +m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c -DHAVE_CONFIG_H $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c -DHAVE_CONFIG_H $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs-boot -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs-boot -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) -m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) m2/gm2-libs/gm2-libs-host.h +m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) m2/gm2-libs-boot/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \ - m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h m2/gm2-libs/gm2-libs-host.h + m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h $(GM2-LIBS-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ $(POSTCOMPILE) m2/gm2-libs-boot/SysStorage.o: $(srcdir)/m2/gm2-libs/SysStorage.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/SysStorage.c $(srcdir)/m2/gm2-libs/SysStorage.mod - $(COMPILER) $(CM2DEP) -DIN_GCC -c $(CFLAGS) $(GM2_PICFLAGS) \ + $(COMPILER) $(CM2DEP) -DIN_GCC -c $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) \ -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \ m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o $(POSTCOMPILE) @@ -1547,7 +1551,7 @@ m2/gm2-compiler-boot/M2GCCDeclare.o: $(srcdir)/m2/gm2-compiler/M2GCCDeclare.mod $(MC) $(MC_EXTENDED_OPAQUE) -o=m2/gm2-compiler-boot/M2GCCDeclare.c $< $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I. -Im2/gm2-libs-boot -I$(srcdir)/m2/gm2-libs-ch -Im2/gm2-compiler-boot \ -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2GCCDeclare.c -o $@ $(POSTCOMPILE) @@ -1556,7 +1560,7 @@ m2/gm2-compiler-boot/M2Error.o: $(srcdir)/m2/gm2-compiler/M2Error.mod $(MCDEPS) $(MC) $(MC_EXTENDED_OPAQUE) -o=m2/gm2-compiler-boot/M2Error.c $< $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I. -Im2/gm2-libs-boot -I$(srcdir)/m2/gm2-libs-ch -Im2/gm2-compiler-boot \ -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2Error.c -o $@ $(POSTCOMPILE) @@ -1565,7 +1569,7 @@ m2/gm2-compiler-boot/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(BUILD-BOOT-H) $(MCDE $(MC) -o=m2/gm2-compiler-boot/$*.c $(srcdir)/m2/gm2-compiler/$*.mod $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -Im2/gm2-libiberty \ + -I. -Im2/gm2-libs-boot -I$(srcdir)/m2/gm2-libs-ch -Im2/gm2-compiler-boot -Im2/gm2-libiberty \ -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ $(POSTCOMPILE) @@ -1575,6 +1579,7 @@ m2/gm2-compiler-boot/%.o: m2/gm2-compiler-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H) $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ -I. -I$(srcdir)/../include -I$(srcdir) \ -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I$(srcdir)/m2/gm2-libs-ch \ -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ $(POSTCOMPILE) @@ -1837,12 +1842,12 @@ include m2/Make-maintainer else m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) $(CFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CM2DEP) $(CFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ $(POSTCOMPILE) m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) - $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(MC_SRC_FLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ $(POSTCOMPILE) $(PGE): $(BUILD-PGE-O) diff --git a/gcc/m2/gm2-gcc/m2color.cc b/gcc/m2/gm2-gcc/m2color.cc index 09f068c67c4..e8a2ef28d55 100644 --- a/gcc/m2/gm2-gcc/m2color.cc +++ b/gcc/m2/gm2-gcc/m2color.cc @@ -27,9 +27,11 @@ along with GNU Modula-2; see the file COPYING3. If not see char * -m2color_colorize_start (bool show_color, char *name, unsigned int _name_high) +m2color_colorize_start (bool show_color, void *name, unsigned int _name_high) { - return const_cast (colorize_start (show_color, name, _name_high)); + return const_cast (colorize_start (show_color, + reinterpret_cast (name), + _name_high)); } diff --git a/gcc/m2/gm2-gcc/m2color.h b/gcc/m2/gm2-gcc/m2color.h index 9b277e0925d..b3f1e17fac7 100644 --- a/gcc/m2/gm2-gcc/m2color.h +++ b/gcc/m2/gm2-gcc/m2color.h @@ -37,7 +37,7 @@ along with GNU Modula-2; see the file COPYING3. If not see EXTERN char * -m2color_colorize_start (bool show_color, char *name, unsigned int name_len); +m2color_colorize_start (bool show_color, void *name, unsigned int name_len); EXTERN char *m2color_colorize_stop (bool show_color); diff --git a/gcc/m2/gm2-gcc/m2type.h b/gcc/m2/gm2-gcc/m2type.h index f29d4131f91..b5a11126038 100644 --- a/gcc/m2/gm2-gcc/m2type.h +++ b/gcc/m2/gm2-gcc/m2type.h @@ -87,13 +87,6 @@ EXTERN tree m2type_BuildArrayStringConstructor (location_t location, tree arrayType, tree str, tree length); -#if 0 -EXTERN tree m2type_GetPointerOne (void); -EXTERN tree m2type_GetPointerZero (void); -EXTERN tree m2type_GetWordOne (void); -EXTERN tree m2type_GetWordZero (void); -#endif - EXTERN tree m2type_GetM2CharType (void); EXTERN tree m2type_GetM2IntegerType (void); EXTERN tree m2type_GetM2ShortRealType (void); diff --git a/gcc/m2/gm2-libs-ch/SysExceptions.c b/gcc/m2/gm2-libs-ch/SysExceptions.c index 85dc4800188..0de4787ac43 100644 --- a/gcc/m2/gm2-libs-ch/SysExceptions.c +++ b/gcc/m2/gm2-libs-ch/SysExceptions.c @@ -26,15 +26,23 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" -#include "ansidecl.h" + #include "gm2-libs-host.h" -#if defined(HAVE_SIGNAL_H) -#include +#ifdef MC_M2 +#include "GSysExceptions.h" +#define DECL_PROC_T(X) SysExceptions_PROCEXCEPTION X +#define PROC_FUNC(X) X.proc +#else +#define DECL_PROC_T(X) void (*X) (void *) +#define PROC_FUNC(X) X #endif -#ifdef __cplusplus -extern "C" { +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +#else +#define EXTERN #endif #if 0 @@ -75,16 +83,14 @@ extern "C" { #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 - (indexException, rangeException, caseSelectException, invalidLocation, functionException, wholeValueException, wholeDivException, realValueException, realDivException, complexValueException, complexDivException, protException, sysException, coException, exException ); - #endif -/* note wholeDivException and realDivException are caught by SIGFPE +/* wholeDivException and realDivException are caught by SIGFPE and depatched to the appropriate Modula-2 runtime routine upon testing FPE_INTDIV or FPE_FLTDIV. realValueException is also caught by SIGFPE and dispatched by testing FFE_FLTOVF or @@ -113,6 +119,7 @@ static void (*systemProc) (void *); static void (*coroutineProc) (void *); static void (*exceptionProc) (void *); + static void sigbusDespatcher (int signum, siginfo_t *info, void *ucontext) { @@ -164,33 +171,41 @@ sigfpeDespatcher (int signum, siginfo_t *info, void *ucontext) } } +EXTERN void -SysExceptions_InitExceptionHandlers ( - void (*indexf) (void *), void (*range) (void *), void (*casef) (void *), - void (*invalidloc) (void *), void (*function) (void *), - void (*wholevalue) (void *), void (*wholediv) (void *), - void (*realvalue) (void *), void (*realdiv) (void *), - void (*complexvalue) (void *), void (*complexdiv) (void *), - void (*protection) (void *), void (*systemf) (void *), - void (*coroutine) (void *), void (*exception) (void *)) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { struct sigaction old; - indexProc = indexf; - rangeProc = range; - caseProc = casef; - invalidlocProc = invalidloc; - functionProc = function; - wholevalueProc = wholevalue; - wholedivProc = wholediv; - realvalueProc = realvalue; - realdivProc = realdiv; - complexvalueProc = complexvalue; - complexdivProc = complexdiv; - protectionProc = protection; - systemProc = systemf; - coroutineProc = coroutine; - exceptionProc = exception; + indexProc = PROC_FUNC (indexf); + rangeProc = PROC_FUNC (range); + caseProc = PROC_FUNC (casef); + invalidlocProc = PROC_FUNC (invalidloc); + functionProc = PROC_FUNC (function); + wholevalueProc = PROC_FUNC (wholevalue); + wholedivProc = PROC_FUNC (wholediv); + realvalueProc = PROC_FUNC (realvalue); + realdivProc = PROC_FUNC (realdiv); + complexvalueProc = PROC_FUNC (complexvalue); + complexdivProc = PROC_FUNC (complexdiv); + protectionProc = PROC_FUNC (protection); + systemProc = PROC_FUNC (systemf); + coroutineProc = PROC_FUNC (coroutine); + exceptionProc = PROC_FUNC (exception); sigbus.sa_sigaction = sigbusDespatcher; sigbus.sa_flags = (SA_SIGINFO); @@ -215,29 +230,37 @@ SysExceptions_InitExceptionHandlers ( } #else +EXTERN void -SysExceptions_InitExceptionHandlers (void *indexf, void *range, void *casef, - void *invalidloc, void *function, - void *wholevalue, void *wholediv, - void *realvalue, void *realdiv, - void *complexvalue, void *complexdiv, - void *protection, void *systemf, - void *coroutine, void *exception) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { } #endif /* GNU Modula-2 linking fodder. */ +EXTERN void _M2_SysExceptions_init (int argc, char *argv[], char *envp[]) { } +EXTERN void -_M2_SysExceptions_finish (void) +_M2_SysExceptions_fini (int argc, char *argv[], char *envp[]) { } -#ifdef __cplusplus -} -#endif diff --git a/gcc/m2/gm2-libs-ch/UnixArgs.cc b/gcc/m2/gm2-libs-ch/UnixArgs.cc index 67a0c99f036..ae9765aed7e 100644 --- a/gcc/m2/gm2-libs-ch/UnixArgs.cc +++ b/gcc/m2/gm2-libs-ch/UnixArgs.cc @@ -29,9 +29,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIBNAME "m2pim" -extern "C" int UnixArgs_GetArgC (void); -extern "C" char **UnixArgs_GetArgV (void); -extern "C" char **UnixArgs_GetEnvV (void); +#include "gm2-libs-host.h" + +#include "GUnixArgs.h" +#include "GM2RTS.h" static int UnixArgs_ArgC; static char **UnixArgs_ArgV; @@ -49,7 +50,7 @@ UnixArgs_GetArgC (void) /* GetArgV returns argv. */ -extern "C" char ** +extern "C" void * UnixArgs_GetArgV (void) { return UnixArgs_ArgV; @@ -58,7 +59,7 @@ UnixArgs_GetArgV (void) /* GetEnvV returns envv. */ -extern "C" char ** +extern "C" void * UnixArgs_GetEnvV (void) { return UnixArgs_EnvV; diff --git a/gcc/m2/gm2-libs-ch/m2rts.h b/gcc/m2/gm2-libs-ch/m2rts.h index 83e463abf2e..df6cbcb2c8d 100644 --- a/gcc/m2/gm2-libs-ch/m2rts.h +++ b/gcc/m2/gm2-libs-ch/m2rts.h @@ -24,23 +24,15 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +#include "GM2RTS.h" -typedef void (*proc_con) (int, char **, char **); -typedef void (*proc_dep) (void); - +#ifdef MC_M2 +/* mc sources do not register their init fini functions as they are + initialized by a static scaffold (called by main). */ +#define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) +#else #define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) \ M2RTS_RegisterModule (reinterpret_cast (const_cast (MODNAME)), \ reinterpret_cast (const_cast (LIBNAME)), \ init, fini, dep) - -extern "C" void M2RTS_RequestDependant (const void *modulename, const void *dependancy); -extern "C" void M2RTS_RegisterModule (void *modulename, void *libname, - proc_con init, proc_con fini, proc_dep dependencies); -extern "C" void _M2_M2RTS_init (void); - -extern "C" void M2RTS_ConstructModules (const void *, - int argc, char *argv[], char *envp[]); -extern "C" void M2RTS_Terminate (void); -extern "C" void M2RTS_DeconstructModules (void); - -extern "C" void M2RTS_Halt (const char *, const char *, const char *, int) __attribute__ ((noreturn)); +#endif diff --git a/gcc/m2/gm2-libs-ch/termios.c b/gcc/m2/gm2-libs-ch/termios.c index fe7403b3dee..e9cbbf50a17 100644 --- a/gcc/m2/gm2-libs-ch/termios.c +++ b/gcc/m2/gm2-libs-ch/termios.c @@ -26,24 +26,28 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include "system.h" -#include "ansidecl.h" #include "gm2-libs-host.h" +#define _termios_C +#include "Gtermios.h" + +#ifdef HAVE_TERMIOS_H +# include +#endif + #ifdef TERMIOS_NEEDS_XOPEN_SOURCE #define _XOPEN_SOURCE #endif -#if defined(HAVE_TERMIOS_H) -#include +#if defined(__cplusplus) +#define EXTERN extern "C" +#else +#define EXTERN #endif #define EXPORT(X) termios##_##X -#ifdef __cplusplus -extern "C" { -#endif - typedef enum { vintr, vquit, @@ -168,40 +172,25 @@ typedef enum { liexten } Flag; -/* prototypes. */ -void *EXPORT (InitTermios) (void); -void *EXPORT (KillTermios) (struct termios *p); -int EXPORT (cfgetospeed) (struct termios *t); -int EXPORT (cfgetispeed) (struct termios *t); -int EXPORT (cfsetospeed) (struct termios *t, unsigned int b); -int EXPORT (cfsetispeed) (struct termios *t, unsigned int b); -int EXPORT (cfsetspeed) (struct termios *t, unsigned int b); -int EXPORT (tcgetattr) (int fd, struct termios *t); -int EXPORT (tcsetattr) (int fd, int option, struct termios *t); -void EXPORT (cfmakeraw) (struct termios *t); -int EXPORT (tcsendbreak) (int fd, int duration); -int EXPORT (tcdrain) (int fd); -int EXPORT (tcflushi) (int fd); -int EXPORT (tcflusho) (int fd); -int EXPORT (tcflushio) (int fd); -int EXPORT (tcflowoni) (int fd); -int EXPORT (tcflowoffi) (int fd); -int EXPORT (tcflowono) (int fd); -int EXPORT (tcflowoffo) (int fd); -bool EXPORT (GetFlag) (struct termios *t, Flag f, bool *b); -bool EXPORT (SetFlag) (struct termios *t, Flag f, bool b); -bool EXPORT (GetChar) (struct termios *t, ControlChar c, char *ch); -bool EXPORT (SetChar) (struct termios *t, ControlChar c, char ch); -int EXPORT (tcsnow) (void); -int EXPORT (tcsflush) (void); -int EXPORT (tcsdrain) (void); -bool doSetUnset (tcflag_t *bitset, unsigned int mask, bool value); -void _M2_termios_init (void); -void _M2_termios_finish (void); +int +doSetUnset (tcflag_t *bitset, unsigned int mask, int value) +{ + if (value) + (*bitset) |= mask; + else + (*bitset) &= (~mask); + return 1; +} + + +#ifdef __cplusplus +extern "C" { +#endif /* InitTermios - new data structure. */ -void *EXPORT (InitTermios) (void) +void * +EXPORT (InitTermios) (void) { struct termios *p = (struct termios *)malloc (sizeof (struct termios)); @@ -211,50 +200,79 @@ void *EXPORT (InitTermios) (void) /* KillTermios - delete data structure. */ -void *EXPORT (KillTermios) (struct termios *p) +void * +EXPORT (KillTermios) (termios_TERMIOS p) { free (p); return NULL; } -/* tcsnow - return the value of TCSANOW. */ +/* tcsnow return the value of TCSANOW. */ -int EXPORT (tcsnow) (void) { return TCSANOW; } - -/* tcsdrain - return the value of TCSADRAIN. */ - -int EXPORT (tcsdrain) (void) { return TCSADRAIN; } - -/* tcsflush - return the value of TCSAFLUSH. */ - -int EXPORT (tcsflush) (void) { return TCSAFLUSH; } - -/* cfgetospeed - return output baud rate. */ - -int EXPORT (cfgetospeed) (struct termios *t) { return cfgetospeed (t); } - -/* cfgetispeed - return input baud rate. */ - -int EXPORT (cfgetispeed) (struct termios *t) { return cfgetispeed (t); } - -/* cfsetospeed - set output baud rate. */ - -int EXPORT (cfsetospeed) (struct termios *t, unsigned int b) +int +EXPORT (tcsnow) (void) { + return TCSANOW; +} + +/* tcsdrain return the value of TCSADRAIN. */ + +int +EXPORT (tcsdrain) (void) +{ + return TCSADRAIN; +} + +/* tcsflush return the value of TCSAFLUSH. */ + +int +EXPORT (tcsflush) (void) +{ + return TCSAFLUSH; +} + +/* cfgetospeed return output baud rate. */ + +int +EXPORT (cfgetospeed) (termios_TERMIOS _t) +{ + struct termios *t = (termios *)_t; + return cfgetospeed (t); +} + +/* cfgetispeed return input baud rate. */ + +int +EXPORT (cfgetispeed) (termios_TERMIOS _t) +{ + struct termios *t = (termios *)_t; + return cfgetispeed (t); +} + +/* cfsetospeed set output baud rate. */ + +int +EXPORT (cfsetospeed) (termios_TERMIOS _t, unsigned int b) +{ + struct termios *t = (termios *)_t; return cfsetospeed (t, b); } -/* cfsetispeed - set input baud rate. */ +/* cfsetispeed set input baud rate. */ -int EXPORT (cfsetispeed) (struct termios *t, unsigned int b) +int +EXPORT (cfsetispeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; return cfsetispeed (t, b); } -/* cfsetspeed - set input and output baud rate. */ +/* cfsetspeed set input and output baud rate. */ -int EXPORT (cfsetspeed) (struct termios *t, unsigned int b) +int +EXPORT (cfsetspeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; int val = cfsetispeed (t, b); if (val == 0) return cfsetospeed (t, b); @@ -262,43 +280,55 @@ int EXPORT (cfsetspeed) (struct termios *t, unsigned int b) return val; } -/* tcgetattr - get state of, fd, into, t. */ +/* tcgetattr get state of fd into t. */ -int EXPORT (tcgetattr) (int fd, struct termios *t) +int +EXPORT (tcgetattr) (int fd, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcgetattr (fd, t); } -/* tcsetattr - set state of, fd, to, t, using option. */ +/* tcsetattr set state of fd to t using option. */ -int EXPORT (tcsetattr) (int fd, int option, struct termios *t) +int +EXPORT (tcsetattr) (int fd, int option, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcsetattr (fd, option, t); } -/* cfmakeraw - sets the terminal to raw mode. */ +/* cfmakeraw sets the terminal to raw mode. */ -void EXPORT (cfmakeraw) (struct termios *t) +void +EXPORT (cfmakeraw) (termios_TERMIOS _t) { #if defined(HAVE_CFMAKERAW) + struct termios *t = (termios *)_t; cfmakeraw (t); #endif } -/* tcsendbreak - send zero bits for duration. */ +/* tcsendbreak send zero bits for duration. */ -int EXPORT (tcsendbreak) (int fd, int duration) +int +EXPORT (tcsendbreak) (int fd, int duration) { return tcsendbreak (fd, duration); } -/* tcdrain - waits for pending output to be written on, fd. */ +/* tcdrain waits for pending output to be written on fd. */ -int EXPORT (tcdrain) (int fd) { return tcdrain (fd); } +int +EXPORT (tcdrain) (int fd) +{ + return tcdrain (fd); +} -/* tcflushi - flush input. */ +/* tcflushi flush input. */ -int EXPORT (tcflushi) (int fd) +int +EXPORT (tcflushi) (int fd) { #if defined(TCIFLUSH) return tcflush (fd, TCIFLUSH); @@ -307,9 +337,10 @@ int EXPORT (tcflushi) (int fd) #endif } -/* tcflusho - flush output. */ +/* tcflusho flush output. */ -int EXPORT (tcflusho) (int fd) +int +EXPORT (tcflusho) (int fd) { #if defined(TCOFLUSH) return tcflush (fd, TCOFLUSH); @@ -318,9 +349,10 @@ int EXPORT (tcflusho) (int fd) #endif } -/* tcflushio - flush input and output. */ +/* tcflushio flush input and output. */ -int EXPORT (tcflushio) (int fd) +int +EXPORT (tcflushio) (int fd) { #if defined(TCIOFLUSH) return tcflush (fd, TCIOFLUSH); @@ -329,9 +361,10 @@ int EXPORT (tcflushio) (int fd) #endif } -/* tcflowoni - restart input on, fd. */ +/* tcflowoni restart input on fd. */ -int EXPORT (tcflowoni) (int fd) +int +EXPORT (tcflowoni) (int fd) { #if defined(TCION) return tcflow (fd, TCION); @@ -340,9 +373,10 @@ int EXPORT (tcflowoni) (int fd) #endif } -/* tcflowoffi - stop input on, fd. */ +/* tcflowoffi stop input on fd. */ -int EXPORT (tcflowoffi) (int fd) +int +EXPORT (tcflowoffi) (int fd) { #if defined(TCIOFF) return tcflow (fd, TCIOFF); @@ -351,9 +385,10 @@ int EXPORT (tcflowoffi) (int fd) #endif } -/* tcflowono - restart output on, fd. */ +/* tcflowono restart output on fd. */ -int EXPORT (tcflowono) (int fd) +int +EXPORT (tcflowono) (int fd) { #if defined(TCOON) return tcflow (fd, TCOON); @@ -362,9 +397,10 @@ int EXPORT (tcflowono) (int fd) #endif } -/* tcflowoffo - stop output on, fd. */ +/* tcflowoffo stop output on fd. */ -int EXPORT (tcflowoffo) (int fd) +int +EXPORT (tcflowoffo) (int fd) { #if defined(TCOOFF) return tcflow (fd, TCOOFF); @@ -373,23 +409,14 @@ int EXPORT (tcflowoffo) (int fd) #endif } -/* doSetUnset applies mask or undoes mask depending upon value and returns true. */ +/* GetFlag sets a flag value from t in b and returns TRUE if + t supports f. */ bool -doSetUnset (tcflag_t *bitset, unsigned int mask, bool value) -{ - if (value) - (*bitset) |= mask; - else - (*bitset) &= (~mask); - return true; -} - -/* GetFlag sets a flag value from t in b and returns true if t supports f. */ - -bool -EXPORT (GetFlag) (struct termios *t, Flag f, bool *b) +EXPORT (GetFlag) (termios_TERMIOS _t, termios_Flag _f, bool *b) { + Flag f = (Flag) _f; + struct termios *t = (termios *)_t; switch (f) { @@ -1069,15 +1096,17 @@ EXPORT (GetFlag) (struct termios *t, Flag f, bool *b) return false; } -/* SetFlag - sets a flag value in, t, to, b, and returns TRUE if this +/* SetFlag sets a flag value in t to b and returns TRUE if this flag value is supported. */ bool -EXPORT (SetFlag) (struct termios *t, Flag f, bool b) +EXPORT (SetFlag) (termios_TERMIOS _t, termios_Flag _f, bool b) { + struct termios *t = (struct termios *) _t; + Flag f = (Flag) _f; + switch (f) { - case ignbrk: #if defined(IGNBRK) return doSetUnset (&t->c_iflag, IGNBRK, b); @@ -1658,12 +1687,14 @@ EXPORT (SetFlag) (struct termios *t, Flag f, bool b) return false; } -/* GetChar sets a CHAR ch value from t and returns true if this +/* GetChar sets a CHAR ch value from t and returns true/false if this value is supported. */ bool -EXPORT (GetChar) (struct termios *t, ControlChar c, char *ch) +EXPORT (GetChar) (termios_TERMIOS _t, termios_ControlChar _c, char *ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { @@ -1791,11 +1822,14 @@ EXPORT (GetChar) (struct termios *t, ControlChar c, char *ch) } } -/* SetChar sets a CHAR value in t and returns true if c is supported. */ +/* SetChar sets a CHAR value in t and returns true/false if c is + supported. */ bool -EXPORT (SetChar) (struct termios *t, ControlChar c, char ch) +EXPORT (SetChar) (termios_TERMIOS _t, termios_ControlChar _c, char ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { @@ -1924,12 +1958,12 @@ EXPORT (SetChar) (struct termios *t, ControlChar c, char ch) } void -_M2_termios_init (void) +_M2_termios_init (int argc, char *argv[], char *envp[]) { } void -_M2_termios_finish (void) +_M2_termios_fini (int argc, char *argv[], char *envp[]) { } diff --git a/gcc/m2/mc-boot-ch/GSYSTEM.h b/gcc/m2/mc-boot-ch/GSYSTEM.h new file mode 100644 index 00000000000..a18a1765dc5 --- /dev/null +++ b/gcc/m2/mc-boot-ch/GSYSTEM.h @@ -0,0 +1,113 @@ +/* do not edit automatically generated by mc from SYSTEM. */ +/* SYSTEM.def provides access to the SYSTEM dependent module. + +Copyright (C) 2001-2024 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +#if !defined (_SYSTEM_H) +# define _SYSTEM_H + +#include "config.h" +#include "system.h" +# ifdef __cplusplus +extern "C" { +# endif +#include +# if !defined (PROC_D) +# define PROC_D + typedef void (*PROC_t) (void); + typedef struct { PROC_t proc; } PROC; +# endif + + +# if defined (_SYSTEM_C) +# define EXTERN +# else +# define EXTERN extern +# endif + +# define SYSTEM_BITSPERBYTE 8 +# define SYSTEM_BYTESPERWORD 4 + +/* + ShiftVal - is a runtime procedure whose job is to implement + the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will + inline a SHIFT of a single WORD sized set and will only + call this routine for larger sets. +*/ + +EXTERN void SYSTEM_ShiftVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int ShiftCount); + +/* + ShiftLeft - performs the shift left for a multi word set. + This procedure might be called by the back end of + GNU Modula-2 depending whether amount is known at + compile time. +*/ + +EXTERN void SYSTEM_ShiftLeft (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int ShiftCount); + +/* + ShiftRight - performs the shift left for a multi word set. + This procedure might be called by the back end of + GNU Modula-2 depending whether amount is known at + compile time. +*/ + +EXTERN void SYSTEM_ShiftRight (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int ShiftCount); + +/* + RotateVal - is a runtime procedure whose job is to implement + the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will + inline a ROTATE of a single WORD (or less) + sized set and will only call this routine for larger + sets. +*/ + +EXTERN void SYSTEM_RotateVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int RotateCount); + +/* + RotateLeft - performs the rotate left for a multi word set. + This procedure might be called by the back end of + GNU Modula-2 depending whether amount is known at + compile time. +*/ + +EXTERN void SYSTEM_RotateLeft (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount); + +/* + RotateRight - performs the rotate right for a multi word set. + This procedure might be called by the back end of + GNU Modula-2 depending whether amount is known at + compile time. +*/ + +EXTERN void SYSTEM_RotateRight (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount); +# ifdef __cplusplus +} +# endif + +# undef EXTERN +#endif diff --git a/gcc/m2/mc-boot-ch/GSysExceptions.c b/gcc/m2/mc-boot-ch/GSysExceptions.c index d16197dbcc7..de8bab91c57 100644 --- a/gcc/m2/mc-boot-ch/GSysExceptions.c +++ b/gcc/m2/mc-boot-ch/GSysExceptions.c @@ -24,6 +24,16 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "gm2-libs-host.h" +#ifdef MC_M2 +#include "GSysExceptions.h" +#define DECL_PROC_T(X) SysExceptions_PROCEXCEPTION X +#define PROC_FUNC(X) X.proc +#else +#define DECL_PROC_T(X) void (*X) (void *) +#define PROC_FUNC(X) X +#endif + +#undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" #else @@ -68,13 +78,11 @@ along with GNU Modula-2; see the file COPYING3. If not see #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 - (indexException, rangeException, caseSelectException, invalidLocation, functionException, wholeValueException, wholeDivException, realValueException, realDivException, complexValueException, complexDivException, protException, sysException, coException, exException ); - #endif /* wholeDivException and realDivException are caught by SIGFPE @@ -106,6 +114,7 @@ static void (*systemProc) (void *); static void (*coroutineProc) (void *); static void (*exceptionProc) (void *); + static void sigbusDespatcher (int signum, siginfo_t *info, void *ucontext) { @@ -159,32 +168,39 @@ sigfpeDespatcher (int signum, siginfo_t *info, void *ucontext) EXTERN void -SysExceptions_InitExceptionHandlers ( - void (*indexf) (void *), void (*range) (void *), void (*casef) (void *), - void (*invalidloc) (void *), void (*function) (void *), - void (*wholevalue) (void *), void (*wholediv) (void *), - void (*realvalue) (void *), void (*realdiv) (void *), - void (*complexvalue) (void *), void (*complexdiv) (void *), - void (*protection) (void *), void (*systemf) (void *), - void (*coroutine) (void *), void (*exception) (void *)) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { struct sigaction old; - indexProc = indexf; - rangeProc = range; - caseProc = casef; - invalidlocProc = invalidloc; - functionProc = function; - wholevalueProc = wholevalue; - wholedivProc = wholediv; - realvalueProc = realvalue; - realdivProc = realdiv; - complexvalueProc = complexvalue; - complexdivProc = complexdiv; - protectionProc = protection; - systemProc = systemf; - coroutineProc = coroutine; - exceptionProc = exception; + indexProc = PROC_FUNC (indexf); + rangeProc = PROC_FUNC (range); + caseProc = PROC_FUNC (casef); + invalidlocProc = PROC_FUNC (invalidloc); + functionProc = PROC_FUNC (function); + wholevalueProc = PROC_FUNC (wholevalue); + wholedivProc = PROC_FUNC (wholediv); + realvalueProc = PROC_FUNC (realvalue); + realdivProc = PROC_FUNC (realdiv); + complexvalueProc = PROC_FUNC (complexvalue); + complexdivProc = PROC_FUNC (complexdiv); + protectionProc = PROC_FUNC (protection); + systemProc = PROC_FUNC (systemf); + coroutineProc = PROC_FUNC (coroutine); + exceptionProc = PROC_FUNC (exception); sigbus.sa_sigaction = sigbusDespatcher; sigbus.sa_flags = (SA_SIGINFO); @@ -211,13 +227,21 @@ SysExceptions_InitExceptionHandlers ( #else EXTERN void -SysExceptions_InitExceptionHandlers (void *indexf, void *range, void *casef, - void *invalidloc, void *function, - void *wholevalue, void *wholediv, - void *realvalue, void *realdiv, - void *complexvalue, void *complexdiv, - void *protection, void *systemf, - void *coroutine, void *exception) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { } #endif diff --git a/gcc/m2/mc-boot-ch/GSysExceptions.h b/gcc/m2/mc-boot-ch/GSysExceptions.h new file mode 100644 index 00000000000..00dd52117d1 --- /dev/null +++ b/gcc/m2/mc-boot-ch/GSysExceptions.h @@ -0,0 +1,63 @@ +/* do not edit automatically generated by mc from SysExceptions. */ +/* SysExceptions.def provides a mechanism for the underlying libraries to. + +Copyright (C) 2009-2024 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +#if !defined (_SysExceptions_H) +# define _SysExceptions_H + +#include "config.h" +#include "system.h" +# ifdef __cplusplus +extern "C" { +# endif +#include +# if !defined (PROC_D) +# define PROC_D + typedef void (*PROC_t) (void); + typedef struct { PROC_t proc; } PROC; +# endif + +# include "GSYSTEM.h" + +# if defined (_SysExceptions_C) +# define EXTERN +# else +# define EXTERN extern +# endif + +typedef struct SysExceptions_PROCEXCEPTION_p SysExceptions_PROCEXCEPTION; + +typedef void (*SysExceptions_PROCEXCEPTION_t) (void *); +struct SysExceptions_PROCEXCEPTION_p { SysExceptions_PROCEXCEPTION_t proc; }; + +EXTERN void SysExceptions_InitExceptionHandlers (SysExceptions_PROCEXCEPTION indexf, SysExceptions_PROCEXCEPTION range, SysExceptions_PROCEXCEPTION casef, SysExceptions_PROCEXCEPTION invalidloc, SysExceptions_PROCEXCEPTION function, SysExceptions_PROCEXCEPTION wholevalue, SysExceptions_PROCEXCEPTION wholediv, SysExceptions_PROCEXCEPTION realvalue, SysExceptions_PROCEXCEPTION realdiv, SysExceptions_PROCEXCEPTION complexvalue, SysExceptions_PROCEXCEPTION complexdiv, SysExceptions_PROCEXCEPTION protection, SysExceptions_PROCEXCEPTION systemf, SysExceptions_PROCEXCEPTION coroutine, SysExceptions_PROCEXCEPTION exception); +# ifdef __cplusplus +} +# endif + +# undef EXTERN +#endif diff --git a/gcc/m2/mc-boot-ch/Glibc.c b/gcc/m2/mc-boot-ch/Glibc.c index 5ad1711bc64..2f6d31397ba 100644 --- a/gcc/m2/mc-boot-ch/Glibc.c +++ b/gcc/m2/mc-boot-ch/Glibc.c @@ -343,10 +343,10 @@ libc_creat (char *p, mode_t mode) EXTERN int -libc_open (void *p, int oflag, int mode) +libc_open (void *p, int flags, int mode) { - tracedb_open (p, oflag, mode); - int result = open (reinterpret_cast (p), oflag, mode); + tracedb_open (p, flags, mode); + int result = open (reinterpret_cast (p), flags, mode); tracedb_result (result); return result; } diff --git a/gcc/m2/mc-boot-ch/Gtermios.cc b/gcc/m2/mc-boot-ch/Gtermios.cc index 99f003f6152..fe20afb767f 100644 --- a/gcc/m2/mc-boot-ch/Gtermios.cc +++ b/gcc/m2/mc-boot-ch/Gtermios.cc @@ -1,4 +1,4 @@ -/* Gtermios.cc handwritten module for mc. +/* Gtermios.c handwritten module for mc. Copyright (C) 2010-2024 Free Software Foundation, Inc. Contributed by Gaius Mulley . @@ -24,6 +24,9 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "gm2-libs-host.h" +#define _termios_C +#include "Gtermios.h" + #ifdef HAVE_TERMIOS_H # include #endif @@ -193,13 +196,13 @@ EXPORT (InitTermios) (void) /* KillTermios - delete data structure. */ void * -EXPORT (KillTermios) (struct termios *p) +EXPORT (KillTermios) (termios_TERMIOS p) { free (p); return NULL; } -/* tcsnow - return the value of TCSANOW. */ +/* tcsnow return the value of TCSANOW. */ int EXPORT (tcsnow) (void) @@ -207,7 +210,7 @@ EXPORT (tcsnow) (void) return TCSANOW; } -/* tcsdrain - return the value of TCSADRAIN. */ +/* tcsdrain return the value of TCSADRAIN. */ int EXPORT (tcsdrain) (void) @@ -215,7 +218,7 @@ EXPORT (tcsdrain) (void) return TCSADRAIN; } -/* tcsflush - return the value of TCSAFLUSH. */ +/* tcsflush return the value of TCSAFLUSH. */ int EXPORT (tcsflush) (void) @@ -223,43 +226,48 @@ EXPORT (tcsflush) (void) return TCSAFLUSH; } -/* cfgetospeed - return output baud rate. */ +/* cfgetospeed return output baud rate. */ int -EXPORT (cfgetospeed) (struct termios *t) +EXPORT (cfgetospeed) (termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return cfgetospeed (t); } -/* cfgetispeed - return input baud rate. */ +/* cfgetispeed return input baud rate. */ int -EXPORT (cfgetispeed) (struct termios *t) +EXPORT (cfgetispeed) (termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return cfgetispeed (t); } -/* cfsetospeed - set output baud rate. */ +/* cfsetospeed set output baud rate. */ int -EXPORT (cfsetospeed) (struct termios *t, unsigned int b) +EXPORT (cfsetospeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; return cfsetospeed (t, b); } -/* cfsetispeed - set input baud rate. */ +/* cfsetispeed set input baud rate. */ int -EXPORT (cfsetispeed) (struct termios *t, unsigned int b) +EXPORT (cfsetispeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; return cfsetispeed (t, b); } -/* cfsetspeed - set input and output baud rate. */ +/* cfsetspeed set input and output baud rate. */ int -EXPORT (cfsetspeed) (struct termios *t, unsigned int b) +EXPORT (cfsetspeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; int val = cfsetispeed (t, b); if (val == 0) return cfsetospeed (t, b); @@ -267,33 +275,36 @@ EXPORT (cfsetspeed) (struct termios *t, unsigned int b) return val; } -/* tcgetattr - get state of, fd, into, t. */ +/* tcgetattr get state of fd into t. */ int -EXPORT (tcgetattr) (int fd, struct termios *t) +EXPORT (tcgetattr) (int fd, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcgetattr (fd, t); } -/* tcsetattr - set state of, fd, to, t, using option. */ +/* tcsetattr set state of fd to t using option. */ int -EXPORT (tcsetattr) (int fd, int option, struct termios *t) +EXPORT (tcsetattr) (int fd, int option, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcsetattr (fd, option, t); } -/* cfmakeraw - sets the terminal to raw mode. */ +/* cfmakeraw sets the terminal to raw mode. */ void -EXPORT (cfmakeraw) (struct termios *t) +EXPORT (cfmakeraw) (termios_TERMIOS _t) { #if defined(HAVE_CFMAKERAW) + struct termios *t = (termios *)_t; cfmakeraw (t); #endif } -/* tcsendbreak - send zero bits for duration. */ +/* tcsendbreak send zero bits for duration. */ int EXPORT (tcsendbreak) (int fd, int duration) @@ -301,7 +312,7 @@ EXPORT (tcsendbreak) (int fd, int duration) return tcsendbreak (fd, duration); } -/* tcdrain - waits for pending output to be written on, fd. */ +/* tcdrain waits for pending output to be written on fd. */ int EXPORT (tcdrain) (int fd) @@ -309,7 +320,7 @@ EXPORT (tcdrain) (int fd) return tcdrain (fd); } -/* tcflushi - flush input. */ +/* tcflushi flush input. */ int EXPORT (tcflushi) (int fd) @@ -321,7 +332,7 @@ EXPORT (tcflushi) (int fd) #endif } -/* tcflusho - flush output. */ +/* tcflusho flush output. */ int EXPORT (tcflusho) (int fd) @@ -333,7 +344,7 @@ EXPORT (tcflusho) (int fd) #endif } -/* tcflushio - flush input and output. */ +/* tcflushio flush input and output. */ int EXPORT (tcflushio) (int fd) @@ -345,7 +356,7 @@ EXPORT (tcflushio) (int fd) #endif } -/* tcflowoni - restart input on, fd. */ +/* tcflowoni restart input on fd. */ int EXPORT (tcflowoni) (int fd) @@ -357,7 +368,7 @@ EXPORT (tcflowoni) (int fd) #endif } -/* tcflowoffi - stop input on, fd. */ +/* tcflowoffi stop input on fd. */ int EXPORT (tcflowoffi) (int fd) @@ -369,7 +380,7 @@ EXPORT (tcflowoffi) (int fd) #endif } -/* tcflowono - restart output on, fd. */ +/* tcflowono restart output on fd. */ int EXPORT (tcflowono) (int fd) @@ -381,7 +392,7 @@ EXPORT (tcflowono) (int fd) #endif } -/* tcflowoffo - stop output on, fd. */ +/* tcflowoffo stop output on fd. */ int EXPORT (tcflowoffo) (int fd) @@ -393,1542 +404,1551 @@ EXPORT (tcflowoffo) (int fd) #endif } -/* GetFlag - sets a flag value from, t, in, b, and returns TRUE if, - t, supports, f. */ +/* GetFlag sets a flag value from t in b and returns TRUE if + t supports f. */ -int -EXPORT (GetFlag) (struct termios *t, Flag f, int *b) +bool +EXPORT (GetFlag) (termios_TERMIOS _t, termios_Flag _f, bool *b) { + Flag f = (Flag) _f; + struct termios *t = (termios *)_t; switch (f) { case ignbrk: #if defined(IGNBRK) *b = ((t->c_iflag & IGNBRK) == IGNBRK); - return 1; + return true; #else - return 0; + return false; #endif case ibrkint: #if defined(BRKINT) *b = ((t->c_iflag & BRKINT) == BRKINT); - return 1; + return true; #else - return 0; + return false; #endif case ignpar: #if defined(IGNPAR) *b = ((t->c_iflag & IGNPAR) == IGNPAR); - return 1; + return true; #else - return 0; + return false; #endif case iparmrk: #if defined(PARMRK) *b = ((t->c_iflag & PARMRK) == PARMRK); - return 1; + return true; #else - return 0; + return false; #endif case inpck: #if defined(INPCK) *b = ((t->c_iflag & INPCK) == INPCK); - return 1; + return true; #else - return 0; + return false; #endif case istrip: #if defined(ISTRIP) *b = ((t->c_iflag & ISTRIP) == ISTRIP); - return 1; + return true; #else - return 0; + return false; #endif case inlcr: #if defined(INLCR) *b = ((t->c_iflag & INLCR) == INLCR); - return 1; + return true; #else - return 0; + return false; #endif case igncr: #if defined(IGNCR) *b = ((t->c_iflag & IGNCR) == IGNCR); - return 1; + return true; #else - return 0; + return false; #endif case icrnl: #if defined(ICRNL) *b = ((t->c_iflag & ICRNL) == ICRNL); - return 1; + return true; #else - return 0; + return false; #endif case iuclc: #if defined(IUCLC) *b = ((t->c_iflag & IUCLC) == IUCLC); - return 1; + return true; #else - return 0; + return false; #endif case ixon: #if defined(IXON) *b = ((t->c_iflag & IXON) == IXON); - return 1; + return true; #else - return 0; + return false; #endif case ixany: #if defined(IXANY) *b = ((t->c_iflag & IXANY) == IXANY); - return 1; + return true; #else - return 0; + return false; #endif case ixoff: #if defined(IXOFF) *b = ((t->c_iflag & IXOFF) == IXOFF); - return 1; + return true; #else - return 0; + return false; #endif case imaxbel: #if defined(IMAXBEL) *b = ((t->c_iflag & IMAXBEL) == IMAXBEL); - return 1; + return true; #else - return 0; + return false; #endif case opost: #if defined(OPOST) *b = ((t->c_oflag & OPOST) == OPOST); - return 1; + return true; #else - return 0; + return false; #endif case olcuc: #if defined(OLCUC) *b = ((t->c_oflag & OLCUC) == OLCUC); - return 1; + return true; #else - return 0; + return false; #endif case onlcr: #if defined(ONLCR) *b = ((t->c_oflag & ONLCR) == ONLCR); - return 1; + return true; #else - return 0; + return false; #endif case ocrnl: #if defined(OCRNL) *b = ((t->c_oflag & OCRNL) == OCRNL); - return 1; + return true; #else - return 0; + return false; #endif case onocr: #if defined(ONOCR) *b = ((t->c_oflag & ONOCR) == ONOCR); - return 1; + return true; #else - return 0; + return false; #endif case onlret: #if defined(ONLRET) *b = ((t->c_oflag & ONLRET) == ONLRET); - return 1; + return true; #else - return 0; + return false; #endif case ofill: #if defined(OFILL) *b = ((t->c_oflag & OFILL) == OFILL); - return 1; + return true; #else - return 0; + return false; #endif case ofdel: #if defined(OFDEL) *b = ((t->c_oflag & OFDEL) == OFDEL); - return 1; + return true; #else - return 0; + return false; #endif case onl0: #if defined(NL0) *b = ((t->c_oflag & NL0) == NL0); - return 1; + return true; #else - return 0; + return false; #endif case onl1: #if defined(NL1) *b = ((t->c_oflag & NL1) == NL1); - return 1; + return true; #else - return 0; + return false; #endif case ocr0: #if defined(CR0) *b = ((t->c_oflag & CR0) == CR0); - return 1; + return true; #else - return 0; + return false; #endif case ocr1: #if defined(CR1) *b = ((t->c_oflag & CR1) == CR1); - return 1; + return true; #else - return 0; + return false; #endif case ocr2: #if defined(CR2) *b = ((t->c_oflag & CR2) == CR2); - return 1; + return true; #else - return 0; + return false; #endif case ocr3: #if defined(CR3) *b = ((t->c_oflag & CR3) == CR3); - return 1; + return true; #else - return 0; + return false; #endif case otab0: #if defined(TAB0) *b = ((t->c_oflag & TAB0) == TAB0); - return 1; + return true; #else - return 0; + return false; #endif case otab1: #if defined(TAB1) *b = ((t->c_oflag & TAB1) == TAB1); - return 1; + return true; #else - return 0; + return false; #endif case otab2: #if defined(TAB2) *b = ((t->c_oflag & TAB2) == TAB2); - return 1; + return true; #else - return 0; + return false; #endif case otab3: #if defined(TAB3) *b = ((t->c_oflag & TAB3) == TAB3); - return 1; + return true; #else - return 0; + return false; #endif case obs0: #if defined(BS0) *b = ((t->c_oflag & BS0) == BS0); - return 1; + return true; #else - return 0; + return false; #endif case obs1: #if defined(BS1) *b = ((t->c_oflag & BS1) == BS1); - return 1; + return true; #else - return 0; + return false; #endif case off0: #if defined(FF0) *b = ((t->c_oflag & FF0) == FF0); - return 1; + return true; #else - return 0; + return false; #endif case off1: #if defined(FF1) *b = ((t->c_oflag & FF1) == FF1); - return 1; + return true; #else - return 0; + return false; #endif case ovt0: #if defined(VT0) *b = ((t->c_oflag & VT0) == VT0); - return 1; + return true; #else - return 0; + return false; #endif case ovt1: #if defined(VT1) *b = ((t->c_oflag & VT1) == VT1); - return 1; + return true; #else - return 0; + return false; #endif case b0: #if defined(B0) *b = ((t->c_cflag & B0) == B0); - return 1; + return true; #else - return 0; + return false; #endif case b50: #if defined(B50) *b = ((t->c_cflag & B50) == B50); - return 1; + return true; #else - return 0; + return false; #endif case b75: #if defined(B75) *b = ((t->c_cflag & B75) == B75); - return 1; + return true; #else - return 0; + return false; #endif case b110: #if defined(B110) *b = ((t->c_cflag & B110) == B110); - return 1; + return true; #else - return 0; + return false; #endif case b135: #if defined(B134) *b = ((t->c_cflag & B134) == B134); - return 1; + return true; #else - return 0; + return false; #endif case b150: #if defined(B150) *b = ((t->c_cflag & B150) == B150); - return 1; + return true; #else - return 0; + return false; #endif case b200: #if defined(B200) *b = ((t->c_cflag & B200) == B200); - return 1; + return true; #else - return 0; + return false; #endif case b300: #if defined(B300) *b = ((t->c_cflag & B300) == B300); - return 1; + return true; #else - return 0; + return false; #endif case b600: #if defined(B600) *b = ((t->c_cflag & B600) == B600); - return 1; + return true; #else - return 0; + return false; #endif case b1200: #if defined(B1200) *b = ((t->c_cflag & B1200) == B1200); - return 1; + return true; #else - return 0; + return false; #endif case b1800: #if defined(B1800) *b = ((t->c_cflag & B1800) == B1800); - return 1; + return true; #else - return 0; + return false; #endif case b2400: #if defined(B2400) *b = ((t->c_cflag & B2400) == B2400); - return 1; + return true; #else - return 0; + return false; #endif case b4800: #if defined(B4800) *b = ((t->c_cflag & B4800) == B4800); - return 1; + return true; #else - return 0; + return false; #endif case b9600: #if defined(B9600) *b = ((t->c_cflag & B9600) == B9600); - return 1; + return true; #else - return 0; + return false; #endif case b19200: #if defined(B19200) *b = ((t->c_cflag & B19200) == B19200); - return 1; + return true; #else - return 0; + return false; #endif case b38400: #if defined(B38400) *b = ((t->c_cflag & B38400) == B38400); - return 1; + return true; #else - return 0; + return false; #endif case b57600: #if defined(B57600) *b = ((t->c_cflag & B57600) == B57600); - return 1; + return true; #else - return 0; + return false; #endif case b115200: #if defined(B115200) *b = ((t->c_cflag & B115200) == B115200); - return 1; + return true; #else - return 0; + return false; #endif case b240400: #if defined(B230400) *b = ((t->c_cflag & B230400) == B230400); - return 1; + return true; #else - return 0; + return false; #endif case b460800: #if defined(B460800) *b = ((t->c_cflag & B460800) == B460800); - return 1; + return true; #else - return 0; + return false; #endif case b500000: #if defined(B500000) *b = ((t->c_cflag & B500000) == B500000); - return 1; + return true; #else - return 0; + return false; #endif case b576000: #if defined(B576000) *b = ((t->c_cflag & B576000) == B576000); - return 1; + return true; #else - return 0; + return false; #endif case b921600: #if defined(B921600) *b = ((t->c_cflag & B921600) == B921600); - return 1; + return true; #else - return 0; + return false; #endif case b1000000: #if defined(B1000000) *b = ((t->c_cflag & B1000000) == B1000000); - return 1; + return true; #else - return 0; + return false; #endif case b1152000: #if defined(B1152000) *b = ((t->c_cflag & B1152000) == B1152000); - return 1; + return true; #else - return 0; + return false; #endif case b1500000: #if defined(B1500000) *b = ((t->c_cflag & B1500000) == B1500000); - return 1; + return true; #else - return 0; + return false; #endif case b2000000: #if defined(B2000000) *b = ((t->c_cflag & B2000000) == B2000000); - return 1; + return true; #else - return 0; + return false; #endif case b2500000: #if defined(B2500000) *b = ((t->c_cflag & B2500000) == B2500000); - return 1; + return true; #else - return 0; + return false; #endif case b3000000: #if defined(B3000000) *b = ((t->c_cflag & B3000000) == B3000000); - return 1; + return true; #else - return 0; + return false; #endif case b3500000: #if defined(B3500000) *b = ((t->c_cflag & B3500000) == B3500000); - return 1; + return true; #else - return 0; + return false; #endif case b4000000: #if defined(B4000000) *b = ((t->c_cflag & B4000000) == B4000000); - return 1; + return true; #else - return 0; + return false; #endif case maxbaud: #if defined(__MAX_BAUD) *b = ((t->c_cflag & __MAX_BAUD) == __MAX_BAUD); - return 1; + return true; #else - return 0; + return false; #endif case crtscts: #if defined(CRTSCTS) *b = ((t->c_cflag & CRTSCTS) == CRTSCTS); - return 1; + return true; #else - return 0; + return false; #endif case cs5: #if defined(CS5) *b = ((t->c_cflag & CS5) == CS5); - return 1; + return true; #else - return 0; + return false; #endif case cs6: #if defined(CS6) *b = ((t->c_cflag & CS6) == CS6); - return 1; + return true; #else - return 0; + return false; #endif case cs7: #if defined(CS7) *b = ((t->c_cflag & CS7) == CS7); - return 1; + return true; #else - return 0; + return false; #endif case cs8: #if defined(CS8) *b = ((t->c_cflag & CS8) == CS8); - return 1; + return true; #else - return 0; + return false; #endif case cstopb: #if defined(CSTOPB) *b = ((t->c_cflag & CSTOPB) == CSTOPB); - return 1; + return true; #else - return 0; + return false; #endif case cread: #if defined(CREAD) *b = ((t->c_cflag & CREAD) == CREAD); - return 1; + return true; #else - return 0; + return false; #endif case parenb: #if defined(PARENB) *b = ((t->c_cflag & PARENB) == PARENB); - return 1; + return true; #else - return 0; + return false; #endif case parodd: #if defined(PARODD) *b = ((t->c_cflag & PARODD) == PARODD); - return 1; + return true; #else - return 0; + return false; #endif case hupcl: #if defined(HUPCL) *b = ((t->c_cflag & HUPCL) == HUPCL); - return 1; + return true; #else - return 0; + return false; #endif case clocal: #if defined(CLOCAL) *b = ((t->c_cflag & CLOCAL) == CLOCAL); - return 1; + return true; #else - return 0; + return false; #endif case lisig: #if defined(ISIG) *b = ((t->c_lflag & ISIG) == ISIG); - return 1; + return true; #else - return 0; + return false; #endif case licanon: #if defined(ICANON) *b = ((t->c_lflag & ICANON) == ICANON); - return 1; + return true; #else - return 0; + return false; #endif case lxcase: #if defined(XCASE) *b = ((t->c_lflag & XCASE) == XCASE); - return 1; + return true; #else - return 0; + return false; #endif case lecho: #if defined(ECHO) *b = ((t->c_lflag & ECHO) == ECHO); - return 1; + return true; #else - return 0; + return false; #endif case lechoe: #if defined(ECHOE) *b = ((t->c_lflag & ECHOE) == ECHOE); - return 1; + return true; #else - return 0; + return false; #endif case lechok: #if defined(ECHOK) *b = ((t->c_lflag & ECHOK) == ECHOK); - return 1; + return true; #else - return 0; + return false; #endif case lechonl: #if defined(ECHONL) *b = ((t->c_lflag & ECHONL) == ECHONL); - return 1; + return true; #else - return 0; + return false; #endif case lnoflsh: #if defined(NOFLSH) *b = ((t->c_lflag & NOFLSH) == NOFLSH); - return 1; + return true; #else - return 0; + return false; #endif case ltopstop: #if defined(TOSTOP) *b = ((t->c_lflag & TOSTOP) == TOSTOP); - return 1; + return true; #else - return 0; + return false; #endif case lechoctl: #if defined(ECHOCTL) *b = ((t->c_lflag & ECHOCTL) == ECHOCTL); - return 1; + return true; #else - return 0; + return false; #endif case lechoprt: #if defined(ECHOPRT) *b = ((t->c_lflag & ECHOPRT) == ECHOPRT); - return 1; + return true; #else - return 0; + return false; #endif case lechoke: #if defined(ECHOKE) *b = ((t->c_lflag & ECHOKE) == ECHOKE); - return 1; + return true; #else - return 0; + return false; #endif case lflusho: #if defined(FLUSHO) *b = ((t->c_lflag & FLUSHO) == FLUSHO); - return 1; + return true; #else - return 0; + return false; #endif case lpendin: #if defined(PENDIN) *b = ((t->c_lflag & PENDIN) == PENDIN); - return 1; + return true; #else - return 0; + return false; #endif case liexten: #if defined(IEXTEN) *b = ((t->c_lflag & IEXTEN) == IEXTEN); - return 1; + return true; #else - return 0; + return false; #endif } - return 0; + return false; } -/* SetFlag - sets a flag value in, t, to, b, and returns TRUE if this +/* SetFlag sets a flag value in t to b and returns TRUE if this flag value is supported. */ bool -EXPORT (SetFlag) (struct termios *t, Flag f, bool b) +EXPORT (SetFlag) (termios_TERMIOS _t, termios_Flag _f, bool b) { + struct termios *t = (struct termios *) _t; + Flag f = (Flag) _f; + switch (f) { case ignbrk: #if defined(IGNBRK) return doSetUnset (&t->c_iflag, IGNBRK, b); #else - return 0; + return false; #endif case ibrkint: #if defined(BRKINT) return doSetUnset (&t->c_iflag, BRKINT, b); #else - return 0; + return false; #endif case ignpar: #if defined(IGNPAR) return doSetUnset (&t->c_iflag, IGNPAR, b); #else - return 0; + return false; #endif case iparmrk: #if defined(PARMRK) return doSetUnset (&t->c_iflag, PARMRK, b); #else - return 0; + return false; #endif case inpck: #if defined(INPCK) return doSetUnset (&t->c_iflag, INPCK, b); #else - return 0; + return false; #endif case istrip: #if defined(ISTRIP) return doSetUnset (&t->c_iflag, ISTRIP, b); #else - return 0; + return false; #endif case inlcr: #if defined(INLCR) return doSetUnset (&t->c_iflag, INLCR, b); #else - return 0; + return false; #endif case igncr: #if defined(IGNCR) return doSetUnset (&t->c_iflag, IGNCR, b); #else - return 0; + return false; #endif case icrnl: #if defined(ICRNL) return doSetUnset (&t->c_iflag, ICRNL, b); #else - return 0; + return false; #endif case iuclc: #if defined(IUCLC) return doSetUnset (&t->c_iflag, IUCLC, b); #else - return 0; + return false; #endif case ixon: #if defined(IXON) return doSetUnset (&t->c_iflag, IXON, b); #else - return 0; + return false; #endif case ixany: #if defined(IXANY) return doSetUnset (&t->c_iflag, IXANY, b); #else - return 0; + return false; #endif case ixoff: #if defined(IXOFF) return doSetUnset (&t->c_iflag, IXOFF, b); #else - return 0; + return false; #endif case imaxbel: #if defined(IMAXBEL) return doSetUnset (&t->c_iflag, IMAXBEL, b); #else - return 0; + return false; #endif case opost: #if defined(OPOST) return doSetUnset (&t->c_oflag, OPOST, b); #else - return 0; + return false; #endif case olcuc: #if defined(OLCUC) return doSetUnset (&t->c_oflag, OLCUC, b); #else - return 0; + return false; #endif case onlcr: #if defined(ONLCR) return doSetUnset (&t->c_oflag, ONLCR, b); #else - return 0; + return false; #endif case ocrnl: #if defined(OCRNL) return doSetUnset (&t->c_oflag, OCRNL, b); #else - return 0; + return false; #endif case onocr: #if defined(ONOCR) return doSetUnset (&t->c_oflag, ONOCR, b); #else - return 0; + return false; #endif case onlret: #if defined(ONLRET) return doSetUnset (&t->c_oflag, ONLRET, b); #else - return 0; + return false; #endif case ofill: #if defined(OFILL) return doSetUnset (&t->c_oflag, OFILL, b); #else - return 0; + return false; #endif case ofdel: #if defined(OFDEL) return doSetUnset (&t->c_oflag, OFDEL, b); #else - return 0; + return false; #endif case onl0: #if defined(NL0) return doSetUnset (&t->c_oflag, NL0, b); #else - return 0; + return false; #endif case onl1: #if defined(NL1) return doSetUnset (&t->c_oflag, NL1, b); #else - return 0; + return false; #endif case ocr0: #if defined(CR0) return doSetUnset (&t->c_oflag, CR0, b); #else - return 0; + return false; #endif case ocr1: #if defined(CR1) return doSetUnset (&t->c_oflag, CR1, b); #else - return 0; + return false; #endif case ocr2: #if defined(CR2) return doSetUnset (&t->c_oflag, CR2, b); #else - return 0; + return false; #endif case ocr3: #if defined(CR3) return doSetUnset (&t->c_oflag, CR3, b); #else - return 0; + return false; #endif case otab0: #if defined(TAB0) return doSetUnset (&t->c_oflag, TAB0, b); #else - return 0; + return false; #endif case otab1: #if defined(TAB1) return doSetUnset (&t->c_oflag, TAB1, b); #else - return 0; + return false; #endif case otab2: #if defined(TAB2) return doSetUnset (&t->c_oflag, TAB2, b); #else - return 0; + return false; #endif case otab3: #if defined(TAB3) return doSetUnset (&t->c_oflag, TAB3, b); #else - return 0; + return false; #endif case obs0: #if defined(BS0) return doSetUnset (&t->c_oflag, BS0, b); #else - return 0; + return false; #endif case obs1: #if defined(BS1) return doSetUnset (&t->c_oflag, BS1, b); #else - return 0; + return false; #endif case off0: #if defined(FF0) return doSetUnset (&t->c_oflag, FF0, b); #else - return 0; + return false; #endif case off1: #if defined(FF1) return doSetUnset (&t->c_oflag, FF1, b); #else - return 0; + return false; #endif case ovt0: #if defined(VT0) return doSetUnset (&t->c_oflag, VT0, b); #else - return 0; + return false; #endif case ovt1: #if defined(VT1) return doSetUnset (&t->c_oflag, VT1, b); #else - return 0; + return false; #endif case b0: #if defined(B0) return doSetUnset (&t->c_cflag, B0, b); #else - return 0; + return false; #endif case b50: #if defined(B50) return doSetUnset (&t->c_cflag, B50, b); #else - return 0; + return false; #endif case b75: #if defined(B75) return doSetUnset (&t->c_cflag, B75, b); #else - return 0; + return false; #endif case b110: #if defined(B110) return doSetUnset (&t->c_cflag, B110, b); #else - return 0; + return false; #endif case b135: #if defined(B134) return doSetUnset (&t->c_cflag, B134, b); #else - return 0; + return false; #endif case b150: #if defined(B150) return doSetUnset (&t->c_cflag, B150, b); #else - return 0; + return false; #endif case b200: #if defined(B200) return doSetUnset (&t->c_cflag, B200, b); #else - return 0; + return false; #endif case b300: #if defined(B300) return doSetUnset (&t->c_cflag, B300, b); #else - return 0; + return false; #endif case b600: #if defined(B600) return doSetUnset (&t->c_cflag, B600, b); #else - return 0; + return false; #endif case b1200: #if defined(B1200) return doSetUnset (&t->c_cflag, B1200, b); #else - return 0; + return false; #endif case b1800: #if defined(B1800) return doSetUnset (&t->c_cflag, B1800, b); #else - return 0; + return false; #endif case b2400: #if defined(B2400) return doSetUnset (&t->c_cflag, B2400, b); #else - return 0; + return false; #endif case b4800: #if defined(B4800) return doSetUnset (&t->c_cflag, B4800, b); #else - return 0; + return false; #endif case b9600: #if defined(B9600) return doSetUnset (&t->c_cflag, B9600, b); #else - return 0; + return false; #endif case b19200: #if defined(B19200) return doSetUnset (&t->c_cflag, B19200, b); #else - return 0; + return false; #endif case b38400: #if defined(B38400) return doSetUnset (&t->c_cflag, B38400, b); #else - return 0; + return false; #endif case b57600: #if defined(B57600) return doSetUnset (&t->c_cflag, B57600, b); #else - return 0; + return false; #endif case b115200: #if defined(B115200) return doSetUnset (&t->c_cflag, B115200, b); #else - return 0; + return false; #endif case b240400: #if defined(B230400) return doSetUnset (&t->c_cflag, B230400, b); #else - return 0; + return false; #endif case b460800: #if defined(B460800) return doSetUnset (&t->c_cflag, B460800, b); #else - return 0; + return false; #endif case b500000: #if defined(B500000) return doSetUnset (&t->c_cflag, B500000, b); #else - return 0; + return false; #endif case b576000: #if defined(B576000) return doSetUnset (&t->c_cflag, B576000, b); #else - return 0; + return false; #endif case b921600: #if defined(B921600) return doSetUnset (&t->c_cflag, B921600, b); #else - return 0; + return false; #endif case b1000000: #if defined(B1000000) return doSetUnset (&t->c_cflag, B1000000, b); #else - return 0; + return false; #endif case b1152000: #if defined(B1152000) return doSetUnset (&t->c_cflag, B1152000, b); #else - return 0; + return false; #endif case b1500000: #if defined(B1500000) return doSetUnset (&t->c_cflag, B1500000, b); #else - return 0; + return false; #endif case b2000000: #if defined(B2000000) return doSetUnset (&t->c_cflag, B2000000, b); #else - return 0; + return false; #endif case b2500000: #if defined(B2500000) return doSetUnset (&t->c_cflag, B2500000, b); #else - return 0; + return false; #endif case b3000000: #if defined(B3000000) return doSetUnset (&t->c_cflag, B3000000, b); #else - return 0; + return false; #endif case b3500000: #if defined(B3500000) return doSetUnset (&t->c_cflag, B3500000, b); #else - return 0; + return false; #endif case b4000000: #if defined(B4000000) return doSetUnset (&t->c_cflag, B4000000, b); #else - return 0; + return false; #endif case maxbaud: #if defined(__MAX_BAUD) return doSetUnset (&t->c_cflag, __MAX_BAUD, b); #else - return 0; + return false; #endif case crtscts: #if defined(CRTSCTS) return doSetUnset (&t->c_cflag, CRTSCTS, b); #else - return 0; + return false; #endif case cs5: #if defined(CS5) return doSetUnset (&t->c_cflag, CS5, b); #else - return 0; + return false; #endif case cs6: #if defined(CS6) return doSetUnset (&t->c_cflag, CS6, b); #else - return 0; + return false; #endif case cs7: #if defined(CS7) return doSetUnset (&t->c_cflag, CS7, b); #else - return 0; + return false; #endif case cs8: #if defined(CS8) return doSetUnset (&t->c_cflag, CS8, b); #else - return 0; + return false; #endif case cstopb: #if defined(CSTOPB) return doSetUnset (&t->c_cflag, CSTOPB, b); #else - return 0; + return false; #endif case cread: #if defined(CREAD) return doSetUnset (&t->c_cflag, CREAD, b); #else - return 0; + return false; #endif case parenb: #if defined(PARENB) return doSetUnset (&t->c_cflag, PARENB, b); #else - return 0; + return false; #endif case parodd: #if defined(PARODD) return doSetUnset (&t->c_cflag, PARODD, b); #else - return 0; + return false; #endif case hupcl: #if defined(HUPCL) return doSetUnset (&t->c_cflag, HUPCL, b); #else - return 0; + return false; #endif case clocal: #if defined(CLOCAL) return doSetUnset (&t->c_cflag, CLOCAL, b); #else - return 0; + return false; #endif case lisig: #if defined(ISIG) return doSetUnset (&t->c_lflag, ISIG, b); #else - return 0; + return false; #endif case licanon: #if defined(ICANON) return doSetUnset (&t->c_lflag, ICANON, b); #else - return 0; + return false; #endif case lxcase: #if defined(XCASE) return doSetUnset (&t->c_lflag, XCASE, b); #else - return 0; + return false; #endif case lecho: #if defined(ECHO) return doSetUnset (&t->c_lflag, ECHO, b); #else - return 0; + return false; #endif case lechoe: #if defined(ECHOE) return doSetUnset (&t->c_lflag, ECHOE, b); #else - return 0; + return false; #endif case lechok: #if defined(ECHOK) return doSetUnset (&t->c_lflag, ECHOK, b); #else - return 0; + return false; #endif case lechonl: #if defined(ECHONL) return doSetUnset (&t->c_lflag, ECHONL, b); #else - return 0; + return false; #endif case lnoflsh: #if defined(NOFLSH) return doSetUnset (&t->c_lflag, NOFLSH, b); #else - return 0; + return false; #endif case ltopstop: #if defined(TOSTOP) return doSetUnset (&t->c_lflag, TOSTOP, b); #else - return 0; + return false; #endif case lechoctl: #if defined(ECHOCTL) return doSetUnset (&t->c_lflag, ECHOCTL, b); #else - return 0; + return false; #endif case lechoprt: #if defined(ECHOPRT) return doSetUnset (&t->c_lflag, ECHOPRT, b); #else - return 0; + return false; #endif case lechoke: #if defined(ECHOKE) return doSetUnset (&t->c_lflag, ECHOKE, b); #else - return 0; + return false; #endif case lflusho: #if defined(FLUSHO) return doSetUnset (&t->c_lflag, FLUSHO, b); #else - return 0; + return false; #endif case lpendin: #if defined(PENDIN) return doSetUnset (&t->c_lflag, PENDIN, b); #else - return 0; + return false; #endif case liexten: #if defined(IEXTEN) return doSetUnset (&t->c_lflag, IEXTEN, b); #else - return 0; + return false; #endif } - return 0; + return false; } -/* GetChar - sets a CHAR, ch, value from, t, and returns TRUE if this +/* GetChar sets a CHAR ch value from t and returns true/false if this value is supported. */ -int -EXPORT (GetChar) (struct termios *t, ControlChar c, char *ch) +bool +EXPORT (GetChar) (termios_TERMIOS _t, termios_ControlChar _c, char *ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { case vintr: #if defined(VINTR) *ch = t->c_cc[VINTR]; - return 1; + return true; #else - return 0; + return false; #endif case vquit: #if defined(VQUIT) *ch = t->c_cc[VQUIT]; - return 1; + return true; #else - return 0; + return false; #endif case verase: #if defined(VERASE) *ch = t->c_cc[VERASE]; - return 1; + return true; #else - return 0; + return false; #endif case vkill: #if defined(VKILL) *ch = t->c_cc[VKILL]; - return 1; + return true; #else - return 0; + return false; #endif case veof: #if defined(VEOF) *ch = t->c_cc[VEOF]; - return 1; + return true; #else - return 0; + return false; #endif case vtime: #if defined(VTIME) *ch = t->c_cc[VTIME]; - return 1; + return true; #else - return 0; + return false; #endif case vmin: #if defined(VMIN) *ch = t->c_cc[VMIN]; - return 1; + return true; #else - return 0; + return false; #endif case vswtc: #if defined(VSWTC) *ch = t->c_cc[VSWTC]; - return 1; + return true; #else - return 0; + return false; #endif case vstart: #if defined(VSTART) *ch = t->c_cc[VSTART]; - return 1; + return true; #else - return 0; + return false; #endif case vstop: #if defined(VSTOP) *ch = t->c_cc[VSTOP]; - return 1; + return true; #else - return 0; + return false; #endif case vsusp: #if defined(VSUSP) *ch = t->c_cc[VSUSP]; - return 1; + return true; #else - return 0; + return false; #endif case veol: #if defined(VEOL) *ch = t->c_cc[VEOL]; - return 1; + return true; #else - return 0; + return false; #endif case vreprint: #if defined(VREPRINT) *ch = t->c_cc[VREPRINT]; - return 1; + return true; #else - return 0; + return false; #endif case vdiscard: #if defined(VDISCARD) *ch = t->c_cc[VDISCARD]; - return 1; + return true; #else - return 0; + return false; #endif case vwerase: #if defined(VWERASE) *ch = t->c_cc[VWERASE]; - return 1; + return true; #else - return 0; + return false; #endif case vlnext: #if defined(VLNEXT) *ch = t->c_cc[VLNEXT]; - return 1; + return true; #else - return 0; + return false; #endif case veol2: #if defined(VEOL2) *ch = t->c_cc[VEOL2]; - return 1; + return true; #else - return 0; + return false; #endif default: - return 0; + return false; } } -/* SetChar - sets a CHAR value in, t, and returns TRUE if, c, is +/* SetChar sets a CHAR value in t and returns true/false if c is supported. */ -int -EXPORT (SetChar) (struct termios *t, ControlChar c, char ch) +bool +EXPORT (SetChar) (termios_TERMIOS _t, termios_ControlChar _c, char ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { case vintr: #if defined(VINTR) t->c_cc[VINTR] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vquit: #if defined(VQUIT) t->c_cc[VQUIT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case verase: #if defined(VERASE) t->c_cc[VERASE] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vkill: #if defined(VKILL) t->c_cc[VKILL] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veof: #if defined(VEOF) t->c_cc[VEOF] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vtime: #if defined(VTIME) t->c_cc[VTIME] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vmin: #if defined(VMIN) t->c_cc[VMIN] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vswtc: #if defined(VSWTC) t->c_cc[VSWTC] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vstart: #if defined(VSTART) t->c_cc[VSTART] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vstop: #if defined(VSTOP) t->c_cc[VSTOP] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vsusp: #if defined(VSUSP) t->c_cc[VSUSP] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veol: #if defined(VEOL) t->c_cc[VEOL] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vreprint: #if defined(VREPRINT) t->c_cc[VREPRINT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vdiscard: #if defined(VDISCARD) t->c_cc[VDISCARD] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vwerase: #if defined(VWERASE) t->c_cc[VWERASE] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vlnext: #if defined(VLNEXT) t->c_cc[VLNEXT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veol2: #if defined(VEOL2) t->c_cc[VEOL2] = ch; - return 1; + return true; #else - return 0; + return false; #endif default: - return 0; + return false; } } diff --git a/gcc/m2/mc-boot-ch/Gtermios.h b/gcc/m2/mc-boot-ch/Gtermios.h new file mode 100644 index 00000000000..acb7fcf0c76 --- /dev/null +++ b/gcc/m2/mc-boot-ch/Gtermios.h @@ -0,0 +1,208 @@ +/* do not edit automatically generated by mc from termios. */ +/* termios.def provides a procedural interface to termios. + +Copyright (C) 2005-2024 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +#if !defined (_termios_H) +# define _termios_H + +#include "config.h" +#include "system.h" +# ifdef __cplusplus +extern "C" { +# endif +#include +# if !defined (PROC_D) +# define PROC_D + typedef void (*PROC_t) (void); + typedef struct { PROC_t proc; } PROC; +# endif + +# include "GSYSTEM.h" + +# if defined (_termios_C) +# define EXTERN +# else +# define EXTERN extern +# endif + +typedef void *termios_TERMIOS; + +typedef enum {termios_vintr, termios_vquit, termios_verase, termios_vkill, termios_veof, termios_vtime, termios_vmin, termios_vswtc, termios_vstart, termios_vstop, termios_vsusp, termios_veol, termios_vreprint, termios_vdiscard, termios_vwerase, termios_vlnext, termios_veol2} termios_ControlChar; + +typedef enum {termios_ignbrk, termios_ibrkint, termios_ignpar, termios_iparmrk, termios_inpck, termios_istrip, termios_inlcr, termios_igncr, termios_icrnl, termios_iuclc, termios_ixon, termios_ixany, termios_ixoff, termios_imaxbel, termios_opost, termios_olcuc, termios_onlcr, termios_ocrnl, termios_onocr, termios_onlret, termios_ofill, termios_ofdel, termios_onl0, termios_onl1, termios_ocr0, termios_ocr1, termios_ocr2, termios_ocr3, termios_otab0, termios_otab1, termios_otab2, termios_otab3, termios_obs0, termios_obs1, termios_off0, termios_off1, termios_ovt0, termios_ovt1, termios_b0, termios_b50, termios_b75, termios_b110, termios_b135, termios_b150, termios_b200, termios_b300, termios_b600, termios_b1200, termios_b1800, termios_b2400, termios_b4800, termios_b9600, termios_b19200, termios_b38400, termios_b57600, termios_b115200, termios_b240400, termios_b460800, termios_b500000, termios_b576000, termios_b921600, termios_b1000000, termios_b1152000, termios_b1500000, termios_b2000000, termios_b2500000, termios_b3000000, termios_b3500000, termios_b4000000, termios_maxbaud, termios_crtscts, termios_cs5, termios_cs6, termios_cs7, termios_cs8, termios_cstopb, termios_cread, termios_parenb, termios_parodd, termios_hupcl, termios_clocal, termios_lisig, termios_licanon, termios_lxcase, termios_lecho, termios_lechoe, termios_lechok, termios_lechonl, termios_lnoflsh, termios_ltopstop, termios_lechoctl, termios_lechoprt, termios_lechoke, termios_lflusho, termios_lpendin, termios_liexten} termios_Flag; + + +/* + InitTermios - new data structure. +*/ + +EXTERN termios_TERMIOS termios_InitTermios (void); + +/* + KillTermios - delete data structure. +*/ + +EXTERN termios_TERMIOS termios_KillTermios (termios_TERMIOS t); + +/* + cfgetospeed - return output baud rate. +*/ + +EXTERN int termios_cfgetospeed (termios_TERMIOS t); + +/* + cfgetispeed - return input baud rate. +*/ + +EXTERN int termios_cfgetispeed (termios_TERMIOS t); + +/* + cfsetospeed - set output baud rate. +*/ + +EXTERN int termios_cfsetospeed (termios_TERMIOS t, unsigned int b); + +/* + cfsetispeed - set input baud rate. +*/ + +EXTERN int termios_cfsetispeed (termios_TERMIOS t, unsigned int b); + +/* + cfsetspeed - set input and output baud rate. +*/ + +EXTERN int termios_cfsetspeed (termios_TERMIOS t, unsigned int b); + +/* + tcgetattr - get state of, fd, into, t. +*/ + +EXTERN int termios_tcgetattr (int fd, termios_TERMIOS t); +EXTERN int termios_tcsnow (void); +EXTERN int termios_tcsdrain (void); +EXTERN int termios_tcsflush (void); + +/* + tcsetattr - set state of, fd, to, t, using option. +*/ + +EXTERN int termios_tcsetattr (int fd, int option, termios_TERMIOS t); + +/* + cfmakeraw - sets, t, to raw mode. +*/ + +EXTERN void termios_cfmakeraw (termios_TERMIOS t); + +/* + tcsendbreak - send zero bits for duration. +*/ + +EXTERN int termios_tcsendbreak (int fd, int duration); + +/* + tcdrain - waits for pending output to be written on, fd. +*/ + +EXTERN int termios_tcdrain (int fd); + +/* + tcflushi - flush input. +*/ + +EXTERN int termios_tcflushi (int fd); + +/* + tcflusho - flush output. +*/ + +EXTERN int termios_tcflusho (int fd); + +/* + tcflushio - flush input and output. +*/ + +EXTERN int termios_tcflushio (int fd); + +/* + tcflowoni - restart input on, fd. +*/ + +EXTERN int termios_tcflowoni (int fd); + +/* + tcflowoffi - stop input on, fd. +*/ + +EXTERN int termios_tcflowoffi (int fd); + +/* + tcflowono - restart output on, fd. +*/ + +EXTERN int termios_tcflowono (int fd); + +/* + tcflowoffo - stop output on, fd. +*/ + +EXTERN int termios_tcflowoffo (int fd); + +/* + GetFlag - sets a flag value from, t, in, b, and returns TRUE + if, t, supports, f. +*/ + +EXTERN bool termios_GetFlag (termios_TERMIOS t, termios_Flag f, bool *b); + +/* + SetFlag - sets a flag value in, t, to, b, and returns TRUE if + this flag value is supported. +*/ + +EXTERN bool termios_SetFlag (termios_TERMIOS t, termios_Flag f, bool b); + +/* + GetChar - sets a CHAR, ch, value from, t, and returns TRUE if + this value is supported. +*/ + +EXTERN bool termios_GetChar (termios_TERMIOS t, termios_ControlChar c, char *ch); + +/* + SetChar - sets a CHAR value in, t, and returns TRUE if, c, + is supported. +*/ + +EXTERN bool termios_SetChar (termios_TERMIOS t, termios_ControlChar c, char ch); +# ifdef __cplusplus +} +# endif + +# undef EXTERN +#endif diff --git a/gcc/m2/pge-boot/GM2RTS.cc b/gcc/m2/pge-boot/GM2RTS.cc index 5214c42ae9b..ef5f7cf5ce1 100644 --- a/gcc/m2/pge-boot/GM2RTS.cc +++ b/gcc/m2/pge-boot/GM2RTS.cc @@ -25,6 +25,8 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +#include "config.h" +#include "system.h" #include # if !defined (PROC_D) # define PROC_D @@ -40,13 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # define FALSE (1==0) # endif -#include -#include -#include -#include -#define _M2RTS_H #define _M2RTS_C +#include "GM2RTS.h" # include "Glibc.h" # include "GNumberIO.h" # include "GStrLib.h" @@ -62,9 +60,6 @@ typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; # define stderrFd 2 typedef char *M2RTS_PtrToChar; -typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); -struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; - static int ExitValue; static bool isHalting; static bool CallExit; @@ -138,7 +133,7 @@ extern "C" void M2RTS_ExecuteTerminationProcedures (void); not call ExecuteTerminationProcedures. */ -extern "C" void M2RTS_Terminate (void); +extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn)); /* HALT - terminate the current program. The procedure @@ -151,7 +146,7 @@ extern "C" void M2RTS_Terminate (void); then calling HALT with no parameter. */ -extern "C" void M2RTS_HALT (int exitcode); +extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); /* Halt - provides a more user friendly version of HALT, which takes @@ -159,7 +154,7 @@ extern "C" void M2RTS_HALT (int exitcode); to stderr and calls exit (1). */ -extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line); +extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line) __attribute__ ((noreturn)); /* HaltC - provides a more user friendly version of HALT, which takes @@ -167,7 +162,7 @@ extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_ to stderr and calls exit (1). */ -extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line); +extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn)); /* ExitOnHalt - if HALT is executed then call exit with the exit code, e. @@ -179,7 +174,7 @@ extern "C" void M2RTS_ExitOnHalt (int e); ErrorMessage - emits an error message to stderr and then calls exit (1). */ -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high); +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); /* Length - returns the length of a string, a. This is called whenever @@ -188,30 +183,30 @@ extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_ */ extern "C" unsigned int M2RTS_Length (const char *a_, unsigned int _a_high); -extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); +extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); +extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); /* ErrorString - writes a string to stderr. @@ -229,7 +224,7 @@ static void ErrorStringC (void * str); ErrorMessageC - emits an error message to stderr and then calls exit (1). */ -static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function); +static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn)); /* Init - initialize the initial, terminate procedure lists and booleans. @@ -259,7 +254,7 @@ static void ErrorString (const char *a_, unsigned int _a_high) /* make a local copy of each unbounded array. */ memcpy (a, a_, _a_high+1); - n = static_cast (libc_write (stderrFd, &a, static_cast (StrLib_StrLen ((const char *) a, _a_high)))); + n = static_cast (libc_write (stderrFd, const_cast (static_cast(a)), static_cast (StrLib_StrLen ((const char *) a, _a_high)))); } @@ -714,11 +709,11 @@ extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), filename, line, column, scope, message); } -extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) +extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[]) { CheckInitialized (); } -extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) +extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[]) { } diff --git a/gcc/m2/pge-boot/GSysExceptions.cc b/gcc/m2/pge-boot/GSysExceptions.cc index d16197dbcc7..de8bab91c57 100644 --- a/gcc/m2/pge-boot/GSysExceptions.cc +++ b/gcc/m2/pge-boot/GSysExceptions.cc @@ -24,6 +24,16 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "gm2-libs-host.h" +#ifdef MC_M2 +#include "GSysExceptions.h" +#define DECL_PROC_T(X) SysExceptions_PROCEXCEPTION X +#define PROC_FUNC(X) X.proc +#else +#define DECL_PROC_T(X) void (*X) (void *) +#define PROC_FUNC(X) X +#endif + +#undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" #else @@ -68,13 +78,11 @@ along with GNU Modula-2; see the file COPYING3. If not see #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 - (indexException, rangeException, caseSelectException, invalidLocation, functionException, wholeValueException, wholeDivException, realValueException, realDivException, complexValueException, complexDivException, protException, sysException, coException, exException ); - #endif /* wholeDivException and realDivException are caught by SIGFPE @@ -106,6 +114,7 @@ static void (*systemProc) (void *); static void (*coroutineProc) (void *); static void (*exceptionProc) (void *); + static void sigbusDespatcher (int signum, siginfo_t *info, void *ucontext) { @@ -159,32 +168,39 @@ sigfpeDespatcher (int signum, siginfo_t *info, void *ucontext) EXTERN void -SysExceptions_InitExceptionHandlers ( - void (*indexf) (void *), void (*range) (void *), void (*casef) (void *), - void (*invalidloc) (void *), void (*function) (void *), - void (*wholevalue) (void *), void (*wholediv) (void *), - void (*realvalue) (void *), void (*realdiv) (void *), - void (*complexvalue) (void *), void (*complexdiv) (void *), - void (*protection) (void *), void (*systemf) (void *), - void (*coroutine) (void *), void (*exception) (void *)) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { struct sigaction old; - indexProc = indexf; - rangeProc = range; - caseProc = casef; - invalidlocProc = invalidloc; - functionProc = function; - wholevalueProc = wholevalue; - wholedivProc = wholediv; - realvalueProc = realvalue; - realdivProc = realdiv; - complexvalueProc = complexvalue; - complexdivProc = complexdiv; - protectionProc = protection; - systemProc = systemf; - coroutineProc = coroutine; - exceptionProc = exception; + indexProc = PROC_FUNC (indexf); + rangeProc = PROC_FUNC (range); + caseProc = PROC_FUNC (casef); + invalidlocProc = PROC_FUNC (invalidloc); + functionProc = PROC_FUNC (function); + wholevalueProc = PROC_FUNC (wholevalue); + wholedivProc = PROC_FUNC (wholediv); + realvalueProc = PROC_FUNC (realvalue); + realdivProc = PROC_FUNC (realdiv); + complexvalueProc = PROC_FUNC (complexvalue); + complexdivProc = PROC_FUNC (complexdiv); + protectionProc = PROC_FUNC (protection); + systemProc = PROC_FUNC (systemf); + coroutineProc = PROC_FUNC (coroutine); + exceptionProc = PROC_FUNC (exception); sigbus.sa_sigaction = sigbusDespatcher; sigbus.sa_flags = (SA_SIGINFO); @@ -211,13 +227,21 @@ SysExceptions_InitExceptionHandlers ( #else EXTERN void -SysExceptions_InitExceptionHandlers (void *indexf, void *range, void *casef, - void *invalidloc, void *function, - void *wholevalue, void *wholediv, - void *realvalue, void *realdiv, - void *complexvalue, void *complexdiv, - void *protection, void *systemf, - void *coroutine, void *exception) +SysExceptions_InitExceptionHandlers (DECL_PROC_T(indexf), + DECL_PROC_T(range), + DECL_PROC_T(casef), + DECL_PROC_T(invalidloc), + DECL_PROC_T(function), + DECL_PROC_T(wholevalue), + DECL_PROC_T(wholediv), + DECL_PROC_T(realvalue), + DECL_PROC_T(realdiv), + DECL_PROC_T(complexvalue), + DECL_PROC_T(complexdiv), + DECL_PROC_T(protection), + DECL_PROC_T(systemf), + DECL_PROC_T(coroutine), + DECL_PROC_T(exception)) { } #endif diff --git a/gcc/m2/pge-boot/Gtermios.cc b/gcc/m2/pge-boot/Gtermios.cc index 55220e7624e..fe20afb767f 100644 --- a/gcc/m2/pge-boot/Gtermios.cc +++ b/gcc/m2/pge-boot/Gtermios.cc @@ -24,6 +24,9 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "gm2-libs-host.h" +#define _termios_C +#include "Gtermios.h" + #ifdef HAVE_TERMIOS_H # include #endif @@ -193,13 +196,13 @@ EXPORT (InitTermios) (void) /* KillTermios - delete data structure. */ void * -EXPORT (KillTermios) (struct termios *p) +EXPORT (KillTermios) (termios_TERMIOS p) { free (p); return NULL; } -/* tcsnow - return the value of TCSANOW. */ +/* tcsnow return the value of TCSANOW. */ int EXPORT (tcsnow) (void) @@ -207,7 +210,7 @@ EXPORT (tcsnow) (void) return TCSANOW; } -/* tcsdrain - return the value of TCSADRAIN. */ +/* tcsdrain return the value of TCSADRAIN. */ int EXPORT (tcsdrain) (void) @@ -215,7 +218,7 @@ EXPORT (tcsdrain) (void) return TCSADRAIN; } -/* tcsflush - return the value of TCSAFLUSH. */ +/* tcsflush return the value of TCSAFLUSH. */ int EXPORT (tcsflush) (void) @@ -223,43 +226,48 @@ EXPORT (tcsflush) (void) return TCSAFLUSH; } -/* cfgetospeed - return output baud rate. */ +/* cfgetospeed return output baud rate. */ int -EXPORT (cfgetospeed) (struct termios *t) +EXPORT (cfgetospeed) (termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return cfgetospeed (t); } -/* cfgetispeed - return input baud rate. */ +/* cfgetispeed return input baud rate. */ int -EXPORT (cfgetispeed) (struct termios *t) +EXPORT (cfgetispeed) (termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return cfgetispeed (t); } -/* cfsetospeed - set output baud rate. */ +/* cfsetospeed set output baud rate. */ int -EXPORT (cfsetospeed) (struct termios *t, unsigned int b) +EXPORT (cfsetospeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; return cfsetospeed (t, b); } -/* cfsetispeed - set input baud rate. */ +/* cfsetispeed set input baud rate. */ int -EXPORT (cfsetispeed) (struct termios *t, unsigned int b) +EXPORT (cfsetispeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; return cfsetispeed (t, b); } -/* cfsetspeed - set input and output baud rate. */ +/* cfsetspeed set input and output baud rate. */ int -EXPORT (cfsetspeed) (struct termios *t, unsigned int b) +EXPORT (cfsetspeed) (termios_TERMIOS _t, unsigned int b) { + struct termios *t = (termios *)_t; int val = cfsetispeed (t, b); if (val == 0) return cfsetospeed (t, b); @@ -267,33 +275,36 @@ EXPORT (cfsetspeed) (struct termios *t, unsigned int b) return val; } -/* tcgetattr - get state of, fd, into, t. */ +/* tcgetattr get state of fd into t. */ int -EXPORT (tcgetattr) (int fd, struct termios *t) +EXPORT (tcgetattr) (int fd, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcgetattr (fd, t); } -/* tcsetattr - set state of, fd, to, t, using option. */ +/* tcsetattr set state of fd to t using option. */ int -EXPORT (tcsetattr) (int fd, int option, struct termios *t) +EXPORT (tcsetattr) (int fd, int option, termios_TERMIOS _t) { + struct termios *t = (termios *)_t; return tcsetattr (fd, option, t); } -/* cfmakeraw - sets the terminal to raw mode. */ +/* cfmakeraw sets the terminal to raw mode. */ void -EXPORT (cfmakeraw) (struct termios *t) +EXPORT (cfmakeraw) (termios_TERMIOS _t) { #if defined(HAVE_CFMAKERAW) + struct termios *t = (termios *)_t; cfmakeraw (t); #endif } -/* tcsendbreak - send zero bits for duration. */ +/* tcsendbreak send zero bits for duration. */ int EXPORT (tcsendbreak) (int fd, int duration) @@ -301,7 +312,7 @@ EXPORT (tcsendbreak) (int fd, int duration) return tcsendbreak (fd, duration); } -/* tcdrain - waits for pending output to be written on, fd. */ +/* tcdrain waits for pending output to be written on fd. */ int EXPORT (tcdrain) (int fd) @@ -309,7 +320,7 @@ EXPORT (tcdrain) (int fd) return tcdrain (fd); } -/* tcflushi - flush input. */ +/* tcflushi flush input. */ int EXPORT (tcflushi) (int fd) @@ -321,7 +332,7 @@ EXPORT (tcflushi) (int fd) #endif } -/* tcflusho - flush output. */ +/* tcflusho flush output. */ int EXPORT (tcflusho) (int fd) @@ -333,7 +344,7 @@ EXPORT (tcflusho) (int fd) #endif } -/* tcflushio - flush input and output. */ +/* tcflushio flush input and output. */ int EXPORT (tcflushio) (int fd) @@ -345,7 +356,7 @@ EXPORT (tcflushio) (int fd) #endif } -/* tcflowoni - restart input on, fd. */ +/* tcflowoni restart input on fd. */ int EXPORT (tcflowoni) (int fd) @@ -357,7 +368,7 @@ EXPORT (tcflowoni) (int fd) #endif } -/* tcflowoffi - stop input on, fd. */ +/* tcflowoffi stop input on fd. */ int EXPORT (tcflowoffi) (int fd) @@ -369,7 +380,7 @@ EXPORT (tcflowoffi) (int fd) #endif } -/* tcflowono - restart output on, fd. */ +/* tcflowono restart output on fd. */ int EXPORT (tcflowono) (int fd) @@ -381,7 +392,7 @@ EXPORT (tcflowono) (int fd) #endif } -/* tcflowoffo - stop output on, fd. */ +/* tcflowoffo stop output on fd. */ int EXPORT (tcflowoffo) (int fd) @@ -393,1542 +404,1551 @@ EXPORT (tcflowoffo) (int fd) #endif } -/* GetFlag - sets a flag value from, t, in, b, and returns TRUE if, - t, supports, f. */ +/* GetFlag sets a flag value from t in b and returns TRUE if + t supports f. */ -int -EXPORT (GetFlag) (struct termios *t, Flag f, int *b) +bool +EXPORT (GetFlag) (termios_TERMIOS _t, termios_Flag _f, bool *b) { + Flag f = (Flag) _f; + struct termios *t = (termios *)_t; switch (f) { case ignbrk: #if defined(IGNBRK) *b = ((t->c_iflag & IGNBRK) == IGNBRK); - return 1; + return true; #else - return 0; + return false; #endif case ibrkint: #if defined(BRKINT) *b = ((t->c_iflag & BRKINT) == BRKINT); - return 1; + return true; #else - return 0; + return false; #endif case ignpar: #if defined(IGNPAR) *b = ((t->c_iflag & IGNPAR) == IGNPAR); - return 1; + return true; #else - return 0; + return false; #endif case iparmrk: #if defined(PARMRK) *b = ((t->c_iflag & PARMRK) == PARMRK); - return 1; + return true; #else - return 0; + return false; #endif case inpck: #if defined(INPCK) *b = ((t->c_iflag & INPCK) == INPCK); - return 1; + return true; #else - return 0; + return false; #endif case istrip: #if defined(ISTRIP) *b = ((t->c_iflag & ISTRIP) == ISTRIP); - return 1; + return true; #else - return 0; + return false; #endif case inlcr: #if defined(INLCR) *b = ((t->c_iflag & INLCR) == INLCR); - return 1; + return true; #else - return 0; + return false; #endif case igncr: #if defined(IGNCR) *b = ((t->c_iflag & IGNCR) == IGNCR); - return 1; + return true; #else - return 0; + return false; #endif case icrnl: #if defined(ICRNL) *b = ((t->c_iflag & ICRNL) == ICRNL); - return 1; + return true; #else - return 0; + return false; #endif case iuclc: #if defined(IUCLC) *b = ((t->c_iflag & IUCLC) == IUCLC); - return 1; + return true; #else - return 0; + return false; #endif case ixon: #if defined(IXON) *b = ((t->c_iflag & IXON) == IXON); - return 1; + return true; #else - return 0; + return false; #endif case ixany: #if defined(IXANY) *b = ((t->c_iflag & IXANY) == IXANY); - return 1; + return true; #else - return 0; + return false; #endif case ixoff: #if defined(IXOFF) *b = ((t->c_iflag & IXOFF) == IXOFF); - return 1; + return true; #else - return 0; + return false; #endif case imaxbel: #if defined(IMAXBEL) *b = ((t->c_iflag & IMAXBEL) == IMAXBEL); - return 1; + return true; #else - return 0; + return false; #endif case opost: #if defined(OPOST) *b = ((t->c_oflag & OPOST) == OPOST); - return 1; + return true; #else - return 0; + return false; #endif case olcuc: #if defined(OLCUC) *b = ((t->c_oflag & OLCUC) == OLCUC); - return 1; + return true; #else - return 0; + return false; #endif case onlcr: #if defined(ONLCR) *b = ((t->c_oflag & ONLCR) == ONLCR); - return 1; + return true; #else - return 0; + return false; #endif case ocrnl: #if defined(OCRNL) *b = ((t->c_oflag & OCRNL) == OCRNL); - return 1; + return true; #else - return 0; + return false; #endif case onocr: #if defined(ONOCR) *b = ((t->c_oflag & ONOCR) == ONOCR); - return 1; + return true; #else - return 0; + return false; #endif case onlret: #if defined(ONLRET) *b = ((t->c_oflag & ONLRET) == ONLRET); - return 1; + return true; #else - return 0; + return false; #endif case ofill: #if defined(OFILL) *b = ((t->c_oflag & OFILL) == OFILL); - return 1; + return true; #else - return 0; + return false; #endif case ofdel: #if defined(OFDEL) *b = ((t->c_oflag & OFDEL) == OFDEL); - return 1; + return true; #else - return 0; + return false; #endif case onl0: #if defined(NL0) *b = ((t->c_oflag & NL0) == NL0); - return 1; + return true; #else - return 0; + return false; #endif case onl1: #if defined(NL1) *b = ((t->c_oflag & NL1) == NL1); - return 1; + return true; #else - return 0; + return false; #endif case ocr0: #if defined(CR0) *b = ((t->c_oflag & CR0) == CR0); - return 1; + return true; #else - return 0; + return false; #endif case ocr1: #if defined(CR1) *b = ((t->c_oflag & CR1) == CR1); - return 1; + return true; #else - return 0; + return false; #endif case ocr2: #if defined(CR2) *b = ((t->c_oflag & CR2) == CR2); - return 1; + return true; #else - return 0; + return false; #endif case ocr3: #if defined(CR3) *b = ((t->c_oflag & CR3) == CR3); - return 1; + return true; #else - return 0; + return false; #endif case otab0: #if defined(TAB0) *b = ((t->c_oflag & TAB0) == TAB0); - return 1; + return true; #else - return 0; + return false; #endif case otab1: #if defined(TAB1) *b = ((t->c_oflag & TAB1) == TAB1); - return 1; + return true; #else - return 0; + return false; #endif case otab2: #if defined(TAB2) *b = ((t->c_oflag & TAB2) == TAB2); - return 1; + return true; #else - return 0; + return false; #endif case otab3: #if defined(TAB3) *b = ((t->c_oflag & TAB3) == TAB3); - return 1; + return true; #else - return 0; + return false; #endif case obs0: #if defined(BS0) *b = ((t->c_oflag & BS0) == BS0); - return 1; + return true; #else - return 0; + return false; #endif case obs1: #if defined(BS1) *b = ((t->c_oflag & BS1) == BS1); - return 1; + return true; #else - return 0; + return false; #endif case off0: #if defined(FF0) *b = ((t->c_oflag & FF0) == FF0); - return 1; + return true; #else - return 0; + return false; #endif case off1: #if defined(FF1) *b = ((t->c_oflag & FF1) == FF1); - return 1; + return true; #else - return 0; + return false; #endif case ovt0: #if defined(VT0) *b = ((t->c_oflag & VT0) == VT0); - return 1; + return true; #else - return 0; + return false; #endif case ovt1: #if defined(VT1) *b = ((t->c_oflag & VT1) == VT1); - return 1; + return true; #else - return 0; + return false; #endif case b0: #if defined(B0) *b = ((t->c_cflag & B0) == B0); - return 1; + return true; #else - return 0; + return false; #endif case b50: #if defined(B50) *b = ((t->c_cflag & B50) == B50); - return 1; + return true; #else - return 0; + return false; #endif case b75: #if defined(B75) *b = ((t->c_cflag & B75) == B75); - return 1; + return true; #else - return 0; + return false; #endif case b110: #if defined(B110) *b = ((t->c_cflag & B110) == B110); - return 1; + return true; #else - return 0; + return false; #endif case b135: #if defined(B134) *b = ((t->c_cflag & B134) == B134); - return 1; + return true; #else - return 0; + return false; #endif case b150: #if defined(B150) *b = ((t->c_cflag & B150) == B150); - return 1; + return true; #else - return 0; + return false; #endif case b200: #if defined(B200) *b = ((t->c_cflag & B200) == B200); - return 1; + return true; #else - return 0; + return false; #endif case b300: #if defined(B300) *b = ((t->c_cflag & B300) == B300); - return 1; + return true; #else - return 0; + return false; #endif case b600: #if defined(B600) *b = ((t->c_cflag & B600) == B600); - return 1; + return true; #else - return 0; + return false; #endif case b1200: #if defined(B1200) *b = ((t->c_cflag & B1200) == B1200); - return 1; + return true; #else - return 0; + return false; #endif case b1800: #if defined(B1800) *b = ((t->c_cflag & B1800) == B1800); - return 1; + return true; #else - return 0; + return false; #endif case b2400: #if defined(B2400) *b = ((t->c_cflag & B2400) == B2400); - return 1; + return true; #else - return 0; + return false; #endif case b4800: #if defined(B4800) *b = ((t->c_cflag & B4800) == B4800); - return 1; + return true; #else - return 0; + return false; #endif case b9600: #if defined(B9600) *b = ((t->c_cflag & B9600) == B9600); - return 1; + return true; #else - return 0; + return false; #endif case b19200: #if defined(B19200) *b = ((t->c_cflag & B19200) == B19200); - return 1; + return true; #else - return 0; + return false; #endif case b38400: #if defined(B38400) *b = ((t->c_cflag & B38400) == B38400); - return 1; + return true; #else - return 0; + return false; #endif case b57600: #if defined(B57600) *b = ((t->c_cflag & B57600) == B57600); - return 1; + return true; #else - return 0; + return false; #endif case b115200: #if defined(B115200) *b = ((t->c_cflag & B115200) == B115200); - return 1; + return true; #else - return 0; + return false; #endif case b240400: #if defined(B230400) *b = ((t->c_cflag & B230400) == B230400); - return 1; + return true; #else - return 0; + return false; #endif case b460800: #if defined(B460800) *b = ((t->c_cflag & B460800) == B460800); - return 1; + return true; #else - return 0; + return false; #endif case b500000: #if defined(B500000) *b = ((t->c_cflag & B500000) == B500000); - return 1; + return true; #else - return 0; + return false; #endif case b576000: #if defined(B576000) *b = ((t->c_cflag & B576000) == B576000); - return 1; + return true; #else - return 0; + return false; #endif case b921600: #if defined(B921600) *b = ((t->c_cflag & B921600) == B921600); - return 1; + return true; #else - return 0; + return false; #endif case b1000000: #if defined(B1000000) *b = ((t->c_cflag & B1000000) == B1000000); - return 1; + return true; #else - return 0; + return false; #endif case b1152000: #if defined(B1152000) *b = ((t->c_cflag & B1152000) == B1152000); - return 1; + return true; #else - return 0; + return false; #endif case b1500000: #if defined(B1500000) *b = ((t->c_cflag & B1500000) == B1500000); - return 1; + return true; #else - return 0; + return false; #endif case b2000000: #if defined(B2000000) *b = ((t->c_cflag & B2000000) == B2000000); - return 1; + return true; #else - return 0; + return false; #endif case b2500000: #if defined(B2500000) *b = ((t->c_cflag & B2500000) == B2500000); - return 1; + return true; #else - return 0; + return false; #endif case b3000000: #if defined(B3000000) *b = ((t->c_cflag & B3000000) == B3000000); - return 1; + return true; #else - return 0; + return false; #endif case b3500000: #if defined(B3500000) *b = ((t->c_cflag & B3500000) == B3500000); - return 1; + return true; #else - return 0; + return false; #endif case b4000000: #if defined(B4000000) *b = ((t->c_cflag & B4000000) == B4000000); - return 1; + return true; #else - return 0; + return false; #endif case maxbaud: #if defined(__MAX_BAUD) *b = ((t->c_cflag & __MAX_BAUD) == __MAX_BAUD); - return 1; + return true; #else - return 0; + return false; #endif case crtscts: #if defined(CRTSCTS) *b = ((t->c_cflag & CRTSCTS) == CRTSCTS); - return 1; + return true; #else - return 0; + return false; #endif case cs5: #if defined(CS5) *b = ((t->c_cflag & CS5) == CS5); - return 1; + return true; #else - return 0; + return false; #endif case cs6: #if defined(CS6) *b = ((t->c_cflag & CS6) == CS6); - return 1; + return true; #else - return 0; + return false; #endif case cs7: #if defined(CS7) *b = ((t->c_cflag & CS7) == CS7); - return 1; + return true; #else - return 0; + return false; #endif case cs8: #if defined(CS8) *b = ((t->c_cflag & CS8) == CS8); - return 1; + return true; #else - return 0; + return false; #endif case cstopb: #if defined(CSTOPB) *b = ((t->c_cflag & CSTOPB) == CSTOPB); - return 1; + return true; #else - return 0; + return false; #endif case cread: #if defined(CREAD) *b = ((t->c_cflag & CREAD) == CREAD); - return 1; + return true; #else - return 0; + return false; #endif case parenb: #if defined(PARENB) *b = ((t->c_cflag & PARENB) == PARENB); - return 1; + return true; #else - return 0; + return false; #endif case parodd: #if defined(PARODD) *b = ((t->c_cflag & PARODD) == PARODD); - return 1; + return true; #else - return 0; + return false; #endif case hupcl: #if defined(HUPCL) *b = ((t->c_cflag & HUPCL) == HUPCL); - return 1; + return true; #else - return 0; + return false; #endif case clocal: #if defined(CLOCAL) *b = ((t->c_cflag & CLOCAL) == CLOCAL); - return 1; + return true; #else - return 0; + return false; #endif case lisig: #if defined(ISIG) *b = ((t->c_lflag & ISIG) == ISIG); - return 1; + return true; #else - return 0; + return false; #endif case licanon: #if defined(ICANON) *b = ((t->c_lflag & ICANON) == ICANON); - return 1; + return true; #else - return 0; + return false; #endif case lxcase: #if defined(XCASE) *b = ((t->c_lflag & XCASE) == XCASE); - return 1; + return true; #else - return 0; + return false; #endif case lecho: #if defined(ECHO) *b = ((t->c_lflag & ECHO) == ECHO); - return 1; + return true; #else - return 0; + return false; #endif case lechoe: #if defined(ECHOE) *b = ((t->c_lflag & ECHOE) == ECHOE); - return 1; + return true; #else - return 0; + return false; #endif case lechok: #if defined(ECHOK) *b = ((t->c_lflag & ECHOK) == ECHOK); - return 1; + return true; #else - return 0; + return false; #endif case lechonl: #if defined(ECHONL) *b = ((t->c_lflag & ECHONL) == ECHONL); - return 1; + return true; #else - return 0; + return false; #endif case lnoflsh: #if defined(NOFLSH) *b = ((t->c_lflag & NOFLSH) == NOFLSH); - return 1; + return true; #else - return 0; + return false; #endif case ltopstop: #if defined(TOSTOP) *b = ((t->c_lflag & TOSTOP) == TOSTOP); - return 1; + return true; #else - return 0; + return false; #endif case lechoctl: #if defined(ECHOCTL) *b = ((t->c_lflag & ECHOCTL) == ECHOCTL); - return 1; + return true; #else - return 0; + return false; #endif case lechoprt: #if defined(ECHOPRT) *b = ((t->c_lflag & ECHOPRT) == ECHOPRT); - return 1; + return true; #else - return 0; + return false; #endif case lechoke: #if defined(ECHOKE) *b = ((t->c_lflag & ECHOKE) == ECHOKE); - return 1; + return true; #else - return 0; + return false; #endif case lflusho: #if defined(FLUSHO) *b = ((t->c_lflag & FLUSHO) == FLUSHO); - return 1; + return true; #else - return 0; + return false; #endif case lpendin: #if defined(PENDIN) *b = ((t->c_lflag & PENDIN) == PENDIN); - return 1; + return true; #else - return 0; + return false; #endif case liexten: #if defined(IEXTEN) *b = ((t->c_lflag & IEXTEN) == IEXTEN); - return 1; + return true; #else - return 0; + return false; #endif } - return 0; + return false; } -/* SetFlag - sets a flag value in, t, to, b, and returns TRUE if this +/* SetFlag sets a flag value in t to b and returns TRUE if this flag value is supported. */ bool -EXPORT (SetFlag) (struct termios *t, Flag f, bool b) +EXPORT (SetFlag) (termios_TERMIOS _t, termios_Flag _f, bool b) { + struct termios *t = (struct termios *) _t; + Flag f = (Flag) _f; + switch (f) { case ignbrk: #if defined(IGNBRK) return doSetUnset (&t->c_iflag, IGNBRK, b); #else - return 0; + return false; #endif case ibrkint: #if defined(BRKINT) return doSetUnset (&t->c_iflag, BRKINT, b); #else - return 0; + return false; #endif case ignpar: #if defined(IGNPAR) return doSetUnset (&t->c_iflag, IGNPAR, b); #else - return 0; + return false; #endif case iparmrk: #if defined(PARMRK) return doSetUnset (&t->c_iflag, PARMRK, b); #else - return 0; + return false; #endif case inpck: #if defined(INPCK) return doSetUnset (&t->c_iflag, INPCK, b); #else - return 0; + return false; #endif case istrip: #if defined(ISTRIP) return doSetUnset (&t->c_iflag, ISTRIP, b); #else - return 0; + return false; #endif case inlcr: #if defined(INLCR) return doSetUnset (&t->c_iflag, INLCR, b); #else - return 0; + return false; #endif case igncr: #if defined(IGNCR) return doSetUnset (&t->c_iflag, IGNCR, b); #else - return 0; + return false; #endif case icrnl: #if defined(ICRNL) return doSetUnset (&t->c_iflag, ICRNL, b); #else - return 0; + return false; #endif case iuclc: #if defined(IUCLC) return doSetUnset (&t->c_iflag, IUCLC, b); #else - return 0; + return false; #endif case ixon: #if defined(IXON) return doSetUnset (&t->c_iflag, IXON, b); #else - return 0; + return false; #endif case ixany: #if defined(IXANY) return doSetUnset (&t->c_iflag, IXANY, b); #else - return 0; + return false; #endif case ixoff: #if defined(IXOFF) return doSetUnset (&t->c_iflag, IXOFF, b); #else - return 0; + return false; #endif case imaxbel: #if defined(IMAXBEL) return doSetUnset (&t->c_iflag, IMAXBEL, b); #else - return 0; + return false; #endif case opost: #if defined(OPOST) return doSetUnset (&t->c_oflag, OPOST, b); #else - return 0; + return false; #endif case olcuc: #if defined(OLCUC) return doSetUnset (&t->c_oflag, OLCUC, b); #else - return 0; + return false; #endif case onlcr: #if defined(ONLCR) return doSetUnset (&t->c_oflag, ONLCR, b); #else - return 0; + return false; #endif case ocrnl: #if defined(OCRNL) return doSetUnset (&t->c_oflag, OCRNL, b); #else - return 0; + return false; #endif case onocr: #if defined(ONOCR) return doSetUnset (&t->c_oflag, ONOCR, b); #else - return 0; + return false; #endif case onlret: #if defined(ONLRET) return doSetUnset (&t->c_oflag, ONLRET, b); #else - return 0; + return false; #endif case ofill: #if defined(OFILL) return doSetUnset (&t->c_oflag, OFILL, b); #else - return 0; + return false; #endif case ofdel: #if defined(OFDEL) return doSetUnset (&t->c_oflag, OFDEL, b); #else - return 0; + return false; #endif case onl0: #if defined(NL0) return doSetUnset (&t->c_oflag, NL0, b); #else - return 0; + return false; #endif case onl1: #if defined(NL1) return doSetUnset (&t->c_oflag, NL1, b); #else - return 0; + return false; #endif case ocr0: #if defined(CR0) return doSetUnset (&t->c_oflag, CR0, b); #else - return 0; + return false; #endif case ocr1: #if defined(CR1) return doSetUnset (&t->c_oflag, CR1, b); #else - return 0; + return false; #endif case ocr2: #if defined(CR2) return doSetUnset (&t->c_oflag, CR2, b); #else - return 0; + return false; #endif case ocr3: #if defined(CR3) return doSetUnset (&t->c_oflag, CR3, b); #else - return 0; + return false; #endif case otab0: #if defined(TAB0) return doSetUnset (&t->c_oflag, TAB0, b); #else - return 0; + return false; #endif case otab1: #if defined(TAB1) return doSetUnset (&t->c_oflag, TAB1, b); #else - return 0; + return false; #endif case otab2: #if defined(TAB2) return doSetUnset (&t->c_oflag, TAB2, b); #else - return 0; + return false; #endif case otab3: #if defined(TAB3) return doSetUnset (&t->c_oflag, TAB3, b); #else - return 0; + return false; #endif case obs0: #if defined(BS0) return doSetUnset (&t->c_oflag, BS0, b); #else - return 0; + return false; #endif case obs1: #if defined(BS1) return doSetUnset (&t->c_oflag, BS1, b); #else - return 0; + return false; #endif case off0: #if defined(FF0) return doSetUnset (&t->c_oflag, FF0, b); #else - return 0; + return false; #endif case off1: #if defined(FF1) return doSetUnset (&t->c_oflag, FF1, b); #else - return 0; + return false; #endif case ovt0: #if defined(VT0) return doSetUnset (&t->c_oflag, VT0, b); #else - return 0; + return false; #endif case ovt1: #if defined(VT1) return doSetUnset (&t->c_oflag, VT1, b); #else - return 0; + return false; #endif case b0: #if defined(B0) return doSetUnset (&t->c_cflag, B0, b); #else - return 0; + return false; #endif case b50: #if defined(B50) return doSetUnset (&t->c_cflag, B50, b); #else - return 0; + return false; #endif case b75: #if defined(B75) return doSetUnset (&t->c_cflag, B75, b); #else - return 0; + return false; #endif case b110: #if defined(B110) return doSetUnset (&t->c_cflag, B110, b); #else - return 0; + return false; #endif case b135: #if defined(B134) return doSetUnset (&t->c_cflag, B134, b); #else - return 0; + return false; #endif case b150: #if defined(B150) return doSetUnset (&t->c_cflag, B150, b); #else - return 0; + return false; #endif case b200: #if defined(B200) return doSetUnset (&t->c_cflag, B200, b); #else - return 0; + return false; #endif case b300: #if defined(B300) return doSetUnset (&t->c_cflag, B300, b); #else - return 0; + return false; #endif case b600: #if defined(B600) return doSetUnset (&t->c_cflag, B600, b); #else - return 0; + return false; #endif case b1200: #if defined(B1200) return doSetUnset (&t->c_cflag, B1200, b); #else - return 0; + return false; #endif case b1800: #if defined(B1800) return doSetUnset (&t->c_cflag, B1800, b); #else - return 0; + return false; #endif case b2400: #if defined(B2400) return doSetUnset (&t->c_cflag, B2400, b); #else - return 0; + return false; #endif case b4800: #if defined(B4800) return doSetUnset (&t->c_cflag, B4800, b); #else - return 0; + return false; #endif case b9600: #if defined(B9600) return doSetUnset (&t->c_cflag, B9600, b); #else - return 0; + return false; #endif case b19200: #if defined(B19200) return doSetUnset (&t->c_cflag, B19200, b); #else - return 0; + return false; #endif case b38400: #if defined(B38400) return doSetUnset (&t->c_cflag, B38400, b); #else - return 0; + return false; #endif case b57600: #if defined(B57600) return doSetUnset (&t->c_cflag, B57600, b); #else - return 0; + return false; #endif case b115200: #if defined(B115200) return doSetUnset (&t->c_cflag, B115200, b); #else - return 0; + return false; #endif case b240400: #if defined(B230400) return doSetUnset (&t->c_cflag, B230400, b); #else - return 0; + return false; #endif case b460800: #if defined(B460800) return doSetUnset (&t->c_cflag, B460800, b); #else - return 0; + return false; #endif case b500000: #if defined(B500000) return doSetUnset (&t->c_cflag, B500000, b); #else - return 0; + return false; #endif case b576000: #if defined(B576000) return doSetUnset (&t->c_cflag, B576000, b); #else - return 0; + return false; #endif case b921600: #if defined(B921600) return doSetUnset (&t->c_cflag, B921600, b); #else - return 0; + return false; #endif case b1000000: #if defined(B1000000) return doSetUnset (&t->c_cflag, B1000000, b); #else - return 0; + return false; #endif case b1152000: #if defined(B1152000) return doSetUnset (&t->c_cflag, B1152000, b); #else - return 0; + return false; #endif case b1500000: #if defined(B1500000) return doSetUnset (&t->c_cflag, B1500000, b); #else - return 0; + return false; #endif case b2000000: #if defined(B2000000) return doSetUnset (&t->c_cflag, B2000000, b); #else - return 0; + return false; #endif case b2500000: #if defined(B2500000) return doSetUnset (&t->c_cflag, B2500000, b); #else - return 0; + return false; #endif case b3000000: #if defined(B3000000) return doSetUnset (&t->c_cflag, B3000000, b); #else - return 0; + return false; #endif case b3500000: #if defined(B3500000) return doSetUnset (&t->c_cflag, B3500000, b); #else - return 0; + return false; #endif case b4000000: #if defined(B4000000) return doSetUnset (&t->c_cflag, B4000000, b); #else - return 0; + return false; #endif case maxbaud: #if defined(__MAX_BAUD) return doSetUnset (&t->c_cflag, __MAX_BAUD, b); #else - return 0; + return false; #endif case crtscts: #if defined(CRTSCTS) return doSetUnset (&t->c_cflag, CRTSCTS, b); #else - return 0; + return false; #endif case cs5: #if defined(CS5) return doSetUnset (&t->c_cflag, CS5, b); #else - return 0; + return false; #endif case cs6: #if defined(CS6) return doSetUnset (&t->c_cflag, CS6, b); #else - return 0; + return false; #endif case cs7: #if defined(CS7) return doSetUnset (&t->c_cflag, CS7, b); #else - return 0; + return false; #endif case cs8: #if defined(CS8) return doSetUnset (&t->c_cflag, CS8, b); #else - return 0; + return false; #endif case cstopb: #if defined(CSTOPB) return doSetUnset (&t->c_cflag, CSTOPB, b); #else - return 0; + return false; #endif case cread: #if defined(CREAD) return doSetUnset (&t->c_cflag, CREAD, b); #else - return 0; + return false; #endif case parenb: #if defined(PARENB) return doSetUnset (&t->c_cflag, PARENB, b); #else - return 0; + return false; #endif case parodd: #if defined(PARODD) return doSetUnset (&t->c_cflag, PARODD, b); #else - return 0; + return false; #endif case hupcl: #if defined(HUPCL) return doSetUnset (&t->c_cflag, HUPCL, b); #else - return 0; + return false; #endif case clocal: #if defined(CLOCAL) return doSetUnset (&t->c_cflag, CLOCAL, b); #else - return 0; + return false; #endif case lisig: #if defined(ISIG) return doSetUnset (&t->c_lflag, ISIG, b); #else - return 0; + return false; #endif case licanon: #if defined(ICANON) return doSetUnset (&t->c_lflag, ICANON, b); #else - return 0; + return false; #endif case lxcase: #if defined(XCASE) return doSetUnset (&t->c_lflag, XCASE, b); #else - return 0; + return false; #endif case lecho: #if defined(ECHO) return doSetUnset (&t->c_lflag, ECHO, b); #else - return 0; + return false; #endif case lechoe: #if defined(ECHOE) return doSetUnset (&t->c_lflag, ECHOE, b); #else - return 0; + return false; #endif case lechok: #if defined(ECHOK) return doSetUnset (&t->c_lflag, ECHOK, b); #else - return 0; + return false; #endif case lechonl: #if defined(ECHONL) return doSetUnset (&t->c_lflag, ECHONL, b); #else - return 0; + return false; #endif case lnoflsh: #if defined(NOFLSH) return doSetUnset (&t->c_lflag, NOFLSH, b); #else - return 0; + return false; #endif case ltopstop: #if defined(TOSTOP) return doSetUnset (&t->c_lflag, TOSTOP, b); #else - return 0; + return false; #endif case lechoctl: #if defined(ECHOCTL) return doSetUnset (&t->c_lflag, ECHOCTL, b); #else - return 0; + return false; #endif case lechoprt: #if defined(ECHOPRT) return doSetUnset (&t->c_lflag, ECHOPRT, b); #else - return 0; + return false; #endif case lechoke: #if defined(ECHOKE) return doSetUnset (&t->c_lflag, ECHOKE, b); #else - return 0; + return false; #endif case lflusho: #if defined(FLUSHO) return doSetUnset (&t->c_lflag, FLUSHO, b); #else - return 0; + return false; #endif case lpendin: #if defined(PENDIN) return doSetUnset (&t->c_lflag, PENDIN, b); #else - return 0; + return false; #endif case liexten: #if defined(IEXTEN) return doSetUnset (&t->c_lflag, IEXTEN, b); #else - return 0; + return false; #endif } - return 0; + return false; } -/* GetChar - sets a CHAR, ch, value from, t, and returns TRUE if this +/* GetChar sets a CHAR ch value from t and returns true/false if this value is supported. */ -int -EXPORT (GetChar) (struct termios *t, ControlChar c, char *ch) +bool +EXPORT (GetChar) (termios_TERMIOS _t, termios_ControlChar _c, char *ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { case vintr: #if defined(VINTR) *ch = t->c_cc[VINTR]; - return 1; + return true; #else - return 0; + return false; #endif case vquit: #if defined(VQUIT) *ch = t->c_cc[VQUIT]; - return 1; + return true; #else - return 0; + return false; #endif case verase: #if defined(VERASE) *ch = t->c_cc[VERASE]; - return 1; + return true; #else - return 0; + return false; #endif case vkill: #if defined(VKILL) *ch = t->c_cc[VKILL]; - return 1; + return true; #else - return 0; + return false; #endif case veof: #if defined(VEOF) *ch = t->c_cc[VEOF]; - return 1; + return true; #else - return 0; + return false; #endif case vtime: #if defined(VTIME) *ch = t->c_cc[VTIME]; - return 1; + return true; #else - return 0; + return false; #endif case vmin: #if defined(VMIN) *ch = t->c_cc[VMIN]; - return 1; + return true; #else - return 0; + return false; #endif case vswtc: #if defined(VSWTC) *ch = t->c_cc[VSWTC]; - return 1; + return true; #else - return 0; + return false; #endif case vstart: #if defined(VSTART) *ch = t->c_cc[VSTART]; - return 1; + return true; #else - return 0; + return false; #endif case vstop: #if defined(VSTOP) *ch = t->c_cc[VSTOP]; - return 1; + return true; #else - return 0; + return false; #endif case vsusp: #if defined(VSUSP) *ch = t->c_cc[VSUSP]; - return 1; + return true; #else - return 0; + return false; #endif case veol: #if defined(VEOL) *ch = t->c_cc[VEOL]; - return 1; + return true; #else - return 0; + return false; #endif case vreprint: #if defined(VREPRINT) *ch = t->c_cc[VREPRINT]; - return 1; + return true; #else - return 0; + return false; #endif case vdiscard: #if defined(VDISCARD) *ch = t->c_cc[VDISCARD]; - return 1; + return true; #else - return 0; + return false; #endif case vwerase: #if defined(VWERASE) *ch = t->c_cc[VWERASE]; - return 1; + return true; #else - return 0; + return false; #endif case vlnext: #if defined(VLNEXT) *ch = t->c_cc[VLNEXT]; - return 1; + return true; #else - return 0; + return false; #endif case veol2: #if defined(VEOL2) *ch = t->c_cc[VEOL2]; - return 1; + return true; #else - return 0; + return false; #endif default: - return 0; + return false; } } -/* SetChar - sets a CHAR value in, t, and returns TRUE if, c, is +/* SetChar sets a CHAR value in t and returns true/false if c is supported. */ -int -EXPORT (SetChar) (struct termios *t, ControlChar c, char ch) +bool +EXPORT (SetChar) (termios_TERMIOS _t, termios_ControlChar _c, char ch) { + ControlChar c = (ControlChar) _c; + struct termios *t = (termios *)_t; switch (c) { case vintr: #if defined(VINTR) t->c_cc[VINTR] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vquit: #if defined(VQUIT) t->c_cc[VQUIT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case verase: #if defined(VERASE) t->c_cc[VERASE] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vkill: #if defined(VKILL) t->c_cc[VKILL] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veof: #if defined(VEOF) t->c_cc[VEOF] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vtime: #if defined(VTIME) t->c_cc[VTIME] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vmin: #if defined(VMIN) t->c_cc[VMIN] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vswtc: #if defined(VSWTC) t->c_cc[VSWTC] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vstart: #if defined(VSTART) t->c_cc[VSTART] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vstop: #if defined(VSTOP) t->c_cc[VSTOP] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vsusp: #if defined(VSUSP) t->c_cc[VSUSP] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veol: #if defined(VEOL) t->c_cc[VEOL] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vreprint: #if defined(VREPRINT) t->c_cc[VREPRINT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vdiscard: #if defined(VDISCARD) t->c_cc[VDISCARD] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vwerase: #if defined(VWERASE) t->c_cc[VWERASE] = ch; - return 1; + return true; #else - return 0; + return false; #endif case vlnext: #if defined(VLNEXT) t->c_cc[VLNEXT] = ch; - return 1; + return true; #else - return 0; + return false; #endif case veol2: #if defined(VEOL2) t->c_cc[VEOL2] = ch; - return 1; + return true; #else - return 0; + return false; #endif default: - return 0; + return false; } } diff --git a/gcc/m2/pge-boot/m2rts.h b/gcc/m2/pge-boot/m2rts.h index fe9745b1aa6..d8bac68fe6b 100644 --- a/gcc/m2/pge-boot/m2rts.h +++ b/gcc/m2/pge-boot/m2rts.h @@ -24,23 +24,31 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ - -typedef void (*proc_con) (int, char **, char **); -typedef void (*proc_dep) (void); +#ifdef M2_MC +/* These type definitions match those used by mc, they are defined differently + to satisfy -Wodr when building from the mc translated versions of m2 + source. */ +#include "GM2RTS.h" +#else +/* These type definitions match those used by cc1gm2, they will be the same + sizeof as those above (and also for all their dependants). */ +typedef void (*M2RTS_ArgCVEnvP) (int, char **, char **); +typedef void (*PROC) (void); +#endif #define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) \ M2RTS_RegisterModule (reinterpret_cast (const_cast (MODNAME)), \ reinterpret_cast (const_cast (LIBNAME)), \ init, fini, dep) -extern "C" void M2RTS_RequestDependant (const char *modulename, const char *dependancy); +extern "C" void M2RTS_RequestDependant (const void *modulename, const void *dependancy); extern "C" void M2RTS_RegisterModule (void *modulename, void *libname, - proc_con init, proc_con fini, proc_dep dependencies); + M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies); extern "C" void _M2_M2RTS_init (void); -extern "C" void M2RTS_ConstructModules (const char *, +extern "C" void M2RTS_ConstructModules (const void *, int argc, char *argv[], char *envp[]); extern "C" void M2RTS_Terminate (void); extern "C" void M2RTS_DeconstructModules (void); -extern "C" void M2RTS_Halt (const char *, int, const char *, const char *) __attribute__ ((noreturn)); +extern "C" void M2RTS_Halt (const char *, const char *, const char *, int) __attribute__ ((noreturn));