Migrate from devo/gcc/ch.
authorPer Bothner <bothner@gcc.gnu.org>
Thu, 27 Aug 1998 20:51:39 +0000 (13:51 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Thu, 27 Aug 1998 20:51:39 +0000 (13:51 -0700)
From-SVN: r22037

gcc/ch/Makefile.in [new file with mode: 0644]
gcc/ch/runtime/Makefile.in [new file with mode: 0644]
gcc/ch/runtime/allgmem.c [new file with mode: 0644]
gcc/ch/runtime/checkcycle.c [new file with mode: 0644]
gcc/ch/runtime/ffsetps.c [new file with mode: 0644]
gcc/ch/runtime/gettextrecord.c [new file with mode: 0644]
gcc/ch/runtime/inttime.c [new file with mode: 0644]
gcc/ch/runtime/sendbuffer.c [new file with mode: 0644]

diff --git a/gcc/ch/Makefile.in b/gcc/ch/Makefile.in
new file mode 100644 (file)
index 0000000..00f3d6a
--- /dev/null
@@ -0,0 +1,322 @@
+# Makefile for GNU CHILL compiler.
+#   Copyright (C) 1987, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC 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 2, or (at your option)
+#any later version.
+
+#GNU CC 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.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING.  If not, write to
+#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# The makefile built from this file lives in the language subdirectory.
+# It's purpose is to provide support for:
+#
+# 1) recursion where necessary, and only then (building .o's), and
+# 2) building and debugging cc1 from the language subdirectory, and
+# 3) nothing else.
+#
+# The parent makefile handles all other chores, with help from the
+# language makefile fragment, of course.
+#
+# The targets for external use are:
+# all, TAGS, ???mostlyclean, ???clean.
+
+# Suppress smart makes who think they know how to automake Yacc files
+.y.c:
+
+
+# Variables that exist for you to override.
+# See below for how to change them for certain systems.
+
+ALLOCA =
+
+# Various ways of specifying flags for compilations:  
+# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
+# BOOT_CFLAGS is the value of CFLAGS to pass
+# to the stage2 and stage3 compilations
+# XCFLAGS is used for most compilations but not when using the GCC just built.
+XCFLAGS =
+CFLAGS = -g
+BOOT_CFLAGS = -O $(CFLAGS)
+# These exists to be overridden by the x-* and t-* files, respectively.
+X_CFLAGS =
+T_CFLAGS =
+
+X_CPPFLAGS =
+T_CPPFLAGS =
+
+CC = cc
+AR = ar
+AR_FLAGS = rc
+SHELL = /bin/sh
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Define this as & to perform parallel make on a Sequent.
+# Note that this has some bugs, and it seems currently necessary 
+# to compile all the gen* files first by hand to avoid erroneous results.
+P =
+
+# This is used in the definition of SUBDIR_USE_ALLOCA.
+# ??? Perhaps it would be better if it just looked for *gcc*.
+OLDCC = cc
+
+# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
+# It omits XCFLAGS, and specifies -B./.
+# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
+GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
+
+# Tools to use when building a cross-compiler.
+# These are used because `configure' appends `cross-make'
+# to the makefile when making a cross-compiler.
+
+# CYGNUS LOCAL: we don't use cross-make.  Instead we use the tools
+# from the build tree, if they are available.
+# program_transform_name and objdir are set by configure.in.
+program_transform_name =
+objdir = .
+
+target= ... `configure' substitutes actual target name here.
+xmake_file= ... `configure' substitutes actual x- file name here.
+tmake_file= ... `configure' substitutes actual t- file name here.
+#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
+#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
+
+# Directory where sources are, from where we are.
+srcdir = .
+
+# CYGNUS LOCAL
+# Directory where texinfo.tex lives
+texidir = $(srcdir)/../../texinfo
+
+# Additional system libraries to link with.
+CLIB=
+
+# Change this to a null string if obstacks are installed in the
+# system library.
+OBSTACK=obstack.o
+
+# Choose the real default target.
+ALL=all
+
+# End of variables for you to override.
+
+# Definition of `all' is here so that new rules inserted by sed
+# do not specify the default target.
+all: all.indirect
+
+# This tells GNU Make version 3 not to put all variables in the environment.
+.NOEXPORT:
+
+# sed inserts variable overrides after the following line.
+####target overrides
+####host overrides
+####cross overrides
+####build overrides
+####site overrides
+\f
+# Now figure out from those variables how to compile and link.
+
+all.indirect: Makefile compiler
+
+# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
+INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
+
+# This is the variable actually used when we compile.
+ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
+
+# Likewise.
+ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
+
+# CYGNUS LOCAL: SUBDIR_USE_ALLOCA is different from FSF.
+# Even if ALLOCA is set, don't use it if compiling with GCC.
+
+SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
+#SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
+SUBDIR_USE_ALLOCA = `if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi`
+SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`
+
+# How to link with both our special library facilities
+# and the system's installed libraries.
+LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB)
+
+# Specify the directories to be searched for header files.
+# Both . and srcdir are used, in that order,
+# so that tm.h and config.h will be found in the compilation
+# subdirectory rather than in the source directory.
+INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config
+
+# Flags to pass to recursive makes.
+# ??? $(CC) may need some work to handle stage[123].
+# ??? The choices here will need some experimenting with.
+FLAGS_TO_PASS = \
+       "AR_FLAGS=$(AR_FLAGS)" \
+       "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
+       "BISON=$(BISON)" \
+       "BISONFLAGS=$(BISONFLAGS)" \
+       "CC=$(CC)" \
+       "CFLAGS=$(CFLAGS)" \
+       "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
+       "LDFLAGS=$(LDFLAGS)" \
+       "LEX=$(LEX)" \
+       "LEXFLAGS=$(LEXFLAGS)" \
+       "MAKEINFO=$(MAKEINFO)" \
+       "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
+       "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
+       "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
+       "SHELL=$(SHELL)" \
+       "exec_prefix=$(exec_prefix)" \
+       "prefix=$(prefix)" \
+       "tooldir=$(tooldir)" \
+       "bindir=$(bindir)" \
+       "libsubdir=$(libsubdir)"
+
+# Always use -I$(srcdir)/config when compiling.
+.c.o:
+       $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+# This tells GNU make version 3 not to export all the variables
+# defined in this file into the environment.
+.NOEXPORT:
+\f
+# Lists of files for various purposes.
+
+# Language-specific object files for CHILL
+
+#C_OBJS = ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o
+
+CHILL_OBJS = parse.o actions.o except.o grant.o lang.o \
+   tree.o lex.o decl.o typeck.o convert.o expr.o loop.o \
+   tasking.o timing.o inout.o satisfy.o ch-version.o
+
+# Language-independent object files.
+OBJS = `cat ../stamp-objlist`
+OBJDEPS = ../stamp-objlist
+
+compiler: ../chill ../cc1chill
+       cd runtime; $(MAKE) $(FLAGS_TO_PASS) CC="$(CC)" all
+
+../cc1chill: $(P) $(CHILL_OBJS) $(OBJDEPS) $(LIBDEPS)
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CHILL_OBJS) \
+             $(OBJS) $(C_OBJS) $(LIBS)
+
+# This executable is used in the CHILL regression 
+# test script
+utils/printf : $(srcdir)/utils/printf.c
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $<
+
+#
+# This is the top-level trigger for a CHILL regression test.
+# It also builds those tools needed for CHILL regression testing.
+#
+check: ../cc1chill utils/printf
+       cd ..; $(MAKE) $(FLAGS_TO_PASS) xgcc gcov cpp cc1 ld
+       cd runtime; make libchill.a
+       $(srcdir)/regression.sh -d -p
+
+clean-tests:
+       cd testsuite/execute;  $(MAKE) clean
+       cd testsuite/execute/oe;  $(MAKE) clean
+       cd testsuite/compile/elektra;  $(MAKE) clean
+       cd testsuite/compile/votrics;  $(MAKE) clean
+       cd testsuite/compile;  $(MAKE) clean
+       cd testsuite/noncompile;  $(MAKE) clean
+       cd testsuite/examples;  $(MAKE) clean
+
+mostlyclean:
+       test -d testsuite && $(MAKE) clean-tests
+       rm -f *.o
+
+clean:  mostlyclean
+       cd runtime;  $(MAKE) clean
+
+\f
+Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
+       cd ..; $(SHELL) config.status
+
+native: config.status ../cc1chill ../chill # runtime/libchill.a
+\f
+# Compiling object files from source files.
+
+# Note that dependencies on obstack.h are not written
+# because that file is not part of GCC.
+
+# CHILL language specific files.
+
+RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
+       $(srcdir)/../machmode.h $(srcdir)/../machmode.def
+TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
+       $(srcdir)/../machmode.h $(srcdir)/../machmode.def
+CHILL_TREE_H = $(TREE_H) ch-tree.h ch-tree.def
+
+# hash.h really depends on $(srcdir)/gperf.
+# But this would screw things for people that don't have gperf,
+# if gperf got touched, say.
+# Thus you have to remove hash.h to force it to be re-made.
+# Note: CHILL requires two sets of keywords, one all uppercase and
+# one all lowercase.  The hash table ends up with both sets in it.
+$(srcdir)/hash.h:
+       sed -e '1,/^%%/d' < $(srcdir)/gperf | \
+         sed '/^[^a-zA-Z]/d' | tr "[a-z]" "[A-Z]" > gperf.tmp
+       gawk '{ printf ("s/^%s,/%s,/\n", $$1, toupper ($$1)) }' < gperf.tmp > sed.tmp
+       sed -f sed.tmp < gperf.tmp > gperf.tmp2
+       cat $(srcdir)/gperf gperf.tmp2 > gperf.tmp
+       gperf -D -E -S1 -p -j1 -i 1 -g -o -t -k'*' gperf.tmp \
+          > $(srcdir)/hash.h
+       $(RM) gperf.tmp gperf.tmp2 sed.tmp
+
+actions.o : actions.c $(CONFIG_H) $(CHILL_TREE_H) actions.h $(RTL_H) \
+             lex.h $(srcdir)/../flags.h $(srcdir)/../obstack.h $(srcdir)/../input.h $(srcdir)/../expr.h ../insn-codes.h
+convert.o : convert.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h $(srcdir)/../tree.h
+decl.o : decl.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h lex.h
+except.o : except.c $(CONFIG_H) $(srcdir)/../tree.h $(RTL_H) $(CHILL_TREE_H)
+expr.o : expr.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
+       $(srcdir)/../expr.h ../insn-codes.h $(srcdir)/../tree.h lex.h
+grant.o: grant.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h $(srcdir)/../input.h \
+            lex.h actions.h $(srcdir)/../input.h
+inout.o : inout.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h $(srcdir)/../input.h
+lang.o : lang.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../input.h lex.h
+lex.o : lex.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h $(srcdir)/../input.h \
+           $(srcdir)/parse.h $(srcdir)/../obstack.h lex.h
+lex.c: hash.h
+loop.o : loop.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) lex.h ../flags.h \
+       ../input.h ../obstack.h ../tree.h
+parse.o : parse.c $(CONFIG_H) $(CHILL_TREE_H) parse.h \
+       lex.h actions.h tasking.h
+satisfy.o : satisfy.c $(CONFIG_H) $(CHILL_TREE_H) ../tree.h ../flags.h lex.h
+timing.o : timing.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) ../flags.h \
+               ../input.h ../obstack.h lex.h
+tasking.o : tasking.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) ../flags.h \
+               ../input.h ../obstack.h lex.h
+tree.o : tree.c $(CONFIG_H) $(CHILL_TREE_H)
+typeck.o : typeck.c $(CONFIG_H) $(CHILL_TREE_H) ../insn-codes.h \
+       $(srcdir)/../expr.h $(srcdir)/../flags.h lex.h
+ch-version.o : ch-version.c
+ch-version.c : Makefile
+       echo 'char *gnuchill_version = "$(GNUCHILL_VERSION)";' > $@
+
+## This is ugly, but I don't want GNU make to put these variables in
+## the environment.  Older makes will see this as a set of targets
+## with no dependencies and no actions.
+unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
+
+\f
+# These exist for maintenance purposes.
+
+# Update the tags table.
+TAGS: force
+       cd $(srcdir);                                                   \
+       etags *.y *.h *.c *.l ../*.h ../*.c;                            \
+
+.PHONY: TAGS
+
+force:
diff --git a/gcc/ch/runtime/Makefile.in b/gcc/ch/runtime/Makefile.in
new file mode 100644 (file)
index 0000000..706d0cc
--- /dev/null
@@ -0,0 +1,191 @@
+# Makefile for GNU CHILL compiler runtime library.
+#   Copyright (C) 1987, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC 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 2, or (at your option)
+#any later version.
+
+#GNU CC 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.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING.  If not, write to
+#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# The targets for external use include:
+# all, doc, TAGS, mostlyclean, clean, distclean, realclean,
+
+srcdir = .
+
+AR_FOR_TARGET = ` \
+  if [ -f ../../../binutils/ar ] ; then \
+    echo ../../../binutils/ar ; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo ar; \
+    else \
+       t="$(program_transform_name)"; echo ar | sed -e '' $$t ; \
+    fi \
+  fi`
+AR_FOR_TARGET_FLAGS = rc
+# How to invoke ranlib.
+RANLIB_FOR_TARGET = ` \
+  if [ -f ../../../binutils/ranlib ] ; then \
+    echo ../../../binutils/ranlib ; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo ranlib; \
+    else \
+       t="$(program_transform_name)"; echo ranlib | sed -e '' $$t ; \
+    fi \
+  fi`
+RANLIB_TEST_FOR_TARGET = \
+  [ -f $(RANLIB_FOR_TARGET) ] \
+  || ( [ "$(host_canonical)" = "$(target_canonical)" ] \
+       && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
+
+# Directory in which to find other cross-compilation tools and headers.
+# Used to compile the library
+tooldir = $(exec_prefix)/$(target_alias)
+
+BASE = ../..
+GCC_FOR_TARGET = $(BASE)/xgcc -B$(BASE)/
+CFLAGS = -g -O
+
+# Always search these dirs when compiling.
+INCLUDES = -I. -I$(BASE) -I$(srcdir) -I$(srcdir)/$(BASE)/config \
+   -I../../include -I$(tooldir)/include -I$(srcdir)/$(BASE) 
+
+ALL_CFLAGS = $(CFLAGS)
+
+AR_FOR_TARGET = ` \
+  if [ -f $(BASE)/../binutils/ar ] ; then \
+    echo $(BASE)/../binutils/ar ; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo ar; \
+    else \
+       t="$(program_transform_name)"; echo ar | sed -e '' $$t ; \
+    fi \
+  fi`
+AR_FOR_TARGET_FLAGS = rc
+RANLIB_FOR_TARGET = ` \
+  if [ -f $(BASE)/../binutils/ranlib ] ; then \
+    echo $(BASE)/../binutils/ranlib ; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo ranlib; \
+    else \
+       t="$(program_transform_name)"; echo ranlib | sed -e '' $$t ; \
+    fi \
+  fi`
+RANLIB_TEST_FOR_TARGET = \
+  [ -f $(RANLIB_FOR_TARGET) ] \
+  || ( [ "$(host_canonical)" = "$(target_canonical)" ] \
+       && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
+
+
+AR = $(AR_FOR_TARGET)
+AR_FLAGS = $(AR_FOR_TARGET_FLAGS)
+# How to invoke ranlib.
+RANLIB = $(RANLIB_FOR_TARGET)
+# Test to use to see whether ranlib exists on the system.
+RANLIB_TEST = $(RANLIB_TEST_FOR_TARGET)
+
+INSTALL = install -c
+# These permit overriding just for certain files.
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL)
+
+# End of variables for you to override.
+
+# Definition of `all' is here so that new rules inserted by sed
+# do not specify the default target.
+all: all.indirect
+
+# This tells GNU Make version 3 not to put all variables in the environment.
+.NOEXPORT:
+
+# sed inserts variable overrides after the following lines.
+####target overrides
+####host overrides
+####cross overrides
+####build overrides
+####site overrides
+\f
+#### Host, target, and site specific Makefile fragments come in here.
+###
+
+.c.o:
+       $(GCC_FOR_TARGET) -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+# Lists of required functions for each archive.
+
+LIBOBJS1 = allgmem.o allmem.o allocate.o cause.o exhstack.o exh.o retmem.o \
+          unhex.o unhex1.o rtsdummy.o terminate.o
+
+IOOBJS = basicio.o chillstdio.o delete.o eoln.o existing.o format.o getassoc.o \
+         gettextaccess.o gettextindex.o gettextrecord.o getusage.o \
+         indexable.o ioerror.o isassociated.o outoffile.o readable.o \
+         readrecord.o sequencible.o settextaccess.o settextindex.o \
+         settextrecord.o variable.o writeable.o writerecord.o
+
+PSOBJS = andps.o cardps.o concatps.o copyps.o diffps.o eqps.o ffsetclrps.o \
+       ffsetps.o flsetclrps.o flsetps.o inbitstr.o inps.o leps.o ltps.o \
+       neps.o notps.o orps.o setbitps.o setbits.o sliceps.o xorps.o
+
+STROBJS = concatstr.o eqstr.o ltstr.o memmove.o
+
+TIMEOBJS = abstime.o inttime.o waituntil.o remaintime.o convdurrtstime.o \
+           checkcycle.o
+
+TASKOBJS = continue.o delaycase.o printbuffer.o printevent.o queuelength.o \
+          sendbuffer.o waitbuffer.o
+
+OBJS = $(LIBOBJS1) $(IOOBJS) $(PSOBJS) $(STROBJS) $(TIMEOBJS) $(TASKOBJS)
+
+all.indirect: chillrt0.o libchill.a Makefile
+
+.PHONY: check installcheck
+check:
+installcheck:
+
+libchill.a: $(OBJS)
+       $(AR_FOR_TARGET) $(AR_FOR_TARGET_FLAGS) $@ $(OBJS)
+       -if $(RANLIB_TEST_FOR_TARGET) ; then $(RANLIB_FOR_TARGET) $@; else true; fi
+
+$(PSOBJS): $(srcdir)/powerset.h
+librmt.o: $(srcdir)/rtltypes.h
+chillrt0.o: $(srcdir)/rtltypes.h $(srcdir)/iomodes.h $(srcdir)/auxtypes.h
+$(LIBOBJS1): $(srcdir)/rtltypes.h
+$(TIMEOBJS): $(srcdir)/rtltypes.h $(srcdir)/rts.h
+$(TASKOBJS): $(srcdir)/rts.h $(srcdir)/rtltypes.h
+$(IOOBJS): $(srcdir)/fileio.h $(srcdir)/bitstring.h $(srcdir)/auxtypes.h \
+           $(srcdir)/iomodes.h $(srcdir)/format.h $(srcdir)/ioerror.h
+# With a new cc1 compile the library again
+$(OBJS): ../../cc1
+
+install-info:
+
+info:
+
+dvi:
+
+Makefile: $(srcdir)/Makefile.in
+       $(SHELL) ./config.status
+
+mostlyclean:
+       -rm -f $(OBJS) chillrt0.o
+clean: mostlyclean
+       -rm -f libchill.a
+extraclean: clean
+       true
+distclean: extraclean
+       -rm -f Makefile
+realclean: distclean
+       true
diff --git a/gcc/ch/runtime/allgmem.c b/gcc/ch/runtime/allgmem.c
new file mode 100644 (file)
index 0000000..b0d91ed
--- /dev/null
@@ -0,0 +1,61 @@
+/* Implement runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include "rtltypes.h"
+
+extern void __cause_ex1 (char *ex, char *filename, int lineno);
+
+EXCEPTION (notimplemented);
+
+/*
+ * function _allocate_global_memory
+ *
+ * parameters:
+ *  ptr                        pointer to location where pointer should be written
+ *  size               number of bytes to allocate
+ *  filename            source file which issued the call
+ *  linenumber          line number of the call within that file
+ *
+ * returns:
+ *  void
+ *
+ * exceptions:
+ *  spacefail
+ *  protectionfail
+ *  rangefail
+ *
+ * abstract:
+ *  allocate global memory. At the moment we dont know how to realize this,
+ *  therefore cause NotImplemented.
+ *
+*/
+
+void
+_allocate_global_memory (ptr, size, filename, linenumber)
+     void **ptr;
+     int size;
+     char *filename;
+     int linenumber;
+{
+    __cause_ex1 ("notimplemented", filename, linenumber);
+}
+
diff --git a/gcc/ch/runtime/checkcycle.c b/gcc/ch/runtime/checkcycle.c
new file mode 100644 (file)
index 0000000..571884a
--- /dev/null
@@ -0,0 +1,65 @@
+/* Implement timing-related runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "rtltypes.h"
+#include "rts.h"
+
+EXCEPTION (cyclefail);
+
+/*
+ * function __check_cycle
+ *
+ * parameters:
+ *      t         pointer to initial time
+ *      dur       duration
+ *      filename  filename of call
+ *      lineno    linenumber of call
+ *
+ * returns:
+ *      void
+ *
+ * exceptions:
+ *      cyclefail
+ *
+ * abstract:
+ *      Function checks if cycle is possible (there is time left) and wait the
+ *      remaining time.
+ *
+ */
+
+extern int __remaintime (RtsTime *since, unsigned long dur, RtsTime *remain);
+extern int __cause_ex1 (char *ex, char *file, int lineno);
+    
+void
+__check_cycle (t, dur, fname, lineno)
+    RtsTime       *t;
+    unsigned long  dur;
+    char          *fname;
+    int            lineno;
+{
+  RtsTime remain;
+  
+  if (__remaintime (t, dur, &remain) != 0)
+    /* no time left -- cause exception */
+    __cause_ex1 ("cyclefail", fname, lineno);
+  
+  /* delay the process */
+  __delay_this (wait_wait, &remain, fname, lineno);
+}
diff --git a/gcc/ch/runtime/ffsetps.c b/gcc/ch/runtime/ffsetps.c
new file mode 100644 (file)
index 0000000..c17cd59
--- /dev/null
@@ -0,0 +1,109 @@
+/* Implement POWERSET runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser, et al
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#define __CHILL_LIB__
+
+#include "config.h"
+#include <stdio.h>
+#include "powerset.h"
+
+extern void __cause_ex1 (char *exname, char *file, int lineno);
+
+/*
+ * function __ffsetpowerset
+ *
+ * parameters:
+ *     ps              powerset
+ *     bitlength       length of powerset
+ *      minval          set low bound
+ *      filename        caller's file name
+ *      lineno          caller's line number
+ *
+ * returns:
+ *     int             enum value of lowest member of powerset
+ *
+ * exceptions:
+ *      "empty" if the set is empty
+ *
+ * abstract:
+ *  Find first bit set in a powerset and return the corresponding value.
+ *
+ */
+long
+__ffsetpowerset (ps, bitlength, minval, filename, lineno)
+     SET_WORD      *ps;
+     unsigned long  bitlength;
+     long           minval;
+     char          *filename;
+     int            lineno;
+{
+  unsigned long bitno;
+
+  if (bitlength <= SET_CHAR_SIZE)
+    {
+      SET_CHAR cset = *((SET_CHAR *)ps);
+      if (cset != 0)
+       {
+         /* found a bit set .. calculate which */
+         for (bitno = 0; bitno < SET_CHAR_SIZE; bitno++)
+           if (GET_BIT_IN_CHAR (cset, bitno))
+             break;
+         /* return its index */
+         return bitno + minval;
+       }
+    }
+  else if (bitlength <= SET_SHORT_SIZE)
+    {
+      SET_SHORT sset = *((SET_SHORT *)ps);
+      if (sset != 0)
+       {
+         /* found a bit set .. calculate which */
+         for (bitno = 0; bitno < SET_SHORT_SIZE; bitno++)
+           if (GET_BIT_IN_SHORT (sset, bitno))
+             break;
+         /* return its index */
+         return bitno + minval;
+       }
+    }
+  else /* set composed of array of one or more WORDs */
+    {
+      SET_WORD *p    = ps;
+      SET_WORD *endp = ps + BITS_TO_WORDS(bitlength);
+      unsigned long    cnt;
+      
+      /* FIXME: bitorder problems? */
+      for (cnt = 0; p < endp; p++, cnt += SET_WORD_SIZE)
+       {
+         SET_WORD c = *p;
+
+         if (c)
+           {
+             /* found a bit set .. calculate which */
+             for (bitno = 0; bitno < SET_WORD_SIZE; bitno++)
+               if (GET_BIT_IN_WORD (c, bitno))
+                 break;
+             /* return its index */
+             return cnt + bitno + minval;
+           }
+       }
+    }
+  /* no bits found - raise exception */
+  __cause_ex1 ("empty", filename, lineno);
+}
diff --git a/gcc/ch/runtime/gettextrecord.c b/gcc/ch/runtime/gettextrecord.c
new file mode 100644 (file)
index 0000000..16934f5
--- /dev/null
@@ -0,0 +1,30 @@
+/* Implement Input/Output runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser, et al
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "fileio.h"
+
+VarString*
+__gettextrecord( Text_Mode* the_text, char* file, int line )
+{
+  if( !the_text )
+    CHILLEXCEPTION( file, line, EMPTY, NULL_TEXT );
+
+  return the_text->text_record;
+}
diff --git a/gcc/ch/runtime/inttime.c b/gcc/ch/runtime/inttime.c
new file mode 100644 (file)
index 0000000..b82c5ec
--- /dev/null
@@ -0,0 +1,85 @@
+/* Implement timing-related runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include <time.h>
+
+typedef struct
+{
+  void          *p;
+  unsigned long len;
+} Descr;
+
+typedef Descr   **Toutlist;
+
+#define ASSIGN_VALUE(OUT,VAL)          \
+do                                     \
+{                                      \
+  if (OUT)                             \
+    switch (OUT->len)                  \
+      {                                \
+      case 1:                          \
+       *(char *)((OUT)->p) = VAL;     \
+       break;                         \
+      case 2:                          \
+       *(short *)((OUT)->p) = VAL;    \
+       break;                         \
+      case 4:                          \
+       *(int *)((OUT)->p) = VAL;      \
+       break;                         \
+      }                                \
+} while (0)
+
+
+/*
+ * function _inttime
+ *
+ * parameters:
+ *     t    time_t
+ *     list the pointers to the results
+ *
+ * returns:
+ *     void
+ *
+ * exceptions:
+ *     none
+ *
+ * abstract:
+ *     perform the INTTIME builtin call
+ *
+ */
+
+void
+_inttime (timer, outlist)
+     time_t   timer;
+     Toutlist outlist;
+{
+  struct tm  *time_str;
+
+  /* get struct tm from time_t */
+  time_str = localtime (&timer);
+
+  /* assign the values */
+  ASSIGN_VALUE (outlist[0], time_str->tm_year + 1900);
+  ASSIGN_VALUE (outlist[1], time_str->tm_mon + 1);
+  ASSIGN_VALUE (outlist[2], time_str->tm_mday);
+  ASSIGN_VALUE (outlist[3], time_str->tm_hour);
+  ASSIGN_VALUE (outlist[4], time_str->tm_min);
+  ASSIGN_VALUE (outlist[5], time_str->tm_sec);
+}
diff --git a/gcc/ch/runtime/sendbuffer.c b/gcc/ch/runtime/sendbuffer.c
new file mode 100644 (file)
index 0000000..2c2cc3e
--- /dev/null
@@ -0,0 +1,175 @@
+/* Implement tasking-related runtime actions for CHILL.
+   Copyright (C) 1992,1993 Free Software Foundation, Inc.
+   Author: Wilfried Moser
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "rtltypes.h"
+#include "rts.h"
+
+EXCEPTION (sendfail);
+
+extern void __cause_ex1 (char *ex, char *file, int lineno);
+
+#define CAUSE_SENDFAIL  __cause_ex1 ("sendfail", filename, lineno)
+
+/*
+ * function __send_buffer
+ *
+ * parameters:
+ *     buffer     pointer to buffer descriptor
+ *     data       pointer to data descriptor
+ *     prio       priority for send action
+ *     timeout   pointer to timeout value
+ *     filename   source file name where function gets called
+ *     lineno     linenumber in source file
+ *
+ * returns:
+ *     int       0 .. success
+ *                1 .. timeout
+ *
+ * exceptions:
+ *     sendfail
+ *
+ * abstract:
+ *     implement the CHILL SEND buffer action.
+ */
+
+int
+__send_buffer (buffer, data, prio, timeout, filename, lineno)
+     Buffer_Descr    *buffer;
+     Data_Descr      *data;
+     int              prio;
+     void            *timeout;
+     char            *filename;
+     int              lineno;
+{
+  Buffer_Queue        *bq;
+  Buffer_Send_Queue   *bsq, *bsq_entry, *prev_bsq_entry;
+  int                  cnt = 0;
+  int                 retval = 0;
+  
+  /* if we don't have anything queued on that buffer,
+     set up the structure */
+  memcpy (&bq, buffer->buf, sizeof (Buffer_Queue *));
+  if (bq == 0)
+    {
+      MALLOC (bq, sizeof (Buffer_Queue));
+      memset (bq, 0, sizeof (Buffer_Queue));
+      memcpy (buffer->buf, &bq, sizeof (Buffer_Queue *));
+    }
+
+  /* look if there is a process delayed on that buffer */
+  if (bq->waitqueue != 0)
+    {
+       Buffer_Wait_Queue       *listentry;
+       
+       /* there is already a processes waiting for that buffer,
+          check datalength and copy the data in */
+       if (bq->waitqueue->datalen < data->length)
+           CAUSE_SENDFAIL;
+       memcpy (bq->waitqueue->dataptr, data->ptr, data->length);
+       
+       /* set up the entry */
+       bq->waitqueue->is_sent = 1;
+       bq->waitqueue->who_sent = THIS;
+
+       /* continue waiting process */
+       __continue_that (bq->waitqueue->this, prio, filename, lineno);
+       
+       /* now dequeue all entries of this list */
+       listentry = bq->waitqueue->startlist;
+       while (listentry != 0)
+       {
+           Buffer_Wait_Queue   *tmp, *prev_entry, *bwq;
+           Buffer_Queue        *bq;
+
+           tmp = listentry->chain;
+           memcpy (&bq, listentry->bufferaddr, sizeof (Buffer_Queue *));
+           prev_entry = (Buffer_Wait_Queue *)&bq->waitqueue;
+           bwq = bq->waitqueue;
+
+           while (bwq != listentry)
+           {
+               prev_entry = bwq;
+               bwq = bwq->forward;
+           }
+           /* dequeue it */
+           prev_entry->forward = bwq->forward;
+           bq->waitqueuelength--;
+           listentry = tmp;
+       }
+       
+       /* all done */
+       return 0;
+    }
+
+  /* nothing in waitqueue, set up an entry for sendqueue.
+     Note: we allocate here space for the data too, to reduce
+     calls to malloc and let the dataptr point just behind
+     the Buffer_Send_Queue structure. */
+  MALLOC (bsq_entry, sizeof (Buffer_Send_Queue) + data->length);
+  memset (bsq_entry, 0, sizeof (Buffer_Send_Queue));
+
+  bsq_entry->priority = prio;
+  bsq_entry->this = THIS;
+  bsq_entry->datalen = data->length;
+  bsq_entry->dataptr = bsq_entry + 1;
+  memcpy (bsq_entry->dataptr, data->ptr, data->length);
+
+  /* add entry to sendqueue */
+  prev_bsq_entry = (Buffer_Send_Queue *)&bq->sendqueue;
+  bsq = bq->sendqueue;
+
+  while (bsq != 0 && bsq->priority >= prio)
+    {
+      prev_bsq_entry = bsq;
+      bsq = bsq->forward;
+    }
+  if (bsq == 0)
+    {
+      /* beginning or end of the list */
+      prev_bsq_entry->forward = bsq_entry;
+    }
+  else
+    {
+      /* somewhere in the middle */
+      bsq_entry->forward = prev_bsq_entry->forward;
+      prev_bsq_entry->forward = bsq_entry;
+    }
+
+  if (buffer->maxqueuelength != (unsigned long)-1L &&
+      bq->sendqueuelength >= buffer->maxqueuelength)
+    {
+      /* we have to delay this process */
+      bsq_entry->is_delayed = 1;
+      retval = __delay_this (wait_buffer_send, timeout, filename, lineno);
+      if (retval)
+        {
+         prev_bsq_entry->forward = bsq_entry->forward;
+         FREE (bsq_entry);
+        }
+    }
+  else
+    /* just say that there is one more entry in the queue */
+    bq->sendqueuelength++;
+  return retval;
+}
+
+/* force function __print_buffer to be linked */
+extern void __print_buffer ();
+static EntryPoint pev = __print_buffer;